In a vertex shader, I calculate a vector using only uniforms. Therefore, the outcome of this calculation is the same for all instantiations of the vertex shader. Should I just do this calculation on the CPU and upload it as a uniform? What if I have ten such calculations? If I upload a lot of uniforms in this way, does CPU-GPU communicat...
I've noticed that my GLSL shaders are not compilable when the GLSL version is lower than 130.
What are the most critical elements for having a backward compatible shader source? I don't want to have a full backward compatibility, but I'd like to understand the main guidelines for having simple (forward compatible) shaders running on GP...
I am trying to use multiple textures in the same scene but no matter what I try the same texture is loaded for each object. So this what I am doing at the moment, I initialise each shader:
rightWall.SendShaders("wall.vert","wall.frag","brick3.bmp", "wallTex", 0);
demoFloor.SendShaders("floor.vert","floor.frag","dirt1.bmp", "floor...
Hi everyone,
I was expecting gl_Position to automatically get homogenized (divided by w), but it seems not working.. Why do the followings make different results?
1)
void main() {
vec4 p;
... omitted ...
gl_Position = projectionMatrix * p;
}
2)
... same as above ...
p = projectionMatrix * p;
gl_Position = p / p.w;
I think ...
hello, i am using this code to check if my glsl shader compiled fine.
glGetObjectParameterivARB(obj, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infologLength);
if (infologLength > 1)
{
int charsWritten = 0;
char * const infoLog = new char[infologLength];
glGetInfoLogARB(obj, infologLength, &charsWritten, infoL...
I have seen metal/plastic/water/fire/... shaders for OpenGL.
However, it it possible to render something fur-like, say a stuffed animal / teddy bear in OpenGL (I know this is possible with renderman / ray tracers, but I want to do it in OpenGl).
If you have pointers to GLSl shaders for this, please point me in the right direction.
Tha...
I'm trying to use the unscaled (true distance from the front clipping plane) distance to objects in my scene in a GLSL fragment shader. The gl_FragCoord.z value is smaller than I expect. In my vertex shader, I just use ftransform() to set gl_Position. I'm seeing values between 2 and 3 when I expect them to be between 15 and 20.
How c...
i have several objects on my scene. i want to apply my shader to one of them only. Environment: OpenGL 2.0, C++, GLUT, GLEW.
...
Does the iPad support GLSL?
...
Anyone have a good list of tutorials on doing Non photo realistic rendering with GLSL ? I have seen books on GLSL, and books on NPR, but very few books/tutorials on doing NPR with GLSL. (I want to do it with GLSL as I want real time).
Thanks!
...
If I have an OpenGL texture, and I need to perform HSL modifications on it before rendering the texture, from what I've heard I need a shader. Problem is, I know nothing about shaders. Does anyone know where I would need to look?
I want to write a function where I can pass in a texture and three values, a hue shift in degrees, and sat...
I'm trying to wrap my head around shaders in GLSL, and I've found some useful resources and tutorials, but I keep running into a wall for something that ought to be fundamental and trivial: how does my fragment shader retrieve the color of the current fragment?
You set the final color by saying gl_FragColor = whatever, but apparently th...
I'm trying to find like NeHe's tutorials for Qt that are all in GLSL. Because lets face it, OpenGL in the old days are dead and Shaders are the only way now. And with Qt-4.6 they introduced the QMatrix4x4, QVector3, and the Shader classes. But I cannot find any tutorials for this.
All the ones I do find, all use crappy SDL and/or GLUT (...
The iPhone SDK has an example of using ES 2.0 with a set of (Vertex & Fragment) GLSL shaders to render a varying colored box. Is there an example out there on how to render a simple texture using this API? I basically want to take a quad, and draw a texture onto it.
The old ES 1.1 API's don't work at all anymore, so I'm needing a bit ...
UPDATE: Danvil solved it in a comment below. My texture format was GL_RGB not GL_RGBA which of course means that the alpha values aren't kept. Don't know why I didn't realize... Thanks Danvil.
I am rendering to a texture using a GLSL shader and then sending that texture as input to a second shader. For the first texture I am using RGB c...
I was following this tutorial using Apple's OpenGL Shader Builder (tool similar to Nvidia's fx composer, but simpler).
I could easily apply the filters, but I don't understand if they worked correct (and if so how can I improve the output). For example the blur filter: OpenGL itself does some image processing on the textures, so if they...
Hi everyone !
I know the following question have been asked many times on different forums, but after viewing different solutions, it still did not fix my problem, or maybe I did not get what they mean
I am trying to model a pyramid using OpenGL ES 2.0 on the iPhone.
I would like to allow the user to rotate this pyramid using the touch ...
I'm trying to get MRT working in OpenGL to try out deferred rendering. Here's the situation as I understand it.
Create 3 render buffers (for example). Two RGBA8 and one Depth32.
Create an FBO.
Attach render buffers to FBO. ColorAttachment0/1 for color buffers, DepthAttachment for depth buffer.
Bind the FBO.
Draw geometry.
Send data to ...
Hello,
I am writing my first shader in WebGL. I was wondering if the GLSL language has any way to evaluate if an attribute or a uniform is null. According to the specs it does not support to do something like
if (attributeX) {
dothis();
}
else{
dothat():
}
And I think it would be a waste to write a bool attribute for each of these...
I'm using a series of shaders to perform realtime image processing on the iPhone (3GS/4/iPad). The fps isn't what I'd like it to be.
Are there any tools that I can use to help me work out what the bottlenecks are?
...