Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
examples [2007/10/24 11:17]
admin
examples [2007/10/24 11:23]
admin
Line 88: Line 88:
  
 {{simpleviewer.png|}} {{simpleviewer.png|}}
 +
  
 ===== Texture 3D example ===== ===== Texture 3D example =====
Line 97: Line 98:
 In the ''​draw''​ method, a dynamic pyramid is drawn using texture 3D. In the ''​draw''​ method, a dynamic pyramid is drawn using texture 3D.
  
-The ''​animate''​ method ​update ​the coordinates of the pyramid.+The ''​animate''​ method ​updates ​the coordinates of the pyramid. 
 + 
  
  
Line 106: Line 109:
 from PyQGLViewer import * from PyQGLViewer import *
 import OpenGL.GL as ogl import OpenGL.GL as ogl
 +import math
  
 helpstr = """<​h2>​T e x t u r e 3 D</​h2>​ helpstr = """<​h2>​T e x t u r e 3 D</​h2>​
Line 125: Line 129:
         # texture coordinates are always specified before the vertex they apply to.         # texture coordinates are always specified before the vertex they apply to.
         for x in range(4):         for x in range(4):
-            ogl.glTexCoord3d(self.center[0], self.center[1],​ self.center[2]+            ogl.glTexCoord3dv(self.center) 
-            ogl.glVertex3d(self.center[0], self.center[1],​ self.center[2])+            ogl.glVertex3dv(self.center)
             ​             ​
-            ogl.glTexCoord3d(self.base[x][0], self.base[x][1],​ self.base[x][2]) +            ogl.glTexCoord3dv(self.base[x]) 
-            ogl.glVertex3d(self.base[x][0], self.base[x][1],​ self.base[x][2])+            ogl.glVertex3dv(self.base[x])
             ​             ​
-            ogl.glTexCoord3d(self.base[(x+1)%4][0], self.base[(x+1)%4][1],​ self.base[(x+1)%4][2]) +            ogl.glTexCoord3dv(self.base[(x+1)%4]) 
-            ogl.glVertex3d(self.base[(x+1)%4][0], self.base[(x+1)%4][1],​ self.base[(x+1)%4][2])+            ogl.glVertex3dv(self.base[(x+1)%4])
         ogl.glEnd()         ogl.glEnd()
     def init(self):     def init(self):
Line 162: Line 166:
     main()     main()
 </​code>​ </​code>​
 +
 +
 
Back to top
examples.txt · Last modified: 2007/10/24 11:29 by admin
Valid CSS Driven by DokuWiki Valid XHTML 1.0