View Full Version : [glVertex3v & glnormal3fv equivalents ?]

06-27-2008, 08:28 AM
Hello everyone !

I am developping a 3D application with OpenGL ES by adapting
some OpenGL code to OpenGL ES.

Since these two functions doesn't exist on ES, i tried to
recode them but in vain... :(

Here's how it goes :

OpenGL code :

for (int i = 0; i < 3; ++i)

Here's my code :

I tried to do like this (assuming the necessited states are active...)

void my_glnormal3fv(float *v)
glNormal3f(v[0], v[1], v[2]);

void my_glvertex3fv(float *v)
glVertexPointer(3, GL_FLOAT, 0, v);
glDrawArrays(GL_TRIANGLE, 0, 3);

I get odd drawing (but almost the same as the original code,
but some vertices are just not good)

Do you have a better solution ?

Thanks in advance.

PS : Sorry for the bad english, i'm french ;)

06-27-2008, 04:38 PM
The glVertex3fv specifies single vertex within the triangle while the glDrawArrays specifies entire triangle. Because of this, the my_glvertex3fv does something entirely different than the original glVertex. Depending on how you store the normals and positions, you might need to construct vertex arrays describing entire triangle similar to one described in here (http://wiki.forum.nokia.com/index.php/Introduction_to_OpenGL_ES)

07-01-2008, 09:40 AM
Ok i can see now how i should proceed.

Thanks a lot !