Log in or register to post comments

3D cube error

April 4, 2012 - 6:55am #1

Hi,
i want to show a 3D cube with ImageTarget Project but the output is only half of cube like the velow image. I use this script http://heikobehrens.net/2009/08/27/obj2opengl/ to convert .obj file to .h file with result:

vertices       : 8
faces          : 6
normals        : 6
texture coords : 6

I don't know why. Thanks in advance for any help.

3D cube error

June 29, 2012 - 11:55am #7

Hello David,

shure I will post my Code. I uploaded a file for you into my dropbox.
You can access the file with this link: https://dl.dropbox.com/u/1503795/3D-Cube-Data.txt

I hope this is OK. As a note: I just used the "ImageTargets"-Sample.

Thank you for your help :)

3D cube error

June 29, 2012 - 11:28am #6

Can you post the header file for your cube and the entire set of render operations from renderFrame that you're using? I'll check your code.

3D cube error

June 29, 2012 - 10:34am #5

Hi, can you tell us your solution?
currently i try to add a cube and only one of the top triagles are beeing displayed.
How can I display the complete cube?

The following lines shows my current setup of the "renderFrameQCAR"-Method. I changed this

glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)obj3D.vertices);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)obj3D.normals);
glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid*)obj3D.texCoords);
glDrawElements(GL_TRIANGLES, obj3D.numIndices, GL_UNSIGNED_SHORT, (const GLvoid*)obj3D.indices);

to this:
glVertexPointer(3, GL_FLOAT, 0, cubeVerts);
glNormalPointer(GL_FLOAT, 0, cubeNormals);
glDrawArrays(GL_TRIANGLES, 0, cubeNumVerts);

 

It would be great if someone could help me :)
Thank u 

 

Re: 3D cube error

April 5, 2012 - 7:02am #4

I have found the solution :)

Re: 3D cube error

April 5, 2012 - 6:25am #3

Thank you for your help. This run nice with triangle cube but i how can i change the distance from the trackable image and 3D-Model?

I know x-axis is to the right and y-axis is to the top of the target and i try to move 3D-Model in Blender, but there's no effect.

Re: 3D cube error

April 4, 2012 - 3:48pm #2

Try triangulating your cube, OpenGL ES doesn't work with quads. A triangulated cube should have 12 faces, not 6.

- Kim

Log in or register to post comments