Port from pyglet 1.x to pyglet 2.x#200
Open
hamidrg20001379 wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
pyglet.gl.gl_compatimport for removed OpenGL compatibility constants and functions (GL_FOG,glFogfv, etc.)gluPerspective()with a manual projection matrix computationget_viewport_size()withget_framebuffer_size()batch.add()with the newbatch.get_domain().create()VertexDomainAPIpyglet.graphics.draw()calls to use keyword arguments (position=('f', data)) instead of positional format tuplespyglet.graphics.vertex_list()andglBegin/glEndimmediate mode rendering in favor ofpyglet.graphics.draw()pyglet.clock.get_fps()with a manual frame countertex_coord()to output 3-component vectors to match the default shader'svec3 tex_coordsattribute