Changeset 1361
- Timestamp:
- 09/11/08 01:50:16 (3 months ago)
- Files:
-
- 1 modified
-
trunk/pysoy/src/models/Axis.pym (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pysoy/src/models/Axis.pym
r1360 r1361 31 31 32 32 cdef void _render(self, soy.bodies.Body _body) : 33 cdef VertPC _vert[2] # contains both vertex position and color data 34 cdef Line _elmt[1] # contains indices to verts to render lines 33 cdef VertPC _vert[2] # contains vertex position and color data 34 cdef Line _elmt[1] # contains indices to verts to render lines 35 cdef gl.GLfloat _mtx[16] 35 36 # 36 # This should be upgraded to use VBO. Test for buffer ID here. 37 ###################################### 38 # 39 # get model's matrix 40 # 41 _mtx[0] = _body._rotation[0] 42 _mtx[1] = _body._rotation[4] 43 _mtx[2] = _body._rotation[8] 44 _mtx[3] = 0.0 45 _mtx[4] = _body._rotation[1] 46 _mtx[5] = _body._rotation[5] 47 _mtx[6] = _body._rotation[9] 48 _mtx[7] = 0.0 49 _mtx[8] = _body._rotation[2] 50 _mtx[9] = _body._rotation[6] 51 _mtx[10] = _body._rotation[10] 52 _mtx[11] = 0.0 53 _mtx[12] = _body._position[0] 54 _mtx[13] = _body._position[1] 55 _mtx[14] = _body._position[2] 56 _mtx[15] = 1.0 57 # 58 ###################################### 59 # 60 # save Camera matix before transforming to the Axis' matrix 61 # 62 gl.glPushMatrix() 63 gl.glMultMatrixf(_mtx) 64 # 65 ###################################### 66 # 67 # Test if we've already setup the axis VBO 37 68 # 38 69 if self._vertBuffer : … … 82 113 gl.GL_STATIC_DRAW_ARB) 83 114 # 115 ###################################### 116 # 84 117 # Disable unused pointers 85 gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY) # No Texture Coords.. 86 gl.glDisableClientState(gl.GL_NORMAL_ARRAY) # or Normals either. 118 # 119 # Unlike Mesh and most other models, Axis doesn't use normals or textures 120 # so we need to turn these off while rendering an Axis 121 # 122 gl.glDisableClientState(gl.GL_NORMAL_ARRAY) # No Normals 123 gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY) # No Texture Coords 124 # 125 ###################################### 87 126 # 88 127 # Enable color pointer 89 gl.glEnableClientState(gl.GL_COLOR_ARRAY); # We need to render with color arrays 90 128 # 129 # To get color data into the vertices without making three separate 130 # rendering calls we turn on the color array while rendering 131 # 132 gl.glEnableClientState(gl.GL_COLOR_ARRAY) # We need to render with color arrays 133 # 91 134 gl.glVertexPointer(3, gl.GL_FLOAT, 0, <gl.GLvoid *> 0) 92 135 gl.glColorPointer (3, gl.GL_FLOAT, sizeof(float)*3, <gl.GLvoid *> 0) 93 #gl.glPushMatrix()94 136 gl.glDisable(gl.GL_CULL_FACE) 95 137 gl.glDisable(gl.GL_DEPTH_TEST) … … 99 141 gl.glEnable(gl.GL_DEPTH_TEST) 100 142 gl.glEnable(gl.GL_CULL_FACE) 101 #gl.glPopMatrix()102 143 gl.glDisableClientState(gl.GL_COLOR_ARRAY) 103 144 gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY) 104 145 gl.glEnableClientState(gl.GL_NORMAL_ARRAY) 146 # 147 ###################################### 148 # 149 # return to camera matrix 150 # 151 gl.glPopMatrix() 152 # 153 ###################################### 154
