Log in or register to post comments

3d model texture mapping Question

September 12, 2012 - 11:57am #1

Sorry, I am Taiwan student. My english is not good.

Now, I use my 3d model replace teapot.

First, I use min3d read 3d model's Normal, TexCoord, Vertex , Color , face array, then transfer to qcar sdk.

After Render, the 3d model's shape is ok. But Texture mapping is not correct.

this picture is 3d model in Blender: https://dl.dropbox.com/u/49277723/test.png

this picture is 3d model's texture : https://dl.dropbox.com/u/49277723/test.jpg

this picture is result : https://dl.dropbox.com/u/49277723/DSC06244.JPG

ImageTargets.cpp code:

jfloat *v = (env)->GetFloatArrayElements(va, 0);
jfloat *t = (env)->GetFloatArrayElements(ta, 0);
jfloat *n= (env)->GetFloatArrayElements(na, 0);
jbyte *c = (env)->GetByteArrayElements(ca, 0);
jshort *f = (env)->GetShortArrayElements(fa, 0);

#ifdef USE_OPENGL_ES_1_1
// Load projection matrix:

//Load model view matrix:
// Draw object:
glNormalPointer(GL_FLOAT, 0, (const GLvoid*)n);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, (const GLvoid*)c);
glTexCoordPointer(2, GL_FLOAT, 0, (const GLvoid*)t);
glBindTexture(GL_TEXTURE_2D, textureIdTemp);
glTranslatef(0.f, 0.f, kObjectScale);
glRotatef(rotation, 0, 0, 1);
glRotatef(rotation, 1, 0, 0);
glScalef(1, 1, 1);
glVertexPointer(3, GL_FLOAT, 0, (const GLvoid*) v);

glDrawElements(typea, sa, GL_UNSIGNED_SHORT,
(const GLvoid*)f);


Thanks for your help.


3d model texture mapping Question

September 13, 2012 - 2:09pm #5

Thanks, I resove it. I forgot to flipping vertical texture.

3d model texture mapping Question

September 12, 2012 - 9:02pm #4

I open min3d project to run min3d's render, 3d model's texture mapping is correct.

Same TexCoord, texture and mapping syntax, texture mapping  in ImageTarget.cpp is not correct.

I dont know why. 

Thank you for your help.

castle correct image : https://dl.dropbox.com/u/49277723/castle_correct.png

castle min3d : https://dl.dropbox.com/u/49277723/castle_min3d.JPG

castle qcar uv mapping error :  https://dl.dropbox.com/u/49277723/castle_qcar.JPG

min3d uv mapping code:

    _gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, o.vertices().uvs()
    // activate texture
     int glId = _textureManager.getGlTextureId(textureVo.textureId);
     _gl.glBindTexture(GL10.GL_TEXTURE_2D, glId);

3d model texture mapping Question

September 12, 2012 - 1:39pm #3


I use obj2opengl produce .h file, then render 3d model. 3d model's texture is not correct, too.

when i export .obj from Blender, which check box want to choose?

Thank you for your help.


  glTranslatef(0.f, 0.f, kObjectScale);
  glRotatef(rotation, 0, 0, 1);
  glRotatef(rotation, 1, 0, 0);

        // Draw object:
   glBindTexture(GL_TEXTURE_2D, textureIdTemp);
        glTexCoordPointer(2, GL_FLOAT, 0, (const GLvoid*) &testTexCoords[0]);
        glVertexPointer(3, GL_FLOAT, 0, (const GLvoid*) &testVerts[0]);
        glNormalPointer(GL_FLOAT, 0,  (const GLvoid*) &testNormals[0]);
  glDrawArrays(GL_TRIANGLES, 0, testNumVerts);

3d model texture mapping Question

September 12, 2012 - 12:11pm #2

I am not very familiar w/ min3d, have you tried to accomplish the same using this script ( http://heikobehrens.net/2009/08/27/obj2opengl/ ) and the process described here - https://ar.qualcomm.at/content/replace-3d-model-different-3d-model

* this approach requires that you start with an OBJ file.

Log in or register to post comments