Texture mapping in Opengl ES?

Hi,

I am trying to texture map a quad in opengl es . But it doesn’t seem to texture map at all. Is there something that needs to be done differently than in regular opengl ?

This is the following code I have.


Is there anything I should be doing differently ?

Thanks.
Gautam

glEnable(GL_TEXTURE_2D);

At least I don’t see it in your listing.

  • HM

Hi,

I am sorry, that was done in Init(). I’ll post the complete code here. I just get a white quad. But I do image info into image_data. Also the image is 5=64x64 (24bits). Hence I am wondering what could be causing this. Also I am on linux so I am using opengl es 1.0.


Thanks

OK, the problem is with glTexImage2D this uploads the texture into the currently bound texture. Even though you have generated an ID with glGenTextures you are not binding that ID prior to uploading your texture data. So after the glGenTextures add :

glBindTexture(GL_TEXTURE_2D, texture[0]);

This will make sure the texture data gets uploaded into the correct texture. Most likely your data is being uploaded into the default initial texture, and your specific texture remains empty.

Hope this helps,

K-

That worked. Now I have a decent texture.

Thanks

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.