Archived

This topic is now archived and is closed to further replies.

InFerN0

OpenGL And MFC

Recommended Posts

I have been trying to get GL to work in an MFC window(not a view). All the tutorials I have found deal with views. Is anything different? I have looked at the Q3Radient source and I have basicly the same thing. Maybe there is a sublty I am missing? I have done everything you would do to set up a window. I set up contexts, PFD, etc... Any Ideas? Thanks. InFerN0 Not all who wander are lost...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''m not sure what you mean but a "window" not a "view." Do you mean not a CView class? I have a bare minimum MFC program that sets up a window and OpenGL then displays a OpenGL scene from NeHe''s lesson 3. If that will help let me know, I''ll then e-mail it to you.

Joel

Share this post


Link to post
Share on other sites
PFD_DRAW_TO_WINDOW

hope you set that in your pixel format descriptor...

cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states

Share this post


Link to post
Share on other sites
anon: My program uses I use CSplitterWnd to create 4 windows.

I already have that in my PFD. Any other ideas?

InFerN0

Not all who wander are lost...

Share this post


Link to post
Share on other sites
You all mean to tell me that no one other than John Carmack has ever used OpenGL in a window class derived from CWnd?

InFerN0

Not all who wander are lost...

Share this post


Link to post
Share on other sites
The only problem I can see is that your are not making the window RC current when repainting the window.


I''ve also used q3radiant code to help set up everthing and it all works fine!

Share this post


Link to post
Share on other sites
I''ve also got 4 opengl views in a CSplitter.
in each of the 4 classes I get, I''ve got a hDC and a hRC;

for the hDC I use (in the the OnDraw()

hDC = ::GetDC(pDC->GetWindow()->m_hWnd);

I think getting the rest is pretty clear...

but watch out that you only set up your view the first time. That shouldn''t be a problem though...
hope that helped,
cya,
Phil



Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states

Share this post


Link to post
Share on other sites
And btw.

Q3Radiant was written by Robert Duffy, right?.

Yes, John C. is a great programmer, but there are so many other great programmers out there!

cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states

Share this post


Link to post
Share on other sites
I think you are right, Q3Radiant is by Robert Duffy.

I am using OnPaint() for drawing. As OnDraw is not a member of CWnd. Is this ok?

InFerN0

Not all who wander are lost...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Don''t worry I fixed it. Thanks for the help.

Share this post


Link to post
Share on other sites