aviel

Member
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

100 Neutral

About aviel

  • Rank
    Newbie
  1. Rendering Shadows

    Thanks, I appreciate it. Still can't figure out why it isn't working :/
  2. Rendering Shadows

    I appreciate the advice, but I can assure you I've done that. I don't post for advice on fora just because my code didn't compile the first time and I'm too lazy to check what "missing semicolon on line 13" means. I have actually copied most of his code verbatim, and the parts that aren't his I have tested work. Although I suppose there must be some part of that statement that is false, seeing as shadows don't display
  3. So, I've been following nehe's guide to creating shadows, and for whatever reason the shadows just aren't rendering. Not having an excellent understanding of things like the stencil-buffer means I'm sort of learning things as I go along. I hate outsourcing my debugging, but I'm kind of stumped here. does anybody know what's wrong? [code] glEnable(GL_CULL_FACE); glCullFace(GL_FRONT); glPushAttrib( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT ); glDisable( GL_LIGHTING ); glDepthMask( GL_FALSE ); glDepthFunc( GL_LEQUAL ); glEnable( GL_STENCIL_TEST ); glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); glStencilFunc( GL_ALWAYS, 1, 0xFFFFFFFFL ); glFrontFace( GL_CCW ); glStencilOp( GL_KEEP, GL_KEEP, GL_INCR ); //shadow volume quad drawing code here //I've checked to make sure that the code to draw the volume is running //so I thought I'd spare you that glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glColor4f(0.0f, 0.0f, 0.0f, 0.4f); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glStencilFunc(GL_NOTEQUAL, 0, 0xffffffff); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glOrtho(0, 1, 1, 0, 0, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glBegin(GL_QUADS); glVertex2i(0, 0); glVertex2i(0, 1); glVertex2i(1, 1); glVertex2i(1, 0); glEnd(); glEnable(GL_DEPTH_TEST); glPopMatrix(); glPopAttrib(); glEnable(GL_LIGHTING); glDisable(GL_STENCIL_TEST); glShadeModel(GL_SMOOTH); glDisable(GL_CULL_FACE); [/code] And I run that every frame. I have a feeling it's a problem in how I arranged the various gl*() commands. Only the large, screen-covering shadow is drawing with no parts being cut out.
  4. So, I've been following nehe's guide to creating shadows, and for whatever reason the shadows just aren't rendering. Not having an excellent understanding of things like the stencil-buffer means I'm sort of learning things as I go along. I hate outsourcing my debugging, but I'm kind of stumped here. does anybody know what's wrong? [source lang=cpp] glEnable(GL_CULL_FACE); glCullFace(GL_FRONT); glPushAttrib( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT ); glDisable( GL_LIGHTING ); glDepthMask( GL_FALSE ); glDepthFunc( GL_LEQUAL ); glEnable( GL_STENCIL_TEST ); glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); glStencilFunc( GL_ALWAYS, 1, 0xFFFFFFFFL ); glFrontFace( GL_CCW ); glStencilOp( GL_KEEP, GL_KEEP, GL_INCR ); //shadow volume quad drawing code here //I've checked to make sure that the code to draw the volume is running //so I thought I'd spare you that glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glColor4f(0.0f, 0.0f, 0.0f, 0.4f); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glStencilFunc(GL_NOTEQUAL, 0, 0xffffffff); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glOrtho(0, 1, 1, 0, 0, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glBegin(GL_QUADS); glVertex2i(0, 0); glVertex2i(0, 1); glVertex2i(1, 1); glVertex2i(1, 0); glEnd(); glEnable(GL_DEPTH_TEST); glPopMatrix(); glPopAttrib(); glEnable(GL_LIGHTING); glDisable(GL_STENCIL_TEST); glShadeModel(GL_SMOOTH); glDisable(GL_CULL_FACE); [/source] And I run that every frame. I have a feeling it's a problem in how I arranged the various gl*() commands. Only the large, screen-covering shadow is drawing with no parts being cut out.