Hi,
i have tried implementing my own model i got off the internet to test. i have uploaded below. my model doesnt appear to have the texture applied.
Code i have changed is
#import "iphone_1.h"
glTexCoordPointer(2, GL_FLOAT, 0, (const GLvoid*)&iphone_1TexCoords[0]); glVertexPointer(3, GL_FLOAT, 0, (const GLvoid*) &iphone_1Verts[0]); glNormalPointer(GL_FLOAT, 0, (const GLvoid*)&iphone_1Normals[0]); glDrawArrays(GL_TRIANGLES, 0, iphone_1NumVerts);
glUseProgram(shaderProgramID); //IPhone glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,(const GLvoid*) &iphone_1Verts[0]); glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,(const GLvoid*) &iphone_1Normals[0]); glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,(const GLvoid*) &iphone_1TexCoords[0]); glEnableVertexAttribArray(vertexHandle); glEnableVertexAttribArray(normalHandle); glEnableVertexAttribArray(textureCoordHandle); glBindTexture(GL_TEXTURE_2D, [thisTexture textureID]); glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE,(GLfloat*)&modelViewProjection.data[0] ); glDrawArrays(GL_TRIANGLES, 0, iphone_1NumVerts); //
[URL=http://www.bronron.com/apps/iphone (1).jpg]http://www.bronron.com/apps/iphone (1).jpg[/URL]
http://www.bronron.com/apps/iphone_1.h
http://www.bronron.com/apps/iphone_1.obj
It looks like you accidentally got rid of this line (in the original sample code):
Also make sure you are adding your texture to the textureFilenames at the top of EAGLView.mm.
There seems to be a problem with the structure of your model (it's full of holes). Is it properly triangulated? Also, if it's exported with triangle strips you'll need to change the call to glDrawArrays.
- Kim