Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

why would pixel format suddenly become invalid...

650 views
Skip to first unread message

Michael B. Johnson

unread,
Dec 8, 1997, 3:00:00 AM12/8/97
to

Hi folks. I'm having some trouble porting an OpenGL Tcl/Tk widget
I wrote on the SGI to Windows. I should say up front that
I shamelessly copied the wonderful work of the Togl folks (I would have
used their stuff, but my needs are different enough that it didn't make
sense), and as far as I can tell, I'm not not doing anything they're
doing, but mine is working...

Anyway...

After rendering the first frame with no errors (Windows or OpenGL, I'm
checking error codes all over the place :-)), I end up back in my
display procedure, at which point I try and do a wglMakeCurrent() (which
worked quite happily the first few times). The call fails this time,
though, and if I call the Windows routine for getting the last error, it
says that it's error code 2000, which is "pixel format is invalid.".

so... I'm a complete Windows novice, and am wondering what are the
sorts of things I might have done to invalidate my pixel format, because
goodness knows, I didn't mean to...


I'm running WindowsNT4 (SP3), VisualC++ 5 (SP2), SGI's OpenGL MR2, and
ELSA's GLoria Synergy card (although I've run this on both the hardware
assisted and non-hardware assisted versions, same problems).

Any leads would be appreciated.


--
--> Michael B. Johnson, SMVS, Ph.D. -- wa...@pixar.com
--> Media Arts Technologist, Pixar Animation Studios (Eastern Office)
--> alumnus, MIT Media Lab, Computer Graphics & Animation Group
--> http://wave.www.media.mit.edu/people/wave/


Richard Horne

unread,
Dec 9, 1997, 3:00:00 AM12/9/97
to

I have encountered similar problems related to calling SetPixelFormat
serveral times for the same window. I don't know if this is your
situation, but it does cause the same symptoms. I quote from the
VC++ 5.0 documentation for SetPixelFormat...

"If hdc references a window, calling the SetPixelFormat function also
changes the pixel format of the window. Setting the pixel format of a
window more than once can lead to significant complications for the
Window Manager and for multithread applications, so it is not allowed.
An application can only set the pixel format of a window one time. Once
a window’s pixel format is set, it cannot be changed."

Hope this helps. Richard Horne

go...@berkelium.com.xyzzy

unread,
Dec 9, 1997, 3:00:00 AM12/9/97
to

Richard Horne <rsh...@mnsinc.com> writes:

>> I have encountered similar problems related to calling SetPixelFormat
>> serveral times for the same window. I don't know if this is your
>> situation, but it does cause the same symptoms. I quote from the
>> VC++ 5.0 documentation for SetPixelFormat...
>>
>> "If hdc references a window, calling the SetPixelFormat function also
>> changes the pixel format of the window. Setting the pixel format of a
>> window more than once can lead to significant complications for the
>> Window Manager and for multithread applications, so it is not allowed.
>> An application can only set the pixel format of a window one time. Once
>> a window’s pixel format is set, it cannot be changed."

One other thing to check is the WNDCLASS flags - be sure to set the
CS_OWNDC flag. This is sometimes responsible for seemingly random
failures in MakeCurrent and SwapBuffers.

Wilbur Streett

unread,
Dec 9, 1997, 3:00:00 AM12/9/97
to

>> After rendering the first frame with no errors (Windows or OpenGL, I'm
>> checking error codes all over the place :-)), I end up back in my
>> display procedure, at which point I try and do a wglMakeCurrent() (which
>> worked quite happily the first few times). The call fails this time,
>> though, and if I call the Windows routine for getting the last error, it
>> says that it's error code 2000, which is "pixel format is invalid.".

I'm getting the same error when I run the VASPHERE.C sample code from the
MSSDK linked to the SGI OpenGL Release 2 implementation, and use the
OverrideDispatch to force the pipeline to run through the SGI
implementation. On the other hand, linked through OpenGL32 or with the
OverrideDispatch registry key set so that the rendering is done by the MCD,
and it works just fine.

Wilbur

0 new messages