--- Squeak/VM/trunk/platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c	Mon Feb 28 19:37:24 2005
+++ sqOpenGLRenderer.c	Wed Mar  9 21:31:08 2005
@@ -33,12 +33,21 @@
 #warning "This system does not support OpenGL 1.1"
 #endif
 
+// not really used yet, but this is my hardware and I intend to add GL 1.2 features
+#if !defined(GL_VERSION_1_2)
+#warning "This system does not support OpenGL 1.2"
+#endif
+
+
 static float blackLight[4] = { 0.0, 0.0, 0.0, 0.0 };
 
 /*****************************************************************************/
-/*****************************************************************************/
-/*****************************************************************************/
-/*****************************************************************************/
+
+
+/* Pbuffers are maintained by the next layer down from OpenGL, in the case of X11, 
+   it's the GLX interface. Therefore we need to send these calls down to our 
+   platform code to get our Inf0z.
+ */ 
 
 int glGetRendererSurfaceHandle(int handle) {
   /* If we were to use p-buffers, this would be the place to 
@@ -49,6 +58,15 @@
      time to figure it out so I'll just leave this as an
      exercise for the interested reader :-)
    */
+/*
+	struct glRenderer *renderer = glRendererFromHandle(handle);
+
+	if(!renderer || !glMakeCurrentRenderer(renderer)) {
+		DPRINTF(4, (fp, "ERROR: Invalid renderer specified\n"));
+		return 0;
+	}
+
+*/
   return -1; /* e.g., fail */
 }
 
@@ -57,28 +75,64 @@
      in the color masks for the surface. Since we don't
      provide any, we just bail out.
    */
+/*
+
+	struct glRenderer *renderer = glRendererFromHandle(handle);
+
+	if(!renderer || !glMakeCurrentRenderer(renderer)) {
+		DPRINTF(4, (fp, "ERROR: Invalid renderer specified\n"));
+		return 0;
+	}
+*/
+
   return 0; /* e.g., fail */
 }
 
 int glGetRendererSurfaceWidth(int handle) {
   /* If a surface is provided return the width of it */
+/*
+
+	struct glRenderer *renderer = glRendererFromHandle(handle);
+
+	if(!renderer || !glMakeCurrentRenderer(renderer)) {
+		DPRINTF(4, (fp, "ERROR: Invalid renderer specified\n"));
+		return 0;
+	}
+*/
+
   return -1; /* e.g., fail */
 }
 
 int glGetRendererSurfaceHeight(int handle) {
   /* If a surface is provided return the height of it */
+/*
+	struct glRenderer *renderer = glRendererFromHandle(handle);
+
+	if(!renderer || !glMakeCurrentRenderer(renderer)) {
+		DPRINTF(4, (fp, "ERROR: Invalid renderer specified\n"));
+		return 0;
+	}
+*/
+
   return -1; /* e.g., fail */
 }
 
 int glGetRendererSurfaceDepth(int handle) {
   /* If a surface is provided return the depth of it */
+/*
+
+	struct glRenderer *renderer = glRendererFromHandle(handle);
+
+	if(!renderer || !glMakeCurrentRenderer(renderer)) {
+		DPRINTF(4, (fp, "ERROR: Invalid renderer specified\n"));
+		return 0;
+	}
+*/
   return -1; /* e.g., fail */
 }
 
 /*****************************************************************************/
