Guest User

Untitled

a guest
Mar 13th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "..."
  2. displayListsDictionary at: 'gridList' ifAbsent: [
  3.         self drawsObject: aShip.
  4.  
  5.     gridList := self getNextDisplayList.
  6.     ogl glNewList: gridList with: GLCompile.
  7.     1 to: 150 do: [:i|
  8.         1 to: 150 do: [:j|
  9.             ogl glPushMatrix.
  10.             ogl glTranslatef: (i*0.35) -25 with: (j *0.35) -25 with: -75.
  11.        
  12.         self drawsObject: aShip.
  13.         ogl glPopMatrix.
  14.  
  15.         ]].
  16.         ogl glEndList.
  17.         displayListsDictionary at: 'gridList' put: gridList.
  18.     ].
  19.         ogl glCallList: (displayListsDictionary at: 'gridList').
  20.  
  21.  
  22. "..."
  23.  
  24.  
  25. drawsObject: anObject
  26.  
  27.  
  28.  
  29.     |  shape  mode vertexBuffer normalBuffer texCoordBuffer  displayList |
  30.    
  31.    
  32.    
  33.         shape := anObject shipShape.
  34.         displayList := shape cachedDisplayList.
  35.         displayList ifNil: [
  36.            
  37.     mode := shape shapeMode.
  38.    
  39.     vertexBuffer := shape vertexBuffer.
  40.     normalBuffer := nil. "Vector3Array ofSize: 24."
  41.     texCoordBuffer := nil. "Vector2Array ofSize: 24."
  42.    
  43.     displayList := self getNextDisplayList.
  44.     ogl glNewList: displayList with: GLCompile.
  45.  
  46.     ogl beginVertices: (vertexBuffer) normals: (normalBuffer) colors: shape colors texCoords: (texCoordBuffer).
  47.  
  48.     ogl glPushMatrix.
  49.  
  50.     1 to: shape fgSize by: 2
  51.  
  52.         do:[ :i | ogl drawIndexed: mode faces: (shape faceBuffers at: i+1//2)].
  53.  
  54.    
  55.         ogl glPopMatrix.
  56.         ogl glEndList.
  57.         shape cachedDisplayList: displayList.
  58.         ].
  59.         ogl glCallList: displayList.
Add Comment
Please, Sign In to add comment