PDA

View Full Version : Indexed Vertex Buffers?



Raeldor
07-09-2005, 06:10 PM
Hi,

I am just starting to look at OpenGL to make my DirectX engine cross-platform, and I was wondering if OpenGL has the ability to do indexed vertex buffers like DirectX? The beginners book I have does not mention it, but then I think it is geared towards v1.1.

Thanks!

07-09-2005, 06:38 PM
Yes it does. Look at the VBO spec in the extension registry and the spec.

http://www.opengl.org/documentation/spec.html
http://oss.sgi.com/projects/ogl-sample/registry/

Hlz

07-09-2005, 06:42 PM
... buffer objects start on page 33 of the 2.0 spec.

Hlz

Raeldor
07-09-2005, 06:50 PM
Originally posted by <Hlz>:
... buffer objects start on page 33 of the 2.0 spec.

HlzThanks for your reply. Is 2.0 supported for windows? My book says the 'wiggle' stuff is only v1.1.

07-09-2005, 06:59 PM
Is 2.0 supported for windows?This really depends on the card you have. Some things like FBOs and GLSL are still fairly new and a bit shakey in some areas, but work for the most part.

But all you need to do is check the extension string for support of the things you are interested in for a particular card. The extension registry link above has some details on this, like the glext.h and wglext.h headers you'll need.

Vertex buffer objects have been in the core since 1.5 I think.

Hlz

Raeldor
07-09-2005, 07:11 PM
Originally posted by <Hlz>:

Is 2.0 supported for windows?This really depends on the card you have. Some things like FBOs and GLSL are still fairly new and a bit shakey in some areas, but work for the most part.

But all you need to do is check the extension string for support of the things you are interested in for a particular card. The extension registry link above has some details on this, like the glext.h and wglext.h headers you'll need.

Vertex buffer objects have been in the core since 1.5 I think.

HlzThank you. Looks like it's time to get my hands dirty :p

Jernej
07-10-2005, 01:14 AM
you can use stuff like this:

glInterleavedArrays(GL_T2F_V3F, 0, @pointer to vertices, tex coords, normal and color data);
glDrawElements(GL_quads, 4, GL_UNSIGNED_INT (data format of indexes), @pointer to vertex indexes);

the function is part of opengl 1.1 so it works on practically all implementations.

whole documentation is like this:
from http://pyopengl.sourceforge.net/documentation/manual/glDrawElements.3G.html

glDrawElements specifies multiple geometric primitives with very few subroutine calls. Instead of
calling a GL function to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can
prespecify separate arrays of vertexes, normals, and so on and use them to construct a sequence of primitives with a
single call to glDrawElements.


When glDrawElements is called, it uses count sequential elements from an
enabled array, starting at indices to construct a sequence of geometric primitives.
mode specifies what kind of primitives are constructed, and how the array elements construct
these primitives. If more than one array is enabled, each is used. If GL_VERTEX_ARRAY is not
enabled, no geometric primitives are constructed.


Vertex attributes that are modified by glDrawElements have an unspecified value after
glDrawElements returns. For example, if GL_COLOR_ARRAY is enabled, the value
of the current color is undefined after glDrawElements executes. Attributes that aren't modified
maintain their previous values.