-/*****************************************************************************/
-/*****************************************************************************/
-/*****************************************************************************/
+
 /* texture support */
 int glAllocateTexture(int handle, int w, int h, int d) /* return handle or -1 on error */
 {   GLuint texture;
@@ -96,24 +150,20 @@
 
 	DPRINTF(5, (fp, "### Allocating new texture (w = %d, h = %d, d = %d)\n", w, h, d));
 
-	errMsg = "glGenTextures() failed";
 	glGenTextures(1, &texture);
-	if((glErr = glGetError()) != GL_NO_ERROR) goto FAILED;
+
 	DPRINTF(5, (fp, "Allocated texture id = %d\n", texture));
-	errMsg = "glBindTexture() failed";
+
 	glBindTexture(GL_TEXTURE_2D, texture);
-	if((glErr = glGetError()) != GL_NO_ERROR) goto FAILED;
-	errMsg = "glTexParameter() failed";
+
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-	if((glErr = glGetError()) != GL_NO_ERROR) goto FAILED;
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-	if((glErr = glGetError()) != GL_NO_ERROR) goto FAILED;
+
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-	if((glErr = glGetError()) != GL_NO_ERROR) goto FAILED;
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-	if((glErr = glGetError()) != GL_NO_ERROR) goto FAILED;
+
 	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-	if((glErr = glGetError()) != GL_NO_ERROR) goto FAILED;
+
 	errMsg = "glTexImage2D() failed";
 	glTexImage2D(GL_TEXTURE_2D, /* target */
 				 0, /* mipmap level */
@@ -203,11 +251,8 @@
 		return 0;
 	}
 
-	if(d != 32) return 0;
+	if((d != 32 ) || (!glIsTexture(handle))) return 0;
 
-	if(!glIsTexture(handle)) {
-		return 0;
-	}
 	DPRINTF(5, (fp, "### Uploading texture (w = %d, h = %d, d = %d, id = %d)\n", w, h, d, handle));
 	glBindTexture(GL_TEXTURE_2D, handle);
 	ERROR_CHECK;
@@ -234,10 +279,9 @@
 		DPRINTF(4, (fp, "ERROR: Invalid renderer specified\n"));
 		return 0;
 	}
-	if(!glIsTexture(handle)) {
-		return 0;
-	}
-	ERROR_CHECK;
+
+	if(!glIsTexture(handle)) return 0;
+
 	DPRINTF(7, (fp, "glCompositeTexture(%d, %d, %d, %d)\n", x, y, w, h));
 	{
 		/* setup a transformation so that we're dealing with pixel x/y coordinate systems */
@@ -317,9 +362,6 @@
 }
 
 /*****************************************************************************/
-/*****************************************************************************/
-/*****************************************************************************/
-/*****************************************************************************/
 
 int glSetViewport(int handle, int x, int y, int w, int h) /* return true on success, false on error */
 {
@@ -327,7 +369,6 @@
 	if(!renderer || !glMakeCurrentRenderer(renderer)) return 0;
 
 	DPRINTF(5, (fp, "### New Viewport\n"));
-	DPRINTF(5, (fp, "\tx: %d\n\ty: %d\n\tw: %d\n\th: %d\n", x, y, w, h));
 	renderer->viewport[0] = x;
 	renderer->viewport[1] = y;
 	renderer->viewport[2] = w;
@@ -335,9 +376,8 @@
 	x -= renderer->bufferRect[0];
 	y -= renderer->bufferRect[1];
 	DPRINTF(5, (fp, "\tx: %d\n\ty: %d\n\tw: %d\n\th: %d\n", x, y, w, h));
-	glViewport(x, renderer->bufferRect[3] - (y+h), w, h);
-	ERROR_CHECK;
 
+	glViewport(x, renderer->bufferRect[3] - (y+h), w, h);
 	return 1;
 }
 
@@ -347,11 +387,10 @@
 	if(!renderer || !glMakeCurrentRenderer(renderer)) return 0;
 	DPRINTF(5, (fp, "### Clearing depth buffer\n"));
 	glClear(GL_DEPTH_BUFFER_BIT);
-	ERROR_CHECK;
 	return 1;
 }
 
-int glClearViewport(int handle, unsigned int rgba, unsigned int pv) /* return true on success, false on error */
+int glClearViewport(int handle, unsigned int bgra, unsigned int pv) /* return true on success, false on error */
 {
 	struct glRenderer *renderer = glRendererFromHandle(handle);
 	if(!renderer || !glMakeCurrentRenderer(renderer)) return 0;
@@ -355,14 +394,16 @@
 {
 	struct glRenderer *renderer = glRendererFromHandle(handle);
 	if(!renderer || !glMakeCurrentRenderer(renderer)) return 0;
+
 	DPRINTF(5, (fp, "### Clearing viewport buffer\n"));
-	glClearColor(
-				((rgba >> 16) & 255) / 255.0, 
-				((rgba >>  8) & 255) / 255.0, 
-				(rgba & 255) / 255.0, 
-				(rgba >> 24) / 255.0);
+
+// this looks much less wrong than it used to but that doesn't mean it's right... =( 
+	glClearColor(  ((bgra >> 16) & 0xff) / 255.0, 
+		       ((bgra >>  8) & 0xff) / 255.0, 
+			(bgra        & 0xff) / 255.0, 
+			(bgra >> 24)         / 255.0);
+
 	glClear(GL_COLOR_BUFFER_BIT);
-	ERROR_CHECK;
 	return 1;
 }
 
@@ -372,7 +413,6 @@
 	if(!renderer || !glMakeCurrentRenderer(renderer)) return 0;
 	DPRINTF(5, (fp, "### Finishing renderer\n"));
 	glFinish();
-	ERROR_CHECK;
 	return 1;
 }
 
