two short questions

  1. I recently rewrote my code to use vertex arrays and vertex buffer objects for my models data instead of using immediate mode. it works fine so far. but, now i realized that if i use glDrawArrayElements instead of glDrawElements and specify values for start end end, still everything is rendered:
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER, Indices->Id );
glDrawArrayElements( GL_TRIANGLES, 8, 24, Indices->Size, GL_UNSIGNED_INT, 0 );

shouldn’t this actually only render indices 8 to 24? or are these values ignored as the data is stored in vbo’s?

  1. i’d need a replacement for gluScaleImage(), it’s the only function that still makes me link to the glu lib. i searched google but didn’t find anything useful.

thanks in advance :slight_smile:

You mean glDrawRangeElements? Then the additional parameters specify the min and max value for the indices that you draw. This is used to tell the driver how much of the vertex array needs to be copied to the GPU for this draw call. It’s not a way to specify a subset of the index array.

Originally posted by Vexator

  1. i’d need a replacement for gluScaleImage(), it’s the only function that still makes me link to the glu lib. i searched google but didn’t find anything useful.

gluScaleImage(…) uses a box filter, if the image is being scaled down, and lerps the values if the image is scaled up. It won’t be too hard to do such a thing yourself. You might even find a simple implementation online somewhere.

You mean glDrawRangeElements? Then the additional parameters specify the min and max value for the indices that you draw. This is used to tell the driver how much of the vertex array needs to be copied to the GPU for this draw call. It’s not a way to specify a subset of the index array.
argh yes just a typo. so i got it wrong. but what’s the difference between specifying the min and max value for the indices that i draw and specifying a subset of the index array?

@zm: thx i’ll search for these topics :slight_smile:

its not the indices but the vertices

to allow better optimisation when rendering you can tell the driver how many vertices you will use

let say your indices are 2 triangles

5 6 7
6 7 8

now when the driver knows your minimum vertex is 5 (start) and maximum is 8 (end), it nows which chunk of memory to pull

it really just to help the driver, some sort of manual preprocessing. knowing your limits of vertices you will refer to

ah now i see, thx :slight_smile:

Also note that a conformant implementation can (but need not to) implement glDrawRangeElements() as just glDrawElements() (with additional parameter checking, of course). glDrawRangeElements() doesn’t provide any new functionality. It’s an optimization.