[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Using PyOpenGL for 2D graphics



this may help?

http://members.optusnet.com.au/cjbarton/jump_run/

wrote a 2 player platform jump'n run.ages ago with pygame and opengl... I was learning at the time but it may be helpful as a reference when your starting off...

Has a realy simple level editor and physics function- all in ~600 lines, pyogl_game.py is the file you might be interested in looking at.



kschnee@xxxxxxxxxx wrote:
On Sun, July 15, 2007 4:12 pm, Ian Mallett wrote:
In your call to glViewport() put in (60,60, width-120, height-120) and
draw in the 60 pixel border.  Would that work?

Not sure, but on further experimentation I was able to adapt some code
posted on GameDev.net, to draw a flat array of 100x100 tiles that could be
scrolled and zoomed, with a 2D rectangle pasted atop the screen using
glOrtho(); all hooked up to Pygame event handling. That would be the
beginning of an OpenGL-based 2D tile engine and UI, given sufficient time
and motivation to figure out text drawing and other interface elements. I
don't think you can just draw the interface by blitting; drawing a
textured window border would probably involve four weirdly-textured quads,
for instance. Overkill!




--
Campbell J Barton (ideasman42)