Skip to main content
GameDev.net gamedev.net
🔒 Locked

having problem

Started by adeelali Apr 13, 2006 at 8:33 PM 0 replies 350+ views
Original Post
adeelali
adeelali
I am having problem using this code + if use GL_RGB in creating texture this piece of code works fine however with GL_LUMINANCE it is gives a run time error "invalid enumerant at the END " Can someone figure out what is wrong with the code glBindTexture(GL_TEXTURE_2D, _iTexture[0]); // (set texture parameters here) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); //create the texture glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, _iWidth, _iHeight, 0, GL_RGB, GL_LUMINANCE, 0); glGenFramebuffersEXT(1, &_mybuffer); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,_mybuffer); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, _iTexture[0], 0);
Falken42
Falken42
You're not calling glTexImage2D with the correct parameters. You cannot mix GL_RGB with GL_LUMINANCE.

I don't know what format your texture is in, but if you need an 8-bit luminance texture, you should use:
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8, _iWidth, _iHeight, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, 0);

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.