Hanuman
Hanuman

Reputation: 642

Loading model with texture in GLGravity Iphone project

I have downloaded the GLGravity project from apple site. I tried loading a new model to display instead of teapot. the model is loading but without using the defined textures.

I am trying to display the model using the following code but unable to display the texture.

// in setupView method

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glVertexPointer(3, GL_FLOAT, 0, camaro_objVerts);
glNormalPointer(GL_FLOAT, 0, camaro_objNormals);
glTexCoordPointer(2, GL_FLOAT, 0, camaro_objTexCoords);

in drawView method

// draw data
glDrawArrays(GL_TRIANGLES, 0, camaro_objNumVerts);

I have also tried disabling lightning, but the model loads with white color and without texture.

Upvotes: 0

Views: 369

Answers (1)

JustSid
JustSid

Reputation: 25318

Have you enabled GL_TEXTURE_2D? It should look like this (+ texture binding):

glBindTexture(GL_TEXTURE_2D, textureHandle);
glEnable(GL_TEXTURE_2D); 

Upvotes: 1

Related Questions