Skip to content

Port from pyglet 1.x to pyglet 2.x#200

Open
hamidrg20001379 wants to merge 2 commits into
fogleman:masterfrom
hamidrg20001379:master
Open

Port from pyglet 1.x to pyglet 2.x#200
hamidrg20001379 wants to merge 2 commits into
fogleman:masterfrom
hamidrg20001379:master

Conversation

@hamidrg20001379

Copy link
Copy Markdown

This code was originally written for pyglet 1.x, but only pyglet 2.x is available on modern Python versions. This PR ports the application to pyglet 2.1.x, which uses an OpenGL core profile and a significantly different rendering API.

Changes

  • Added pyglet.gl.gl_compat import for removed OpenGL compatibility constants and functions (GL_FOG, glFogfv, etc.)
  • Replaced gluPerspective() with a manual projection matrix computation
  • Replaced get_viewport_size() with get_framebuffer_size()
  • Replaced batch.add() with the new batch.get_domain().create() VertexDomain API
  • Updated pyglet.graphics.draw() calls to use keyword arguments (position=('f', data)) instead of positional format tuples
  • Removed pyglet.graphics.vertex_list() and glBegin/glEnd immediate mode rendering in favor of pyglet.graphics.draw()
  • Replaced pyglet.clock.get_fps() with a manual frame counter
  • Requested an OpenGL 2.1 compatibility profile in the window configuration
  • Updated tex_coord() to output 3-component vectors to match the default shader's vec3 tex_coords attribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants