commit:2d85a13513cb220cf721f990f8eced25e9703df3
author:chip
committer:chip
date:Wed Nov 14 10:07:24 2007 +0000
parents:8d20348e5fad6c06df6ef99795311e55d7d2889a
Fixed Collage vertex array glitch
diff --git a/Collage.py b/Collage.py
line changes: +5/-10
index 5d96ff4..2368791
--- a/Collage.py
+++ b/Collage.py
@@ -40,10 +40,9 @@ class Collage:
 				mf = (int(args[0]),int(args[1]))
 			elif cmd == 'texture':
 				if nvertices > 0:	# dump vertex array
-					glVertexPointerf(array(vertexarray,'f'))
-					glTexCoordPointerf(array(texcoordarray,'f'))
-					print "drawing",nvertices,"vertices"
-					glDrawArrays(GL_QUADS, 0, 4)
+					glVertexPointer(3, GL_FLOAT, 0, array(vertexarray,'f'))
+					glTexCoordPointer(2, GL_FLOAT, 0, array(texcoordarray,'f'))
+					glDrawArrays(GL_QUADS, 0, nvertices)
 					vertexarray = []
 					texcoordarray = []
 					nvertices = 0
@@ -66,13 +65,9 @@ class Collage:
 				nvertices += 4
 		f.close()
 		# Finally,
-		glVertexPointerf(array(vertexarray,'f'))
-		glTexCoordPointerf(array(texcoordarray,'f'))
-		#print "drawing",nvertices,"vertices"
-		#print vertexarray
-		#print texcoordarray
+		glVertexPointer(3, GL_FLOAT, 0, array(vertexarray,'f'))
+		glTexCoordPointer(2, GL_FLOAT, 0, array(texcoordarray,'f'))
 		glDrawArrays(GL_QUADS, 0, nvertices)
-		#glDrawElementsui(GL_QUADS, array(range(0,nvertices),'i'))
 		glEndList()
 	
 

diff --git a/data/example1 b/data/example1
line changes: +4/-0
index 74e3602..19533f0
--- a/data/example1
+++ b/data/example1
@@ -18,3 +18,7 @@ tile 4 4
 
 tile 6 1
 tile 6 2
+
+tilesize 1 1
+texture img/ByteIco.png
+tile 263 249

diff --git a/scrolltest.py b/scrolltest.py
line changes: +2/-2
index ba07847..e0c867d
--- a/scrolltest.py
+++ b/scrolltest.py
@@ -21,10 +21,10 @@ stars.position = [0,0]
 def update():
 	ground.position[0] -= 5
 	if ground.position[0] < 0:
-		ground.position[0] = 640
+		ground.position[0] += 640
 	stars.position[0] -= 1
 	if stars.position[0] < 0:
-		stars.position[0] = 640
+		stars.position[0] += 640
 
 def draw():
 	stars.draw()