Changes in / [010086b:b3b0f3f] in python-game


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • game.py

    r010086b rb3b0f3f  
    1111   #glEnable (GL_BLEND); glBlendFunc (GL_ONE, GL_ONE);
    1212
    13    # I should really figure out which attributes in the 2D rendering
    14    # break the 3d rendering and reset those back instead of resetting
    15    # all attributes
    16    glPushAttrib(GL_ALL_ATTRIB_BITS)
     13   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     14
    1715   render3d(surface)
    18    glPopAttrib()
    1916
    2017   if showOverlay:
    2118      renderOverlay(overlay, font)
    22 
    23       glPushAttrib(GL_ALL_ATTRIB_BITS)
    2419      projectOverlay(surface, overlay)
    25       glPopAttrib()
    2620
    2721
    … …  
    3529
    3630   pygame.draw.rect(overlay, (0, 128, 255), pygame.Rect(30, 30, 60, 60))
     31   pygame.draw.rect(overlay, (128, 255, 0), pygame.Rect(300, 300, 1000, 1000))
     32   
    3733   overlay.blit(text, (500, 100))
    3834
    … …  
    4137   glPushMatrix()
    4238
    43    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
     39   glColor3f(1.0, 1.0, 1.0)
    4440
    4541   glTranslatef(0.0,0.0,-zNear)
    … …  
    7470
    7571   glEnd()
     72   
     73   glDisable(GL_TEXTURE_2D)
    7674
    7775   glPopMatrix()
    … …  
    104102   
    105103   glPushMatrix()
    106 
    107    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
     104   
     105   glColor3f(1.0, 0.0, 0.0)
    108106
    109107   glTranslatef(0.0,0.0,-2*zNear)
    110    glColor3f(1.0, 1.0, 1.0)
    111108
    112109   glBegin(GL_LINES)
    … …  
    167164
    168165zNear = 1.0/math.tan(math.radians(45.0/2))
     166
     167# not really need here since there are no previous
     168# matrix modifications, but keeping it for reference
     169#glLoadIdentity()
    169170gluPerspective(45, (w/h), zNear, 500.0)
    170171
Note: See TracChangeset for help on using the changeset viewer.