PDA

View Full Version : Texture mapping in Opengl ES ?



gautam
10-21-2004, 07:58 PM
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

hmwill
10-21-2004, 08:43 PM
glEnable(GL_TEXTURE_2D);

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

- HM

gautam
10-21-2004, 10:28 PM
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

KristofBeets
10-22-2004, 12:43 PM
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-

gautam
10-23-2004, 01:24 AM
That worked. Now I have a decent texture.

Thanks