Skip to content

Commit

Permalink
BF: fixes to pyglet.gl calls after switch from pyopengl
Browse files Browse the repository at this point in the history
  • Loading branch information
peircej committed Nov 26, 2020
1 parent 39777a3 commit 1aec9ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions psychopy/visual/textbox2/fontmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,11 @@ def upload(self):
if self.format == 'alpha':
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_ALPHA,
self.width, self.height, 0,
gl.GL_ALPHA, gl.GL_UNSIGNED_BYTE, self.data)
gl.GL_ALPHA, gl.GL_UNSIGNED_BYTE, self.data.ctypes)
else:
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGB,
self.width, self.height, 0,
gl.GL_RGB, gl.GL_UNSIGNED_BYTE, self.data)
gl.GL_RGB, gl.GL_UNSIGNED_BYTE, self.data.ctypes)
logging.debug("Upload of Texture Font {} complete"
.format(self.name))

Expand Down
8 changes: 4 additions & 4 deletions psychopy/visual/textbox2/textbox2.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,16 +510,16 @@ def draw(self):
gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY)
gl.glEnableClientState(gl.GL_VERTEX_ARRAY)

gl.glVertexPointer(2, gl.GL_FLOAT, 0, self.verticesPix)
gl.glColorPointer(4, gl.GL_FLOAT, 0, self._colors)
gl.glTexCoordPointer(2, gl.GL_FLOAT, 0, self._texcoords)
gl.glVertexPointer(2, gl.GL_FLOAT, 0, self.verticesPix.ctypes)
gl.glColorPointer(4, gl.GL_FLOAT, 0, self._colors.ctypes)
gl.glTexCoordPointer(2, gl.GL_FLOAT, 0, self._texcoords.ctypes)

self.shader.bind()
self.shader.setInt('texture', 0)
self.shader.setFloat('pixel', [1.0 / 512, 1.0 / 512])
nVerts = len(self.text)*4
gl.glDrawElements(gl.GL_QUADS, nVerts,
gl.GL_UNSIGNED_INT, list(range(nVerts)))
gl.GL_UNSIGNED_INT, np.arange(nVerts, dtype=int).ctypes)
self.shader.unbind()

# removed the colors and font texture
Expand Down

0 comments on commit 1aec9ab

Please sign in to comment.