Jump to content
  • Advertisement
Sign in to follow this  

Using glVertexPointer and glDrawElements

This topic is 3495 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I wondering if you need to do something special with the vertex data and index data loaded from the OBJ file, to make it appear on screen? I have done a test in the code to specify the data directly in the code instead of loading it from an OBJ file. This to see if it looks ok. for instance: This is just an example so you get the idea of my problem float vertices2[] = {0.004520f, 0.000000f, -0.363459f, 0.179520f, 0.000000f, -0.315091f, 0.004520f, 0.000000f, -0.002436f, 0.004520f, 1.390251f, -0.363459f, 0.003921f, 1.528259f, 0.001508f, 0.179520f, 1.390251f, -0.315091f }; short indices[] = {1, 2, 3, 4, 5, 6}; Later in the "Draw" method I try to draw the object on the screen. Using glVertexPointer and glDrawElements. gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertices2); gl.glDrawElements(GL10.GL_TRIANGLES, 6, GL10.GL_UNSIGNED_SHORT, indices); The problem is that I can see something on the screen but it is absolutely not what should be there. If I hard code the data of a Penguin, it's not a penguin I see on the screen. What am I doing wrong here? Do I need to do something with the loaded data from the OBJ file before sending it to the vertex array etc? Thanks

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!