Show
Ignore:
Timestamp:
09/16/03 16:12:35 (5 years ago)
Author:
sholloway
Message:

*** empty log message ***

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RBRapier/RBRapier/Renderer/View/Transformations.py

    r703 r704  
    2727from RBRapier.Tools import Projections 
    2828from RBRapier.Tools import Quaternion 
    29 from RBRapier.Tools import RectangleBase 
     29from RBRapier.Tools import ViewBox 
    3030 
    3131from Numeric import transpose 
    3232from OpenGL import GL, GLU 
     33 
     34try: 
     35    GL.GL_COLOR_MATRIX 
     36except AttributeError: 
     37    GL.GL_COLOR_MATRIX = 0x80B1 
    3338 
    3439#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     
    4853    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    4954 
    50     _ModeNameTable = {None:"< None >", GL.GL_MODELVIEW:"Model View", GL.GL_PROJECTION:"Projection", GL.GL_TEXTURE_MATRIX:"Texture", GL.GL_COLOR:"Color"} 
     55    _ModeNameTable = {None:"< None >", GL.GL_MODELVIEW:"Model View", GL.GL_PROJECTION:"Projection", GL.GL_TEXTURE:"Texture", GL.GL_COLOR:"Color"} 
     56    _SaveMatrixLookup = { 
     57        None: GL.GL_MODELVIEW_MATRIX, 
     58        GL.GL_MODELVIEW: GL.GL_MODELVIEW_MATRIX, 
     59        GL.GL_PROJECTION: GL.GL_PROJECTION_MATRIX, 
     60        GL.GL_TEXTURE: GL.GL_TEXTURE_MATRIX, 
     61        GL.GL_COLOR: GL.GL_COLOR_MATRIX, 
     62        } 
    5163    Mode = None 
    5264    Save = 0 
     
    6779        if self.Mode:  
    6880            GL.glMatrixMode(self.Mode) 
     81            if self.Save: 
     82                self._SaveMatrix() 
     83            self.GLExecute(context) 
     84            GL.glMatrixMode(GL.GL_MODELVIEW) 
     85        elif self.Save: 
    6986            self._SaveMatrix() 
    7087            self.GLExecute(context) 
    71             GL.glMatrixMode(GL.GL_MODELVIEW) 
    7288        else: 
    73             self._SaveMatrix() 
    7489            self.GLExecute(context) 
    7590 
     
    86101        try: 
    87102            GL.glPushMatrix() 
    88         except GL.GLerror: 
    89             self._save_matrix = GL.glGetDouble(Gl.GL_MODELVIEW_MATRIX) 
     103        except GL.GLerror, e: 
     104            self._save_matrix = GL.glGetDouble(self._SaveMatrixLookup[self.Mode]) 
     105    #_SaveMatrix = staticmethod(GL.glPushMatrix) 
    90106 
    91107    def _RestoreMatrix(self): 
     
    96112            GL.glLoadMatrixd(oldmatrix) 
    97113            del self._save_matrix 
     114    #_RestoreMatrix = staticmethod(GL.glPopMatrix) 
    98115 
    99116#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     
    169186    pass 
    170187 
    171 class RectangleMappingMatrix(RectangleBase.RectangleMappingMatrix3dh): 
    172     GLExecute = GLExecuteAsMatrix 
    173  
    174 class RectangleMappingMatrixMgd(ManagedTransformationMixin, RectangleMappingMatrix): 
     188class ViewBoxMappingMatrix(ViewBox.ViewBoxMappingMatrix3dh): 
     189    GLExecute = GLExecuteAsMatrix 
     190 
     191class ViewBoxMappingMatrixMgd(ManagedTransformationMixin, ViewBoxMappingMatrix): 
    175192    pass 
    176193 
  • trunk/RBRapier/RBRapier/Renderer/View/Viewport.py

    r702 r704  
    2525 
    2626from OpenGL import GL 
    27 from RBRapier.Tools import RectangleBase 
     27from RBRapier.Tools import ViewBox 
    2828from RBRapier.Renderer.AttributeMgr import AttributeChangeElement 
    2929 
     
    3232#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    3333 
    34 class Viewport(RectangleBase.RectangleBase): 
     34class Viewport(ViewBox.ViewBox): 
    3535    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    3636    #~ Constants / Variables / Etc.  
     
    4444 
    4545    def GLExecute(self, context): 
    46         GL.glViewport(*self.Rectangle) 
     46        rectangle = map(int, self.GetRectangle()) 
     47        GL.glViewport(*rectangle) 
    4748