c++ - glGetUniformLocation gives glError: GL_INVALID_VALUE -


i'm using modified version of this minimal example opengl code (in qt 5.2.0) working oculus hmd. relevant parts have not been changed me.

however, calls glgetuniformlocation in gl_uniform_2f/4f/1i functions give glerror gl_invalid_value (it's call, used many glgeterror calls find it).

i read before trying such operation in different threads might cause problem, i'm not using threads (as far know, anyway).

the shader program compiles/links without problem, shouldn't issue, either.

so far, nothing tried helped, , since i'm rather inexperienced regarding shaders, maybe can see problem.

edit: after validating shader program with

glvalidateprogram(gl_fragment_shader_program); glgetprogramiv(gl_fragment_shader_program, gl_validate_status, &result); glgetprogramiv(gl_fragment_shader_program, gl_info_log_length, &infologlength); std::vector<char> programerrormessage(infologlength+1); glgetprograminfolog(gl_fragment_shader_program, infologlength, null, &programerrormessage[0]); qdebug() << &programerrormessage[0]; 

the result is

validation warning! - sampler value texture0 has not been set. validation successful. 

and since read elsewhere warning can ignored, thought nothing of it.

edit2: ok, realize program has validated right before gldraw() call. warning goes away in case, gl_invalid_value error original question remains.

after lot of digging, found out function of mine initializes gluint handles of shader programs etc. 0 called way after qglwidget::initializegl() call. wasn't opengl issue after all, didn't have correct shader program bound.

i hope helps maybe uses qt , opengl not quite experienced far (like me).


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -