Skip to content

Commit

Permalink
Allows one to precache vertex and texture coordinates for draw3Dtex
Browse files Browse the repository at this point in the history
  • Loading branch information
erodozer committed Jun 24, 2011
1 parent 3de8670 commit 5da465e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/GameEngine.py
Expand Up @@ -959,19 +959,21 @@ def draw3Dtex(self, image, vertex, texcoord, coord = None, scale = None, rot = N
if depth == True:
glDepthMask(1)

triangVtx = np.array(
if not isinstance(vertex, np.ndarray):
vertex = np.array(
[[ vertex[0], vertscale, vertex[1]],
[ vertex[2], vertscale, vertex[1]],
[ vertex[0], -vertscale, vertex[3]],
[ vertex[2], -vertscale, vertex[3]]], dtype=np.float32)

textriangVtx = np.array(

if not isinstance(texcoord, np.ndarray):
texcoord = np.array(
[[texcoord[0], texcoord[1]],
[texcoord[2], texcoord[1]],
[texcoord[0], texcoord[3]],
[texcoord[2], texcoord[3]]], dtype=np.float32)

cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=triangVtx, colors=col_array, texcoords=textriangVtx)
cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=vertex, colors=col_array, texcoords=texcoord)

if depth == True:
glDepthMask(0)
Expand Down

0 comments on commit 5da465e

Please sign in to comment.