Horde3D
http://horde3d.org/forums/

Question about glDrawRangeElements() function ?
http://horde3d.org/forums/viewtopic.php?f=1&t=1015
Page 1 of 1

Author:  davylew [ 25.11.2009, 16:55 ]
Post subject:  Question about glDrawRangeElements() function ?

I've been reading the code of Horde3d for a few days.
I've noticed that the glDrawRangeElements() in drawModels(),

glDrawRangeElements( GL_TRIANGLES, meshNode->getVertRStart(), meshNode->getVertREnd(),
meshNode->getBatchCount(),
curGeoRes->_16BitIndices ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT,
(char *)0 + meshNode->getBatchStart() *
(curGeoRes->_16BitIndices ? sizeof( short ) : sizeof( int )) );

How dose "(char *)0 + meshNode->getBatchStart() *(curGeoRes->_16BitIndices ? sizeof( short ) : sizeof( int ))" mean ?

Is this code get a pointer to Triangle Indices?

Thx

Author:  swiftcoder [ 25.11.2009, 17:04 ]
Post subject:  Re: Question about glDrawRangeElements() function ?

It is an offset into the vertex buffer object containing the indices.

If one were to use vertex arrays instead, one would pass a pointer to the start of the indices, but since we use vertex buffer objects, it has to be an offset from the start of the buffer.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/