Jump to content
  • Advertisement
Sign in to follow this  

Using glVertexPointer and glDrawElements

This topic is 3415 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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!