WGL in python, ChoosePixelFormat error

Mike C. Fletcher mcfletch at rogers.com
Wed Dec 12 14:03:26 EST 2001


You might find that more PyOpenGL programmers are on the PyOpenGL-users 
list at SourceForge.

First question:  Why WGL and win32api?  It's (IMO) the least supportive 
of the GUI libraries for Python (for new users not coming from a VC++ 
background).  I'd suggest using wxPython, Tkinter or PyGame for the GUI. 
  All of those have well-supported and easy-to-use PyOpenGL contexts.

Second question: Have you looked at Mark Hammond's OpenGL demo that 
comes with PythonWin?  It's the only PyOpenGL demo with win32api I've 
ever seen, so if that's what you're fixed on, that's likely the only 
demo code you'll find (though I've heard someone somewhere actually 
created a system with it, I've no idea who).

If you're just starting out, my recommendation would be to use wxPython. 
It's a fully-featured GUI system targetted at "traditional" GUIs, and 
the PyOpenGL widget is easy to use.  If you're seeing your project 
having more of a "Game GUI" (a control HUD over a 3D world), then maybe 
go with PyGame.  As a note, there is a lot of sample code for PyGame and 
wxPython PyOpenGL work in the OpenGLContext package (yeah, I know, 
shameless plug :o) ).

Links:
	http://sourceforge.net/mail/?group_id=5988
	http://www.wxPython.org
	http://www.pygame.org
	http://pyopengl.sourceforge.net/documentation/openglcontext/

HTH,
Mike

Rene Jensen wrote:

> Hi all.
> 
> Does anyone know where to find an example of how to set up an opengl context
> via wgl? Is this being posted in the wrong forum?
> 
> I get a strange error when trying to call ChoosePixelFormat
> This is how I try to setup my gl-context using win32all and wgl:
> 
> # Register window-class ..
> # Create window..
> # GetDC..
> 
> Desc = PIXELFORMATDESCRIPTOR()
> Desc.xxx = yyy
> ..
> PDesc = PIXELFORMATDESCRIPTORPtr (Desc)
> format = ChoosePixelFormat (windowDC, PDesc)
> 
> ..Which results in:
> 
>     TypeError: Type Error. Expected _p_q_const__PIXELFORMATDESCRIPTOR
> 
> But what does that mean?
> 
> Thanks in advance all! I've just started using python, and loved it instantly.
> I'm trying to make a radiosity-renderer for creating shadowmaps in 3d games. I
> really hope python is good enough for it, because I simply love the simplicity
> of the code.
> 
> chilopoda at hotmail.com
> 
> 
> 


-- 
_______________________________________
   Mike C. Fletcher
   http://members.rogers.com/mcfletch/






More information about the Python-list mailing list