pygame and opengl

53 views
Skip to first unread message

Friktion

unread,
Sep 11, 2009, 12:13:44 PM9/11/09
to PYGGEL-dev
hey since your library does combine pygame and opengl so good i just
wonder how you do it ??
can you show me a simple text file that uses pygame and opengl, you
should be able to blit simply like you would with pygame and when you
push start or a button you se aa 3d shape or something =)
thanks in advnace

Ian Mallett

unread,
Sep 11, 2009, 3:48:29 PM9/11/09
to pygge...@googlegroups.com
On Fri, Sep 11, 2009 at 9:13 AM, Friktion <zaml...@gmail.com> wrote:
hey since your library does combine pygame and opengl so good i just
wonder how you do it ??
can you show me a simple text file that uses pygame and opengl,
I assume you already know basic PyGame.  To setup an OpenGL context, it's as simple as adding the token pygame.OPENGL (available as OPENGL if you use "from pygame.locals import *") to the flags in pygame.display.set_mode().  
you
should be able to blit simply like you would with pygame
Unfortunately, it's not that simple.  Blitting like in PyGame basically is impossible.  Also, all the pygame.draw() commands as well as the surface.blit() stuff won't work to draw to the screen.   
and when you
push start or a button you se aa 3d shape or something =)
thanks in advnace
Making objects is fairly important to seeing anything ;-)
It's best to think of objects as being composed of polygons.  Google NeHe, and learn from the tutorials (they have Python versions at the bottom).  These provide fairly simple instructions for making objects and (more importantly/difficultly) using them.  
Ian 

Friktion

unread,
Sep 11, 2009, 4:06:25 PM9/11/09
to PYGGEL-dev
thanks for answering manr really appreciate it =)

On Sep 11, 9:48 pm, Ian Mallett <geometr...@gmail.com> wrote:

RB[0]

unread,
Sep 11, 2009, 6:23:16 PM9/11/09
to pygge...@googlegroups.com
PYGGEL has some 2d image features, allowing limited blitting like in PyGame, though obviously handled slightly differently.
Obviously there is a considerable amount more to setting up OpenGL if you just use Pygame and Opengl, but if you use pyggel you just initiate it and then create your object and go...

http://www.pygame.org/gamelets/
In the above link you will find a Nehe OpenGL project, which converts the first 10 (?) NeHe examples to pygame+OpenGL...
Not sure if it still works with the newest version of PyopenGL though :S

Markus Martin

unread,
Sep 11, 2009, 9:04:32 PM9/11/09
to pygge...@googlegroups.com
2009/9/11 RB[0] <roe...@gmail.com>:

> PYGGEL has some 2d image features, allowing limited blitting like in PyGame,
> though obviously handled slightly differently.

To expand on this for Friktion a little bit more.. In OpenGL drawing
2D images (such as for a GUI) is accomplished by rendering planes with
the 2D image as a texture. The surface of the plane (commonly referred
to as a 'quad') is oriented perpendicular to the direction that the
camera is pointing. This way, no matter which way you turn the camera.
You always see these 2D images in front of you. You also have to
render things in the correct order, if you don't want your images
covered up or penetrated by other geometry.

But like RB says, if you are new to 3D, starting with PYGGEL would not
be a bad idea. Eventually you can dig into the guts of the library,
and see how to use OpenGL directly. Good luck!

-Markus

Friktion

unread,
Sep 12, 2009, 6:17:41 AM9/12/09
to PYGGEL-dev
thanks again =)

On Sep 12, 3:04 am, Markus Martin <archw...@gmail.com> wrote:
> 2009/9/11 RB[0] <roeb...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages