Sign in to follow this  
Enu

How to use glDrawRangeElements()

Recommended Posts

Enu    122
Hi all, :D I'm using VBOs, in glDrawRangeElemetns(mode,start,end,count,type,indices) 2nd param refers to GL_ARRAY_BUFFER, or to GL_ELEMENT_ARRAY_BUFFER? In glDrawArray(mode,firts,count), first param refers to GL_ARRAY_BUFFER, and it's useful because i don't have to use gl*Pointer() during rendering function. Most of all, 3rd param in glDREs() is always start+count, right? .. i don't understand <_> :)

Share this post


Link to post
Share on other sites
songho    268
Quote:
Original post by Enu
Hi all, :D
I'm using VBOs, in glDrawRangeElemetns(mode,start,end,count,type,indices)
2nd param refers to GL_ARRAY_BUFFER, or to GL_ELEMENT_ARRAY_BUFFER?
Yes, the 2nd and 3rd param refer to the indice of the vertex array, not index array. These "start" and "end" index are used to specify a range of data to be prefetched, so OpenGL may be able to obtain only limited amount of vertex array data prior to rendering, and may increase performance.

The range of the data can be simply calculated by (end - start "plus" 1). But it is not related with the 4th param (count). The 4th param is the number of indice in index array to read, starting from where the index pointer(6th param) is currently located.

Quote:
Original post by Enu
In glDrawArray(mode,firts,count), first param refers to GL_ARRAY_BUFFER, and it's useful because i don't have to use gl*Pointer() during rendering function.
I think this is not correct. I believe you still need gl*Pointer() to tell where the array is.

Share this post


Link to post
Share on other sites
Enu    122
Quote:
Original post by songho
Quote:
Original post by Enu
In glDrawArray(mode,firts,count), first param refers to GL_ARRAY_BUFFER, and it's useful because i don't have to use gl*Pointer() during rendering function.
I think this is not correct. I believe you still need gl*Pointer() to tell where the array is.


First of all thx a lot :D
About glDrawArray(), yes, i need gl*Pointer(), but i can call it only once so i reduce function-calls.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this