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

wglMakeCurrent() problem, please help

342 views
Skip to first unread message

Ju Feng

unread,
Jan 29, 2000, 3:00:00 AM1/29/00
to
Dear All

I am writing to you from Singapore.I need you help.

I have a problem with OpenGL and MFC, which has driven me mad.

I am developing a multi-document application with opengl display for a
research project. I create a CDisplayView class for OpenGLdisplay.
CDisplayView is instanced in 4 split windows.

When I run the application, everything looks fine with different 3D
objects in the 4 views. But, when I shut down and restart my computer,and
runsystem(CTRL-F5), objects in one window was frozen which are supposed to
rotate with mouse movement. The rest 3 windows are ok. Tracing down the
problem, I find it is because "wglMakeCurrent (m_HDC, m_HGLRC )" is failed
(return 0). However both m_HDC and m_HGLRC are valid (passed by VERIFY).

Sometimes I find the error code is 2000, which means invalid pixles. But
it works fine for the other three windows.

Strange enough, I run it in debug mode (F5), It's all ok. Once run and
pass by F5, it becomes to response correctly all the way by CTRL-F5.

The same story repeats when I restart my computer.

Would you please give me any indication or help.


Thanks in advance.

Ju Feng
CAE/CAD/CAM Centre
National University of Singapore


Alen Ladavac

unread,
Jan 29, 2000, 3:00:00 AM1/29/00
to
which opengl card/driver are you running that on? perhaps there is a bug in
the driver. are you using one context for all windows, or does each window
has its own context?

also, when wglmakecurrent returns 0, call getlasterror, and see what the
error was.

--
alen


Ju Feng

unread,
Jan 31, 2000, 3:00:00 AM1/31/00
to
Hi, Alen;
Thanks for your reply.
I didn't use any acceleration card for openGL. The problem exists if I run
the .EXE at any other computer. I am using Win 98.

Each window has its own context.

The code was 2000, a pixle-related error.

Thanks again.

Ju Feng


Alen Ladavac (e...@nospam.marvin.cc.fer.hr) wrote:
: which opengl card/driver are you running that on? perhaps there is a bug in

Alen Ladavac

unread,
Jan 31, 2000, 3:00:00 AM1/31/00
to

Ju Feng <eng...@leonis.nus.edu.sg> wrote in message
news:872qck$3vq$1...@nuscc.nus.edu.sg...

> Hi, Alen;
> Thanks for your reply.
> I didn't use any acceleration card for openGL. The problem exists if I run
> the .EXE at any other computer. I am using Win 98.
>
> Each window has its own context.
>
> The code was 2000, a pixle-related error.

oh, that is the "invalid pixel format" error code. are you calling
SetPixelFormat() on each window before you create its context? have you set
the CS_OWNDC flag for the window class of those windows?

--
alen


Ju Feng

unread,
Feb 2, 2000, 3:00:00 AM2/2/00
to
HI, Alen

Yes, I call SetPixelFormat() each time create the context?

would you please show me how to set CS_OWNDC style? It seems like for
older version.


thanks

ju feng

0 new messages