Changeset 12
- Timestamp:
- Jun 27, 2010, 12:53:53 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test-map.py
r8 r12 12 12 13 13 import numpy 14 from math import sin, cos 14 15 15 16 textures = [0,0] … … 35 36 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) 36 37 38 #glEnable(GL_ALPHA_TEST) 39 glEnable(GL_BLEND) 40 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) 41 #glBlendFunc(GL_SRC_ALPHA, GL_ONE) 42 43 37 44 def load_textures(): 38 45 texturefile = os.path.join('art','test','groundtest.png') 39 46 textureSurface = pygame.image.load(texturefile) 40 textureData = pygame.image.tostring(textureSurface, "RGB X", 1)47 textureData = pygame.image.tostring(textureSurface, "RGBA", 1) 41 48 42 49 glBindTexture(GL_TEXTURE_2D, textures[0]) … … 104 111 105 112 def draw(): 106 glClear(GL_DEPTH_BUFFER_BIT) # Full redraw: no need to clear color buffer 113 #glClear(GL_DEPTH_BUFFER_BIT) # Full redraw: no need to clear color buffer 114 glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) 107 115 glLoadIdentity() 108 116 … … 117 125 [ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17 ], 118 126 [ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 ], 119 [ 51, 51, 5 1, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 ],120 [ 51, 51, 5 1, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 ],121 [ 51, 51, 5 1, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 ],122 [ 51, 51, 5 1, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 ],127 [ 51, 51, 52, 52, 52, 51, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 ], 128 [ 51, 51, 52, 52, 52, 51, 51, 52, 51, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 ], 129 [ 51, 51, 52, 52, 52, 51, 51, 51, 51, 51, 51, 52, 52, 51, 51, 51, 51, 51, 51, 51 ], 130 [ 51, 51, 52, 52, 52, 51, 51, 51, 51, 51, 51, 52, 52, 51, 51, 51, 51, 51, 51, 51 ], 123 131 [ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 ], 124 132 [ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 ], 125 133 ] 134 glPushMatrix() 135 glTranslatef(50.0 * sin(frames * 0.05), 50.0 * cos(frames * 0.08), 0) 136 put_map(themap) 137 glPopMatrix() 138 glTranslatef(0, 0, 0.2) 126 139 put_map(themap) 127 140 141 frames = 0 142 128 143 def main(): 144 global frames 129 145 130 146 video_flags = OPENGL|DOUBLEBUF
Note: See TracChangeset
for help on using the changeset viewer.