- Sort Posts
- 9 replies
- Last post
Re: Question About obj2opengl
January 27, 2012 - 1:47am #10
Re: Question About obj2opengl
January 3, 2012 - 4:00am #9
Re: Question About obj2opengl
September 16, 2011 - 11:27am #8
Re: Question About obj2opengl
September 15, 2011 - 10:03am #5
so i'll write all my steps:
1) I've puted in jni folder the banana.h example whit obj2opengl script
2) I've Putted this line
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &bananaVerts[0]); glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &bananaNormals[0]); glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &bananaTexCoords[0]); glEnableVertexAttribArray(vertexHandle); glEnableVertexAttribArray(normalHandle); glEnableVertexAttribArray(textureCoordHandle); glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID); glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] ); glDrawArrays(GL_TRIANGLES, 0, bananaNumVerts);
instead of
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &teapotVertices[0]); glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &teapotNormals[0]); glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &teapotTexCoords[0]); glEnableVertexAttribArray(vertexHandle); glEnableVertexAttribArray(normalHandle); glEnableVertexAttribArray(textureCoordHandle); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, thisTexture->mTextureID); glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] ); glDrawElements(GL_TRIANGLES, NUM_TEAPOT_OBJECT_INDEX, GL_UNSIGNED_SHORT, (const GLvoid*) &teapotIndices[0]);
3) I've compiled with ndk-build and clean my eclipse project...
4) I've modifiede in ImageTargets.java in loadTexture with this line:
mTextures.add(Texture.loadTextureFromApk("banana.jpg", getAssets())); mTextures.add(Texture.loadTextureFromApk("TextureTeapotBrass.png", getAssets())); mTextures.add(Texture.loadTextureFromApk("TextureTeapotBlue.png
4) I've putted banana.jpg in assets folder...
but when I launch application in my smartphone I see nothing neither with chips nor with stone marker...why?
Re: Question About obj2opengl
September 15, 2011 - 8:46am #3
We don't provide support for the use of 3rd party scripts, you may want to post the question on the developer's website. It's possible that your model is too large or complex for that script to handle.
Also, make sure you have triangulated your model before trying to use it.
- Kim
You may have to tweak the script slightly.
I think it was something I had to do before the script worked for me.
It may also be worth contacting the script developer?