@@ -380,9 +420,9 @@
 {
 	struct glRenderer *renderer = glRendererFromHandle(handle);
 	if(!renderer || !glMakeCurrentRenderer(renderer)) return 0;
+
 	DPRINTF(5, (fp, "### Flushing renderer\n"));
 	glFlush();
-	ERROR_CHECK;
 	return 1;
 }
 
@@ -396,11 +437,7 @@
 	return 1;
 }
 
-
 int glSetTransform(int handle, float *modelViewMatrix, float *projectionMatrix) {
-	float matrix[16];
-	int i, j;
-
 	struct glRenderer *renderer = glRendererFromHandle(handle);
 	if(!renderer || !glMakeCurrentRenderer(renderer)) return 0;
 
@@ -405,30 +442,13 @@
 	if(!renderer || !glMakeCurrentRenderer(renderer)) return 0;
 
 	DPRINTF(5, (fp, "### Installing new transformations\n"));
+
 	glMatrixMode(GL_PROJECTION);
-	ERROR_CHECK;
-	glLoadIdentity();
-	ERROR_CHECK;
-	if(projectionMatrix) {
-		/* TODO: Check if matrix is simple and don't use glMultMatrixf if so */
-		for(i=0; i<4; i++)
-			for(j=0; j<4; j++)
-				matrix[i*4+j] = projectionMatrix[j*4+i];
-		glLoadMatrixf(matrix);
-		ERROR_CHECK;
-	}
+	if(projectionMatrix) glLoadTransposeMatrixf(projectionMatrix);
+
 	glMatrixMode(GL_MODELVIEW);
-	ERROR_CHECK;
-	glLoadIdentity();
-	ERROR_CHECK;
-	if(modelViewMatrix) {
-		/* TODO: Check if matrix is simple and don't use glMultMatrixf if so */
-		for(i=0; i<4; i++)
-			for(j=0; j<4; j++)
-				matrix[i*4+j] = modelViewMatrix[j*4+i];
-		glLoadMatrixf(matrix);
-		ERROR_CHECK;
-	}
+	if(modelViewMatrix) glLoadTransposeMatrixf(modelViewMatrix);
+
 	return 1;
 }
 
@@ -444,10 +464,9 @@
 
 	DPRINTF(5, (fp, "### Disabling all lights\n"));
 	glGetIntegerv(GL_MAX_LIGHTS, &max);
-	ERROR_CHECK;
+
 	for(i = 0; i < max; i++) {
 		glDisable(GL_LIGHT0+i);
-		ERROR_CHECK;
 		if( (glErr = glGetError()) != GL_NO_ERROR) 
 			DPRINTF(1, (fp,"ERROR (glDisableLights): glDisable(GL_LIGHT%d) failed -- %s\n", i, glErrString()));
 	}
@@ -467,7 +486,6 @@
 	if(!mat) {
 		DPRINTF(5, (fp, "\tOFF (material == nil)\n"));
 		glDisable(GL_LIGHTING);
-		ERROR_CHECK;
 		return 1;
 	}
 	DPRINTF(5, (fp, "\tambient  : %g, %g, %g, %g\n",mat->ambient[0], mat->ambient[1], mat->ambient[2], mat->ambient[3]));
@@ -475,18 +493,13 @@
 	DPRINTF(5, (fp, "\tspecular : %g, %g, %g, %g\n",mat->specular[0], mat->specular[1], mat->specular[2], mat->specular[3]));
 	DPRINTF(5, (fp, "\temission : %g, %g, %g, %g\n",mat->emission[0], mat->emission[1], mat->emission[2], mat->emission[3]));
 	DPRINTF(5, (fp, "\tshininess: %g\n", mat->shininess));
+
 	glEnable(GL_LIGHTING);
-	ERROR_CHECK;
 	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat->ambient);
-	ERROR_CHECK;
 	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat->diffuse);
-	ERROR_CHECK;
 	glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat->specular);
-	ERROR_CHECK;
 	glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, mat->emission);
