Menu
Forums
Login | Register

Home > Forums > OpenGL ES > help with vertices Page :  1 
help with vertices
I have an array with 8 vertices that are supposed to draw a cube (actually they do, Im importing it from a ase file), but I have no idea how to draw it from those points, all I can do is draw 2 surfaces.. please help.

code:
GLfloat cubo [] = {
-0.2500, -0.0000, -0.2500,
0.2500, -0.0000, -0.2500,
-0.2500, -0.0000, 0.2500,
0.2500, -0.0000, 0.2500,
-0.2500, -0.5000, -0.2500,
0.2500, -0.5000, -0.2500,
-0.2500, -0.5000, 0.2500,
0.2500, -0.5000, 0.2500,
};

Hi,

When specifying how to render the cube, you will need to use a vertex more than once. You could create an array containing 24 vertices with some duplicated, but the better way would be to create an array of indices.

These indices would refer back to a particular vertex. Your array of indices would be of size 24 and the elements in the array would range from between 0 and 8 (the different vertices).

You can then use the glDrawElements function. Please let me know if you continue to have problems.

Regards,
Grant
Hi,

Sorry, slight mistake above : the elements in the array would range from between 0 and 7, not 8.

Regards,
Grant
I found that in the ascii file I also have the faces and the vertex they use, Ill try to parse that file and make 2 arrays and the build the poligon.
If this work, the algoritm can be used to import any object from any file converted to ascii.

Home > Forums > OpenGL ES > help with vertices Page :  1 

You need to be logged in to reply to this topic.


All Rights Reserved, © Zeus Communications, Multimedia & Development 2004-2005

Read the Disclaimer

Links