Jump to content
  • Advertisement
Sign in to follow this  

OpenGL opengl vertex buffer and index

This topic is 3049 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

Hy. I' have some experience in directx 10 , now i must create an opengl application , in directx 10 i use vertex buffers and index buffers for drawing objects , there is a corrispondence in opengl? What do you advice to me for learning opengl from directx? thanks.

Share this post

Link to post
Share on other sites
Vertex Buffer Objects

VBOs can store indicies/verticies, or whatever you want. If you want to draw these things, you just bind your buffer and use any of the drawing commands. For example, to draw using indicies, you could use glDrawElements.

As for advice, I haven't used DirectX in ages, so I personally have none. Maybe someone else has some for you!

Share this post

Link to post
Share on other sites

GLint matrixMode;
glGetIntegerv(GL_MATRIX_MODE, &matrixMode);

glTranslatef(this->getPosX(), this->getPosY(), m_zorder);


glVertexPointer(3, GL_FLOAT, 0, &m_vertices[0]);
glTexCoordPointer(2, GL_FLOAT, 0, &m_texCoords[0]);
glColorPointer(4, GL_FLOAT, 0, &m_simple_color[0]);
glDrawArrays(GL_QUADS, 0, 4);



Here, that is how I draw a Quad. That are no VBO, like aryx, said, but Arrays. But I think they are stored the same way by my Videocard, because in MY application, I do not see any difference in performance. Anyway how is this done?
You can either put all Vertices, TextureCoords and Color in one struct and use the stride to tell OpenGL how they are arranged. I use 3 different Arrays for one Object. Color, TextureCoordinate and Vertices. Simple Structs. Then I fill them with data and pass them to OpenGL.
Hope you understand my explanation.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!