28 return GL_TRIANGLE_STRIP;
34 return GL_TRIANGLE_FAN;
52 #ifndef NO_VBO_SUPPORT
53 static void BindBuf(
unsigned int vbo_data )
55 (*glBindBufferARB_p)(GL_ARRAY_BUFFER_ARB, vbo_data);
57 static void BindInd(
unsigned int element_data )
59 (*glBindBufferARB_p)(GL_ELEMENT_ARRAY_BUFFER_ARB, element_data);
68 if ((gl_error = glGetError()))
74 #ifndef NO_VBO_SUPPORT
80 (*glGenBuffersARB_p)(1, (GLuint*) &
vbo_data);
87 (*glBufferDataARB_p)(GL_ARRAY_BUFFER_ARB,
numVertices
98 ?
sizeof (
unsigned short)
99 :
sizeof (
unsigned int) );
100 (*glBufferDataARB_p)(GL_ELEMENT_ARRAY_BUFFER_ARB, tot*indexsize, &
index.
b[0],
117 for (a = 0; a <
offsets[i]; a++) {
120 glColor4fv( &vtx.
r );
121 glNormal3fv( &vtx.
i );
122 glVertex3fv( &vtx.
x );
125 for (a = 0; a <
offsets[i]; a++) {
128 glColor4fv( &vtx.
r );
129 glNormal3fv( &vtx.
i );
130 glVertex3fv( &vtx.
x );
140 for (a = 0; a <
offsets[i]; a++) {
142 glNormal3fv( &vtx.
i );
144 glVertex3fv( &vtx.
x );
147 for (a = 0; a <
offsets[i]; a++) {
149 glNormal3fv( &vtx.
i );
151 glVertex3fv( &vtx.
x );
169 #ifndef NO_VBO_SUPPORT
184 glInterleavedArrays( GL_T2F_C4F_N3F_V3F,
sizeof (
GFXColorVertex), 0 );
189 glEnableClientState( GL_TEXTURE_COORD_ARRAY );
193 glEnableClientState( GL_TEXTURE_COORD_ARRAY );
199 glInterleavedArrays( GL_T2F_N3F_V3F,
sizeof (
GFXVertex), 0 );
202 glTexCoordPointer( 2, GL_FLOAT,
sizeof (
GFXVertex),
204 glEnableClientState( GL_TEXTURE_COORD_ARRAY );
206 glTexCoordPointer( 4, GL_FLOAT,
sizeof (
GFXVertex),
208 glEnableClientState( GL_TEXTURE_COORD_ARRAY );
222 glEnableClientState( GL_TEXTURE_COORD_ARRAY );
225 glEnableClientState( GL_TEXTURE_COORD_ARRAY );
235 glEnableClientState( GL_TEXTURE_COORD_ARRAY );
238 glEnableClientState( GL_TEXTURE_COORD_ARRAY );
242 #ifndef NO_COMPILEDVERTEXARRAY_SUPPORT
248 extern void GFXColor4f(
const float r,
const float g,
const float b,
const float a );
253 #ifndef NO_COMPILEDVERTEXARRAY_SUPPORT
255 (*glUnlockArraysEXT_p)();
268 Draw( &poly, index, 1, &numV );
276 Draw( &poly, tmp, 1, &numV );
285 Draw( &poly, tmp, 1, &numV );
294 Draw( &poly, tmp, 1, &numV );
319 bool blendchange =
false;
360 use_vbo = use_vbo && memcmp( &index, &this->index,
sizeof (
INDEX) ) == 0;
362 #ifndef NO_VBO_SUPPORT
368 #ifndef NO_VBO_SUPPORT
374 static std::vector< bool > drawn;
375 static std::vector< const GLvoid* >glindices;
376 static std::vector< GLsizei >glcounts;
379 drawn.resize( numlists,
false );
380 for (
int i = 0;
i <
numlists; totoffset += offsets[
i++])
385 for (
int j = i, offs = totoffset;
j <
numlists; offs += offsets[
j++]) {
386 totcount += offsets[
j];
387 if ( !drawn[
j] && (mode[
j] == mode[i]) ) {
388 glindices.push_back( use_vbo ? (GLvoid*) (stride*offs)
389 : (GLvoid*) &index.
b[stride*offs] );
390 glcounts.push_back( offsets[
j] );
394 if (glindices.size() == 1)
395 glDrawElements(
PolyLookup( mode[i] ), glcounts[0], indextype, glindices[0] );
399 mode[i] ), &glcounts[0], indextype, &glindices[0], glindices.size() );
405 glDrawElements(
PolyLookup( mode[
i] ), offsets[i], indextype,
406 use_vbo ? (
void*) (stride*totoffset)
407 : &index.
b[stride*totoffset] );
408 totoffset += offsets[i];
415 static std::vector< bool > drawn;
416 static std::vector< GLint > gloffsets;
417 static std::vector< GLsizei >glcounts;
420 drawn.resize( numlists,
false );
421 for (
int i = 0;
i <
numlists; totoffset += offsets[
i++])
426 for (
int j = i, offs = totoffset;
j <
numlists; offs += offsets[
j++]) {
427 totcount += offsets[
j];
428 if ( !drawn[
j] && (mode[
j] == mode[i]) ) {
429 gloffsets.push_back( offs );
430 glcounts.push_back( offsets[
j] );
434 bool blendchange =
false;
456 if (gloffsets.size() == 1)
457 glDrawArrays(
PolyLookup( mode[i] ), gloffsets[0], glcounts[0] );
470 bool blendchange =
false;
492 glDrawArrays(
PolyLookup( mode[i] ), totoffset, offsets[i] );
493 totoffset += offsets[i];
508 #ifndef NO_VBO_SUPPORT
510 (*glDeleteBuffersARB_p)(1, (GLuint*) &
vbo_data);
531 #ifndef NO_VBO_SUPPORT
538 read ? (write ? GL_READ_WRITE_ARB : GL_READ_ONLY_ARB)
539 : GL_WRITE_ONLY_ARB);
543 (*glMapBufferARB_p)(GL_ARRAY_BUFFER_ARB,
544 read ? (write ? GL_READ_WRITE_ARB : GL_READ_ONLY_ARB) : GL_WRITE_ONLY_ARB);
558 #ifndef NO_VBO_SUPPORT
563 (*glUnmapBufferARB_p)(GL_ELEMENT_ARRAY_BUFFER_ARB);
566 (*glUnmapBufferARB_p)(GL_ARRAY_BUFFER_ARB);
577 return this->
Map(
false,
true );
632 pv->i = pv->i * factor;
633 pv->j = pv->j * factor;
634 pv->k = pv->k * factor;
647 int direction[ROWS/2];
649 int last_row_set[
ROWS];
656 if(row[
j] < numVertices/ROWS*(
j+1))
659 for(
int j=0;
j < ROWS/2;
j++)
663 if(direction[
j/2] > 2) {
667 last_row_set[
j] = -1;
675 if(direction[(
j-1)/2] > 2) {
679 last_row_set[
j] = -1;
685 if(row[
j] < numVertices/ROWS*(
j+1))
688 for(
int j=0; j <
ROWS; j++)