MFC and OpenGL 
Author Message
 MFC and OpenGL

Hi ,

I'm trying to build a simple OpenGL app using MFC and VC4.0.  I have all
the correct libraries and DLLs installed and all the sample OpenGL programs
found in the online documentation work OK.

The problem I have is in using the ChoosePixelFormat API call.
I've created a simple SDI app using the appwizard, with no Database or OLE
automation support.  The main frame window has a toolbar and menu.

Firstly, I've modified the PreCreateWindow member function of the
CMainFrame with a the line:

cs.style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;

So far so good...

Then in the OnCreate member function I've created a CClientDC object using
the frames DC like this:

CClientDC cdc(this);

The next bit is creation of a PIXELDESCRIPTORFORMAT structure which I think
I've done OK.  I've tried several different configurations for this
structure, (different pixel depths, z-buffer depths etc....).  The last
thing I tried was using a pixel format that I know works from one of the
sample programs.

When I try and call ChoosePixelFormat however it always returns 0 , with
the error:

        ChoosePixelFormat failed  error 126

I don't understand how this can be working in the demo programs and not in
my own.  Does anyone know what this error code means?  
The only difference between the demo code and my own is that I've using MFC
whereas the demo is just using a "standard" Winmain layout. (No MFC used).

Has anyone else used MFC along with OpenGL?  

Any help would be greatly appreciated.

Cheers

Jonny

--
Jonny Coombes
3s Electronic Publishing Ltd.
Bath
UK

Tel: 01225 483083
Fax: 01225 483084



Sun, 07 Nov 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. MFC and OpenGL : display problem

2. MFC + Multithreading + openGL

3. MFC and OpenGL conflict?

4. MFC and OpenGL in an NT Environment

5. MFC and OpenGL

6. mfc and opengl

7. MFC + VisualC++ + OpenGL problem

8. MFC MDI OpenGL Question

9. OpenGL and MFC application - one of the views in OpenGL

10. MFC - OpenGL

11. Printing using MFC & OpenGL

12. OpenGL in MFC - distibuting files

 

 
Powered by phpBB® Forum Software