glDrawVertexArray
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:
Any help would be greatly appreciated.
Code:
glVertexPointer(3, GL_FLOAT, 0, ModelVerts);
glDrawArrays(GL_TRIANGLES, 0, ModelNumVerts);Any help would be greatly appreciated.
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.
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.
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.
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 */
