#13 WGL ChoosePixelFormat calling error

v2.0
open
nobody
GL (5)
5
2002-11-25
2002-11-25
David Hughes
No

System: Win98, Python 2.2.2
PYOPENGL-2.0.0.44.WIN32-PY2.2.EXE
Win32 extensions v.148

Trying to run the openGLDemo .py included with Pythonwin, I
cannot execute
pfd = createPIXELFORMATDESCRIPTOR()
because I don't seem to have that function.

I replaced the call with
pfd = PIXELFORMATDESCRIPTOR()
<snip value assignments>
ppfd = PIXELFORMATDESCRIPTORPtr(pfd)

the call that causes problems is
pixelformat = ChoosePixelFormat(dc, ppfd)
with the following trace

File "C:\Python22\Lib\site-
packages\Pythonwin\pywin\Demos\openGLDemo.py", line 121,
in _SetupPixelFormat
pixelformat = ChoosePixelFormat(dc, ppfd)
TypeError: Type error. Expected
_p_q_const__PIXELFORMATDESCRIPTOR

How should I be calling the PixelFormat functions?

Discussion

  • praetor_alpha
    praetor_alpha
    2004-07-09

    Logged In: YES
    user_id=1080314

    Since I recently purchased a card that can do it, I am now
    looking into how to mulitsample in PyOpenGL.

    However, I was hitting a road-block in my search. I was
    looking at NeHe Lesson #46
    (http://nehe.gamedev.net/data/lessons/lesson.asp?
    lesson=46) and I was wondering where this "pfd" value came
    along. I realized that there was a function named
    wglChoosePixelFormatARB that came out of nowhere. I peeled
    through my PyOpenGL directories, and module docs.

    I found out that you have to
    wglChoosePixelFormatARB=wglGetProcAddress
    ("wglChoosePixelFormatARB"), which makes the
    wglChoosePixelFormatARB an integer, NOT a function.

    I suspect that wglChoosePixelFormatARB is where this PFD
    value comes from.