summaryrefslogtreecommitdiffstats
path: root/sdl/platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'sdl/platform.c')
-rw-r--r--sdl/platform.c49
1 files changed, 23 insertions, 26 deletions
diff --git a/sdl/platform.c b/sdl/platform.c
index 55f6555..7542d11 100644
--- a/sdl/platform.c
+++ b/sdl/platform.c
@@ -13,6 +13,7 @@
/* few light arrays */
GLfloat fNoLight[] = { 0.0f, 0.0f, 0.0f, 0.0f };
GLfloat fLowLight[] = { 0.25f, 0.25f, 0.25f, 1.0f };
+GLfloat fMedLight[] = { 0.50f, 0.50f, 0.50f, 1.0f };
GLfloat fBrightLight[] = { 1.0f, 1.0f, 1.0f, 1.0f };
/* light values and coordinates */
@@ -36,26 +37,29 @@ void setup_opengl(void)
glFogf(GL_FOG_END, 20.0f);
glFogi(GL_FOG_MODE, GL_LINEAR); /* fog equation */
- glEnable(GL_DEPTH_TEST); /* hidden surface removal */
- glFrontFace(GL_CCW); /* counter clock-wise polygons face out */
- glEnable(GL_CULL_FACE); /* do not calculate inside of a pyramid */
+ glEnable(GL_DEPTH_TEST); /* hidden surface removal */
+ glFrontFace(GL_CCW); /* counter clock-wise polygons face out */
+ glEnable(GL_CULL_FACE); /* do not calculate inside of a pyramid */
+
+ /* enable lighting */
+ glEnable(GL_LIGHTING);
+
+ /* global illumination, ambient RGBA intensity of the entire scene */
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, fLowLight);
/* setup and enable light 0 */
- /* ambient RGBA intensity of the entire scene */
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, whiteLight);
- glLightfv(GL_LIGHT0, GL_AMBIENT, sourceLight);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, fBrightLight);
+ glLightfv(GL_LIGHT0, GL_AMBIENT, fMedLight);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, fMedLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, fBrightLight);
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
-
- /* enable lighting */
- glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
/* enable color tracking */
glEnable(GL_COLOR_MATERIAL);
- /* set Material properties to follow glColor values */
+ /* set material properties to follow glColor values */
+ /* all primitives specified after the glMaterial call are affected by the
+ * last values set, until another call to glMaterial is made */
glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
glMaterialfv(GL_FRONT, GL_SPECULAR, fBrightLight);
glMateriali(GL_FRONT, GL_SHININESS, 128);
@@ -67,34 +71,27 @@ void setup_opengl(void)
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
- /* screws up snowman */
+
+ /* screws up snowman, this has been replaced by superior multisampling */
//glEnable(GL_POLYGON_SMOOTH);
//glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
- /* gray background */
- glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
-
- /* original texture loading used to be here */
-
- /* texture filtering, we modify default values since we don't have mipmaps */
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ /* multisampling for polygons, conflicts with *polygon* anti-aliasing */
+ glEnable(GL_MULTISAMPLE);
/* how OpenGL combines the colors from texels with the color of the underlying
* geometry is controlled by the texture environment mode */
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
/* once texture is loaded and enabled, it will applied to every primitive
- * that specifies coordinates */
+ * that specifies coordinates, ORLY? */
glEnable(GL_TEXTURE_2D);
- /* multisampling for polygons, conflicts with anti-aliasing */
- //glEnable(GL_MULTISAMPLE);
-
/* don't know about this, but why not */
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
+
+ /* gray background */
+ glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
}
void setup_sdl(void)