diff options
Diffstat (limited to 'sdl/pyramid.c')
| -rw-r--r-- | sdl/pyramid.c | 27 | 
1 files changed, 26 insertions, 1 deletions
| diff --git a/sdl/pyramid.c b/sdl/pyramid.c index c7fe00e..fa78477 100644 --- a/sdl/pyramid.c +++ b/sdl/pyramid.c @@ -27,6 +27,11 @@ GLFrame camera;  static GLfloat xRot = 0.0f;  static GLfloat yRot = 0.0f; +/* few arrays, they could make into the header at some point */ +GLfloat fNoLight[]     = { 0.0f, 0.0f, 0.0f, 0.0f }; +GLfloat fLowLight[]    = { 0.25f, 0.25f, 0.25f, 1.0f }; +GLfloat fBrightLight[] = { 1.0f, 1.0f, 1.0f, 1.0f }; +  static void resize(int w, int h)  {      printf("window: resizing to %dx%d\n", w, h); @@ -60,6 +65,13 @@ static void SetupRC()      GLfloat whiteLight[] = { 0.05f, 0.05f, 0.05f, 1.0f };      GLfloat sourceLight[] = { 0.75f, 0.75f, 0.75f, 1.0f };      GLfloat    lightPos[] = { -10.f, 5.0f, 5.0f, 1.0f }; +     +    /* setup fog */ +    glEnable(GL_FOG); +    glFogfv(GL_FOG_COLOR, fLowLight);   /* set fog color to match background */ +    glFogf(GL_FOG_START, 4.0f); +    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 */ @@ -106,6 +118,19 @@ static void SetupRC()      /* set the camera to <0,0,0> */      reset_glframe(&camera); +     +    /* multisampling for polygons */ +    //glEnable(GL_MULTISAMPLE); +     +    /* turn on anti aliasing for points, lines, and polygons */ +    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +    glEnable(GL_BLEND); +    glEnable(GL_POINT_SMOOTH); +    glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); +    glEnable(GL_LINE_SMOOTH); +    glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); +    glEnable(GL_POLYGON_SMOOTH); +    glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);  }  static void keys(SDL_keysym *keysym, unsigned int *keys_held, int flag) @@ -198,7 +223,7 @@ void processEvents()  static void draw_ground(void)  { -    GLfloat fExtent = 10.0f; +    GLfloat fExtent = 20.0f;      GLfloat fStep = 0.5f;      GLfloat y = -0.4f;      GLfloat iLine; | 
