If I hardcode the uniform's value in the shader, the application displays the geometry correctly, and when asked for the value (again, using glGetUniformfv), it returns the correct value.Īny idea why does this happen? I am using OpenGL 4.4, but I have tried many different versions with the same result. If I query the uniform's value using glGetUniformfv, it returns the default value (not the one I just set), and the geometry doesn't show up at all (but that is just a consequence, that's not the problem here). The problem is that it doesn't seem to set the value at all. GlUniformMatrix4fv(matrix, 1, GL_FALSE, glm::value_ptr(mvp)) GLuint matrix = glGetUniformLocation(program, "mvp") Here is the (vertex) shader code:Īnd the code I use to set the value ( glGetUniformLocation returns 0 as expected): The shaders compile successfully, and work correctly if I eliminate the uniform value. To be more specific, I am trying to set a uniform value of the shader. OpenGL Shading Language (GLSL) is a high-level shading language with a syntax based on the C programming language.It was created by the OpenGL ARB (OpenGL Architecture Review Board) to give developers more direct control of the graphics pipeline without having to use ARB assembly language or hardware-specific languages. I am currently learning OpenGL programming, and I have made some good progress, but I seem to be stuck now.Ĭurrently, I am trying to get simple shaders to work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |