Sign in to follow this  
reoxthen

[SOLVED] glUniform crash with samplers

Recommended Posts

my textures are initialized successfully. checked all with the old pipeline they just work fine. shaders compiled and program linked succesfully. I got the valid uniform locations for the samplers. textures are bound to corresponding tex units. when I call glUniform1i or glUniform1iv with texture handle, the program raises an access violation. any idea? [Edited by - reoxthen on July 21, 2009 1:50:21 PM]

Share this post


Link to post
Share on other sites
well.. it's ok cuz in the textures are only textures in my test case and they have the handle values same as the tex unit values. but I tried your way too.. still crashes.

[Edited by - reoxthen on July 21, 2009 1:35:57 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by reoxthen
well.. it's ok cuz in the textures are only textures in my test case and they have the handle values same as the tex unit values. but I tried your way too.. still crashes.

It shouldn't crash in any case, can you post the code ?

Share this post


Link to post
Share on other sites
I realized it only crashes with glUniform1iv. I set the "count" parameter as 1...

// works fine
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureHandle);
glUniform1i(glGetUniformLocation(programHandle, "mytexture"), 0);

//crashes
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureHandle);
glUniform1iv(glGetUniformLocation(programHandle, "mytexture"), 1, 0);

and the weird thing is, this used to work in another project.

Share this post


Link to post
Share on other sites
Quote:
Original post by reoxthen
I realized it only crashes with glUniform1iv. I set the "count" parameter as 1...
and the weird thing is, this used to work in another project.

I highly doubt it worked for you elsewhere, maybe it just didn't crash out of pure luck. For *v functions the parameter is a pointer to array of values (or to a single value), that is it should be

GLint val = 0;

glUniform1iv(...,1,&val);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this