Commit 3e31cacf authored by slevy's avatar slevy
Browse files

Discard excess glBegin()/glEnd()'s from drawspecks()'s oldopengl path.

Add env var PARTIOLDOPENGL to force using non-glDrawElements path.
parent 846ff993
......@@ -16,6 +16,10 @@ static char copyright[] = "Copyright (c) 2002 NCSA, University of Illinois Urban
/*
* $Log$
* Revision 1.114 2005/10/18 21:22:53 slevy
* Discard excess glBegin()/glEnd()'s from drawspecks()'s oldopengl path.
* Add env var PARTIOLDOPENGL to force using non-glDrawElements path.
*
* Revision 1.113 2005/06/13 18:12:07 slevy
* Fix long-standing bug where polygons would get the wrong orientation
* if some were fixed-oriented and others screen-facing.
......@@ -1876,7 +1880,8 @@ static void init_opengl(void)
{
if(oldopengl < 0) {
const GLubyte *s = glGetString( GL_VERSION );
oldopengl = (s==NULL || 0==strncmp( (const char *)s, "1.0", 3 ));
oldopengl = (s==NULL || 0==strncmp( (const char *)s, "1.0", 3 )
|| 0!=getenv("PARTIOLDOPENGL"));
}
}
......@@ -2584,8 +2589,6 @@ void drawspecks( struct stuff *st )
for(i = 0; i < MAXPTSIZE*2; i++)
nsized[i] = 0;
if(oldopengl)
glBegin( GL_POINTS );
for(sl = slhead; sl != NULL; sl = sl->next) {
if(sl->text != NULL || sl->special != SPECKS) continue;
for(i = 0, p = sl->specks; i < sl->nspecks; i+=skip, p= NextSpeck(p, sl, skip)) {
......@@ -2653,9 +2656,7 @@ void drawspecks( struct stuff *st )
if(oldopengl) {
if(pxsize != oldpxsize) {
if(nsized[pxsize] >= PERBUCKET) {
glEnd();
glPointSize(pxsize);
glBegin( GL_POINTS );
dumpcpoints( &sized[pxsize][0], PERBUCKET );
nsized[pxsize] = 0;
oldpxsize = pxsize;
......@@ -2696,14 +2697,10 @@ void drawspecks( struct stuff *st )
}
}
if(oldopengl) {
glEnd();
for(i = 0; i < MAXPTSIZE; i++) {
if(nsized[i] > 0) {
glPointSize( i );
glBegin( GL_POINTS );
dumpcpoints( &sized[i][0], nsized[i] );
glEnd();
}
}
} else {
......@@ -2793,8 +2790,6 @@ void drawspecks( struct stuff *st )
for(i = 0; i < MAXPTSIZE*2; i++)
nsized[i] = 0;
if(oldopengl)
glBegin( GL_POINTS );
for(sl = slhead; sl != NULL; sl = sl->next) {
if(sl->text != NULL || sl->special != SPECKS) continue;
for(i = 0, p = sl->specks; i < sl->nspecks; i+=skip, p=NextSpeck(p,sl,skip)) {
......@@ -2911,13 +2906,11 @@ void drawspecks( struct stuff *st )
if(oldopengl) {
if(pxsize != oldpxsize) {
if(nsized[pxsize] >= PERBUCKET) {
glEnd();
if(needMesaHack>0 && (pxsize <= 4) != (oldpxsize <= 4)) {
if(pxsize <= 4) glDisable( GL_POINT_SMOOTH );
else glEnable( GL_POINT_SMOOTH );
}
glPointSize(0.5f*pxsize);
glBegin( GL_POINTS );
dumpcpoints( &sized[pxsize][0], PERBUCKET );
nsized[pxsize] = 0;
oldpxsize = pxsize;
......@@ -2958,8 +2951,6 @@ void drawspecks( struct stuff *st )
}
}
if(oldopengl)
glEnd();
if(needMesaHack>0)
glDisable( GL_POINT_SMOOTH );
......@@ -2970,9 +2961,7 @@ void drawspecks( struct stuff *st )
if(nsized[i] > 0) {
glPointSize( 0.5f*i );
if(oldopengl) {
glBegin( GL_POINTS );
dumpcpoints( &sized[i][0], nsized[i] );
glEnd();
} else {
dumpcpointsarray( &sized[i][0], nsized[i] );
}
......@@ -3090,8 +3079,6 @@ void drawspecks( struct stuff *st )
specks_draw_ellipsoid(st, e);
}
for(i = 0; i < 6; i++) /* in case clipbox was enabled when we began */
glDisable( GL_CLIP_PLANE0 + i );
......@@ -3100,6 +3087,10 @@ void drawspecks( struct stuff *st )
glDisable( GL_BLEND );
glEnable( GL_DEPTH_TEST ); /* was already enabled */
glDepthMask( GL_TRUE );
#ifdef DEBUG
{ int e = glGetError(); if(e) fprintf(stderr, "<post-drawspecks: glE%x> ", e); }
#endif /*DEBUG*/
}
void specks_draw_ellipsoid( struct stuff *st, struct ellipsoid *e )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment