View Full Version : Passing an indexed triangle strip array to opengl?

04-27-2003, 11:33 AM
When you pass data to opengl to draw an indexed triangle strip array (vertex array elements etc http://www.opengl.org/discussion_boards/ubb/wink.gif What data is actualy passed? Is the ENTIRE array of points passed or simply only the ones referenced by the indicies? I wonder because I will be building a series of triangle strips from a very large list of points, and I will be breaking that list up into a series of indecies to be rendered by a triangle strip,but i dont want to waist bus bandwidth by sending points that arent needed. So i guess what im asking, is just because i set a referernce to an array of points, Opengl only reads those referenced by the indecies sent to it, correct?

04-27-2003, 12:15 PM
This is implementation specific. In short, you can't be sure.

04-27-2003, 11:05 PM
Isn't this what glDrawRangeElements is for?

The driver is not going to examine every index in your array to find the min and max vertex referenced if you use this extension (without it, I think it has to do this in order to transfer the vertex/index data in manageable chunks). This extension leaves it up to the app to define the range, so the driver can minimise the number of vertices to transfer.

[This message has been edited by knackered (edited 04-28-2003).]

04-28-2003, 02:42 AM
Ok so what your telling me is it could go either way? Some cards may only read the data pointed to by the index, while other cards may read the ENTIRE array into memory then pluck the indexed points out? How much of a speed hit would it be to do it the second way, seems kind of a waiste to me. And if they do read the entire array into video memory, are ALL those points put through transformation and lighting? Or only the ones indexed, or is this TOO specific to the card? If so, that realy realy realy seems kind of stupid on there part.

04-28-2003, 03:07 AM
The vertex array pointer calls do not contain information about the number of vertices in a vertex array. The DrawArrays or DrawElements calls are the ones which specify which data has to be addressed by the OpenGL transfom unit. In the indexed case it will only transform the indices you specified. Everything else would be silly.

How the data is sent to the hardware after that (indices only or vertex array data addressed by the indices) is of course implementation dependent and may also differ among standard OpenGL core functions and the various extensions like vertex array range, vertex array objects, vertex buffer objects, etc.

Indexed primitives are your friend because they allow implementations to reuse data when adjacent triangles share indices.

04-28-2003, 03:16 AM
I'm not sure about how individual vendors do things, but try to guess how, say, nvidia do things by the thinking about the following fact:
When using the nvidia extension vertex_array_range (otherwise known as VAR), all vertex attributes (positions,normals,colours,texcoords) have to be in VAR memory (AGP or video, depending on priority), but all indices (your index array) need to be in system memory. Why do you think this is? Can you reverse engineer what the driver is doing for it to require things to be layed out this way?