glDrawVertexArray

Nibbie
Posts: 2
Joined: 2009.09
Post: #1
Hello, I am trying to draw a model that had been converted into .h format using obj2opengl, and it is drawing, just not the way I want it to. It is only drawing in wireframe, I have searched everywhere for a solution to draw in solid mode, but to no avail. I believe it is a simple solution(such as a call to glEnable() ) but I am not sure, I would use "glPolygonMode" But OpenGL:ES for iphone does not have this. My drawing code is somewhat like this:

Code:
glVertexPointer(3, GL_FLOAT, 0, ModelVerts);

glDrawArrays(GL_TRIANGLES, 0, ModelNumVerts);

Any help would be greatly appreciated.
Quote this message in a reply
Member
Posts: 86
Joined: 2008.04
Post: #2
Do you see anything when rendering?
Make sure you are using the correct polygon winding to match your model.
Also, when troubleshooting you should disable backface culling.
Finally, enable global ambient so you can see stuff in case your lighting isn't reaching the model.
Quote this message in a reply
Nibbie
Posts: 2
Joined: 2009.09
Post: #3
It is rendering but only In wireframe. I can see it and transform it easily but it stays in wireframe. And ambient light doesn't help.
Quote this message in a reply
Apprentice
Posts: 11
Joined: 2007.02
Post: #4
AFAIK you should send the number of elements to glDrawArrays, not the number of vertices. In your case something like:

Code:
glDrawArrays(GL_TRIANGLES, 0, ModelNumVerts / 3); /* verts / 3 = triangles */
Quote this message in a reply
Post Reply