-	ERROR_CHECK;
 	glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, mat->shininess);
-	ERROR_CHECK;
 	return 1;
 }
 
@@ -511,6 +524,8 @@
 	}
 	glEnable(index);
 	ERROR_CHECK;
+
+/*
 	DPRINTF(5, (fp, "\tambient       : %g, %g, %g, %g\n",light->ambient[0], light->ambient[1], light->ambient[2], light->ambient[3]));
 	DPRINTF(5, (fp, "\tdiffuse       : %g, %g, %g, %g\n",light->diffuse[0], light->diffuse[1], light->diffuse[2], light->diffuse[3]));
 	DPRINTF(5, (fp, "\tspecular      : %g, %g, %g, %g\n",light->specular[0], light->specular[1], light->specular[2], light->specular[3]));
@@ -525,10 +541,13 @@
 	if(light->flags & B3D_LIGHT_DIRECTIONAL) DPRINTF(5,(fp," B3D_LIGHT_DIRECTIONAL"));
 	if(light->flags & B3D_LIGHT_ATTENUATED) DPRINTF(5,(fp," B3D_LIGHT_ATTENUATED"));
 	if(light->flags & B3D_LIGHT_HAS_SPOT) DPRINTF(5,(fp," B3D_LIGHT_HAS_SPOT"));
+
 	DPRINTF(5, (fp, "\n"));
 	DPRINTF(5, (fp, "\tspot exponent : %g\n", light->spotExponent));
-
 	DPRINTF(5, (fp, "### Installing Light (%d)\n", idx));
+
+*/
+
 	if(light->flags & B3D_LIGHT_AMBIENT) {
 		DPRINTF(5, (fp, "\tambient  : %g, %g, %g, %g\n",light->ambient[0], light->ambient[1], light->ambient[2], light->ambient[3]));
 		glLightfv(index, GL_AMBIENT, light->ambient);
@@ -536,7 +555,6 @@
 		DPRINTF(5, (fp, "\tambient  : OFF (0, 0, 0, 1)\n"));
 		glLightfv(index, GL_AMBIENT, blackLight);
 	}
-	ERROR_CHECK;
 
 	if(light->flags & B3D_LIGHT_DIFFUSE) {
 		DPRINTF(5, (fp, "\tdiffuse  : %g, %g, %g, %g\n",light->diffuse[0], light->diffuse[1], light->diffuse[2], light->diffuse[3]));
@@ -545,7 +563,6 @@
 		DPRINTF(5, (fp, "\tdiffuse  : OFF (0, 0, 0, 1)\n"));
 		glLightfv(index, GL_DIFFUSE, blackLight);
 	}
-	ERROR_CHECK;
 
 	if(light->flags & B3D_LIGHT_SPECULAR) {
 		DPRINTF(5, (fp, "\tspecular : %g, %g, %g, %g\n",light->specular[0], light->specular[1], light->specular[2], light->specular[3]));
@@ -554,7 +571,6 @@
 		DPRINTF(5, (fp, "\tspecular : OFF (0, 0, 0, 1)\n"));
 		glLightfv(index, GL_SPECULAR, blackLight);
 	}
-	ERROR_CHECK;
 
 	if(light->flags & B3D_LIGHT_POSITIONAL) {
 		DPRINTF(5, (fp, "\tposition : %g, %g, %g\n",light->position[0], light->position[1], light->position[2]));
@@ -581,24 +597,17 @@
 			glPopMatrix();
 		}
 	}
