Jump to content
  • Advertisement
Sign in to follow this  
RonHiler

glBindTexture giving GL_INVALID_VALUE

This topic is 2543 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I'm doing something wrong, but I really can't figure out what it is.

I create 4 textures during initialization, using this routine:

void OGLWrapper::CreateTexture(void*, unsigned int Width, unsigned int Height, BYTE *Data, void**, GLuint *TextureOGL)
{
glGenTextures(1, TextureOGL);
CheckError("CreateTexture (glGenTextures)");
glBindTexture(GL_TEXTURE_2D, *TextureOGL);
CheckError("CreateTexture (glBindTexture)");
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, Width, Height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, Data);
CheckError("CreateTexture (glTexImage2D)");
}

That routine is called 4 times to create the four textures. The TextureOGL value is stored in the material class (and it turns out to be 1 through 4 for the 4 textures). This runs with no errors reported.

Then I want to use those textures to draw. So I simply try to bind them again with this function, passing in the stored Texture:

//---------------------------------------------------------------------------
void OGLWrapper::PSSetShaderResource(void*, void*, void*, void*, GLuint TextureOGL)
{
glBindTexture(GL_TEXTURE_2D, TextureOGL);
CheckError("PSSetShaderResource");
}

The values coming into this routine are in the range of 1 to 4, so they seem right. But the function is erroring with a GL_INVALID_VALUE. According to the docs, I get this error if "target is not a name returned from a previous call to glGenTextures".

I'm not sure I understand that description, the prototype for that function is
void GlBindTexture(GLenum target, GLuint texture);

Did they mean "texture is not a name returned from.."? Because glGenTextures has nothing to do with the target as far as I can tell.

But either way, the input parameters seem right, so I don't really understand what I'm doing wrong here. Anyone have any ideas? What am I missing?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!