-	ERROR_CHECK;
 
 	if(light->flags & B3D_LIGHT_ATTENUATED) {
 		DPRINTF(5, (fp, "\tattenuation: %g, %g, %g\n",light->attenuation[0], light->attenuation[1], light->attenuation[2]));
 		glLightf(index, GL_CONSTANT_ATTENUATION,  light->attenuation[0]);
-		ERROR_CHECK;
 		glLightf(index, GL_LINEAR_ATTENUATION,    light->attenuation[1]);
-		ERROR_CHECK;
 		glLightf(index, GL_QUADRATIC_ATTENUATION, light->attenuation[2]);
-		ERROR_CHECK;
 	} else {
 		DPRINTF(5, (fp, "\tattenuation: OFF (1, 0, 0)\n"));
 		glLightf(index, GL_CONSTANT_ATTENUATION,  1.0);
-		ERROR_CHECK;
 		glLightf(index, GL_LINEAR_ATTENUATION,    0.0);
-		ERROR_CHECK;
 		glLightf(index, GL_QUADRATIC_ATTENUATION, 0.0);
-		ERROR_CHECK;
 	}
 
 	if(light->flags & B3D_LIGHT_HAS_SPOT) {
@@ -606,22 +615,18 @@
 		DPRINTF(5, (fp, "\tspot cutoff   : ???\n"));
 		DPRINTF(5, (fp, "\tspot direction: %g, %g, %g\n",light->direction[0], light->direction[1], light->direction[2]));
 		glLightf(index, GL_SPOT_EXPONENT, light->spotExponent);
-		ERROR_CHECK;
 		glLightf(index, GL_SPOT_CUTOFF, light->spotExponent);
-		ERROR_CHECK;
 		glLightfv(index, GL_SPOT_DIRECTION, light->direction);
-		ERROR_CHECK;
 	} else {
 		glLightf(index, GL_SPOT_EXPONENT, 0.0);
-		ERROR_CHECK;
 		glLightf(index, GL_SPOT_CUTOFF, 180.0);
-		ERROR_CHECK;
 	}
 	return 1;
 }
 
 int glSetFog(int handle, int fogType, double density, 
-             double fogRangeStart, double fogRangeEnd, int rgba) {
+             double fogRangeStart, double fogRangeEnd, int rgba) 
+{
   GLfloat fogColor[4];
   glRenderer *renderer = glRendererFromHandle(handle);
 
@@ -644,9 +649,9 @@
   fogColor[2] = (rgba & 255) / 255.0;
   fogColor[3] = (rgba >> 24) / 255.0;
   glFogfv(GL_FOG_COLOR, fogColor);
-  /* enable pixel fog */
+
+/* enable pixel fog */
   glHint(GL_FOG_HINT, GL_NICEST);
-  ERROR_CHECK;
   return 1;
 }
 
@@ -668,15 +673,12 @@
     return 0;
   case 2: /* polygon mode */
     glGetIntegerv(GL_POLYGON_MODE, &v);
-    ERROR_CHECK;
     return v;
   case 3: /* point size */
     glGetIntegerv(GL_POINT_SIZE, &v);
-    ERROR_CHECK;
     return v;
   case 4: /* line width */
     glGetIntegerv(GL_LINE_WIDTH, &v);
-    ERROR_CHECK;
     return v;
   case 5: /* blend enable */
     return glIsEnabled(GL_BLEND);
@@ -686,7 +688,6 @@
       glGetIntegerv(GL_BLEND_SRC, &v);
     else
       glGetIntegerv(GL_BLEND_DST, &v);
-    ERROR_CHECK;
     switch(v) {
         case GL_ZERO: return 0;
         case GL_ONE: return 1;
@@ -728,7 +729,6 @@
     else if(value == 1) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
     else if(value == 2) glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
     else return 0;
-    ERROR_CHECK;
     return 1;
   case 3: /* point size */
     glPointSize(value);
@@ -743,7 +743,6 @@
       glEnable(GL_BLEND);
     else
       glDisable(GL_BLEND);
-    ERROR_CHECK;
     return 1;
   case 6: /* blend source factor */
   case 7: /* blend dest factor */
@@ -769,15 +768,14 @@
       if(prop == 6) src = factor;
       else dst = factor;
       glBlendFunc(src,dst);
-      ERROR_CHECK;
       return 1;
     }
   }
   return 0;
 }
 
-#ifndef GL_VERSION_1_1
 
+#ifndef GL_VERSION_1_1
 static void glRenderVertex(B3DPrimitiveVertex *vtx, int flags)
 {
 	DPRINTF(10, (fp, "["));
@@ -808,7 +806,6 @@
 	B3DInputFace *facePtr = (B3DInputFace*) idxArray;
 	GLuint tracking;
 	int nVertices = vtxSize;
-	int nFaces = 0;
 	int i, vtxFlags;
 
 	struct glRenderer *renderer = glRendererFromHandle(handle);
@@ -818,6 +815,8 @@
 		return 0;
 	}
 
+
+/*
 	DPRINTF(5, (fp,"### Primitive : %d\n", primType));
 	DPRINTF(5, (fp,"\ttexHandle   : %d\n", texHandle));
 	DPRINTF(5, (fp,"\tcolor flags :"));
@@ -832,6 +831,8 @@
 	if(flags & B3D_VB_HAS_NORMALS) DPRINTF(5,(fp," B3D_VB_HAS_NORMALS"));
 	if(flags & B3D_VB_HAS_TEXTURES) DPRINTF(5,(fp," B3D_VB_HAS_TEXTURES"));
 	DPRINTF(5, (fp, "\n"));
+*/
+
 
 	/* process VB flags */
 	tracking = 0;
@@ -844,9 +845,7 @@
 		/* in accordance with glColorMaterial man page noting:
 		   Call glColorMaterial before enabling GL_COLOR_MATERIAL. */
 		glColorMaterial(GL_FRONT_AND_BACK, tracking);
-		ERROR_CHECK;
 		glEnable(GL_COLOR_MATERIAL);
-		ERROR_CHECK;
 	}
 
 	glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, (flags & B3D_VB_LOCAL_VIEWER) ? 1 : 0);
@@ -856,20 +855,14 @@
 
 	if(texHandle > 0) {
 		glEnable(GL_TEXTURE_2D);
-		ERROR_CHECK;
 		glBindTexture(GL_TEXTURE_2D, texHandle);
-		ERROR_CHECK;
-	} else {
-		glDisable(GL_TEXTURE_2D);
-		ERROR_CHECK;
-	}
+	} else 	glDisable(GL_TEXTURE_2D);
+
 	vtxFlags = 0;
-	if(tracking)
-		vtxFlags |= 1;
-	if(flags & B3D_VB_HAS_NORMALS)
-		vtxFlags |= 2;
-	if(flags & B3D_VB_HAS_TEXTURES)
-		vtxFlags |= 4;
+	if(tracking) vtxFlags |= 1;
+	if(flags & B3D_VB_HAS_NORMALS)	vtxFlags |= 2;
+	if(flags & B3D_VB_HAS_TEXTURES)	vtxFlags |= 4;
+
 #ifdef GL_VERSION_1_1
 	/* use glDrawElements() etc */
 	/* @@@ HACK!!! */
@@ -906,8 +899,7 @@
 		        glDrawArrays(GL_POINTS, 1, nVertices);
 #else /* !GL_VERSION_1_1 */
 			glBegin(GL_POINTS);
-			for(i=0; i < nVertices; i++)
-				glRenderVertex(vtxPointer + i, vtxFlags);
+			for(i=0; i < nVertices; i++) glRenderVertex(vtxPointer + i, vtxFlags);
 			glEnd();
 #endif /* GL_VERSION_1_1 */
 			break;
@@ -916,8 +908,7 @@
 		        glDrawArrays(GL_LINES, 1, nVertices);
 #else /* !GL_VERSION_1_1 */
 			glBegin(GL_LINES);
-			for(i=0; i < nVertices; i++)
-				glRenderVertex(vtxPointer + i, vtxFlags);
+			for(i=0; i < nVertices; i++) glRenderVertex(vtxPointer + i, vtxFlags);
 			glEnd();
 #endif /* GL_VERSION_1_1 */
 			break;
@@ -926,8 +917,7 @@
 		        glDrawArrays(GL_POLYGON, 1, nVertices);
 #else /* !GL_VERSION_1_1 */
 			glBegin(GL_POLYGON);
-			for(i=0; i < nVertices; i++)
-				glRenderVertex(vtxPointer + i, vtxFlags);
+			for(i=0; i < nVertices; i++) glRenderVertex(vtxPointer + i, vtxFlags);
 			glEnd();
 #endif /* GL_VERSION_1_1 */
 			break;
@@ -991,12 +981,9 @@
 	glDisable(GL_COLOR_MATERIAL);
 	ERROR_CHECK;
 #ifdef GL_VERSION_1_1
-	if(vtxFlags & 1)
-	  glDisableClientState(GL_COLOR_ARRAY);
-	if(vtxFlags & 2)
-	  glDisableClientState(GL_NORMAL_ARRAY);
-	if(vtxFlags & 4)
-	  glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+	if(vtxFlags & 1)  glDisableClientState(GL_COLOR_ARRAY);
+	if(vtxFlags & 2)  glDisableClientState(GL_NORMAL_ARRAY);
+	if(vtxFlags & 4)  glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 	glDisableClientState(GL_VERTEX_ARRAY);
 	ERROR_CHECK;
 #endif /* GL_VERSION_1_1 */
