🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.ms-windows.programmer.tools.mfc
5 messages
5 total messages Started by Chuck L. Peterson Thu, 29 Feb 1996 06:36
MfcOgl to get multiple OpenGL contexts
#61
Author: Chuck L. Peterson
Date: Thu, 29 Feb 1996 06:36
27 lines
1407 bytes
I've been using the CMfcOglView class provided with the
Microsoft MFCOGL with great success.

But now I want to create 2 or 3 OpenGL context regions
all within the same Window. How would I go about doing this?

This routine goes right into setting up the OpenGL context
without even giving me a chance to specify/setup other windows:

void CMfcOglView::Init()
{
	PIXELFORMATDESCRIPTOR pfd;
	int         n;
	HGLRC		hrc;
    m_pDC = new CClientDC(this);
    if (!bSetupPixelFormat())
        return;
    n = ::GetPixelFormat(m_pDC->GetSafeHdc());
    ::DescribePixelFormat(m_pDC->GetSafeHdc(), n, sizeof(pfd), &pfd);
    CreateRGBPalette();

    // create a rendering context and make it current
    hrc = wglCreateContext(m_pDC->GetSafeHdc());
    wglMakeCurrent(m_pDC->GetSafeHdc(), hrc);

Any help would be greatly appreciated.
clp@alumni.cse.ucsc.edu
Re: MfcOgl to get multiple OpenGL contexts
#62
Author: Ron Fosner
Date: Fri, 01 Mar 1996 15:37
17 lines
1049 bytes
> I've been using the CMfcOglView class provided with the
> Microsoft MFCOGL with great success.
> 
> But now I want to create 2 or 3 OpenGL context regions
> all within the same Window. How would I go about doing this?
> 
 Any help would be greatly appreciated.
> clp@alumni.cse.ucsc.edu

What exactly are you trying to do? If you want to render two scenes
in the same window you can just set up two viewports. If you're
trying to do something where you need two different pixel formats,
then it's impossible- you can't have, for example, the left half
double buffered, and the right half not......

Ron Fosner
ron@tiac.net
Re: MfcOgl to get multiple OpenGL contexts
#63
Author: Chuck L. Peterson
Date: Fri, 01 Mar 1996 18:35
26 lines
1696 bytes
I want a single window with 2 different OpenGl views, with
several Win95 PushButtons, a single line Text Entry field,
and a cheesy Icon resource below them. Using multiple viewports
on the same OpenGL context doesn't fit my project because each
view is a completely different scene. 

The Dialog Resource Editor in VC++4.0 isn't too helpful unless
I can use it to paint in OpenGL regions.  Hmmm. Maybe you can
do that by specifying a "custom" object class tool module foundation
thing, which would be MfcOglvw. I'll give that a try.  Thanks.

clp@alumni.cse.ucsc.edu

Ron Fosner wrote:
> > But now I want to create 2 or 3 OpenGL context regions
> > all within the same Window. How would I go about doing this?
> >

> What exactly are you trying to do? If you want to render two scenes
> in the same window you can just set up two viewports. If you're
> trying to do something where you need two different pixel formats,
> then it's impossible- you can't have, for example, the left half
> double buffered, and the right half not......
> 
> Ron Fosner
> ron@tiac.net
Re: MfcOgl to get multiple OpenGL contexts
#64
Author: Chuck L. Peterson
Date: Fri, 01 Mar 1996 18:42
7 lines
846 bytes
> Hmmm. Maybe you can
> do that by specifying a "custom" object class tool module foundation
> thing, which would be MfcOglvw. I'll give that a try.  Thanks.

Well, that totally doesn't work.

Next.
Re: MfcOgl to get multiple OpenGL contexts
#65
Author: Dale Rogerson
Date: Sat, 02 Mar 1996 01:25
51 lines
2122 bytes
In article <3135497E.2AE@alumni.cse.ucsc.edu>, clp@alumni.cse.ucsc.edu 
says...
>
>I've been using the CMfcOglView class provided with the
>Microsoft MFCOGL with great success.
>
>But now I want to create 2 or 3 OpenGL context regions
>all within the same Window. How would I go about doing this?
>
>This routine goes right into setting up the OpenGL context
>without even giving me a chance to specify/setup other windows:
>
>void CMfcOglView::Init()
>{
>        PIXELFORMATDESCRIPTOR pfd;
>        int         n;
>        HGLRC           hrc;
>    m_pDC = new CClientDC(this);
>    if (!bSetupPixelFormat())
>        return;
>    n = ::GetPixelFormat(m_pDC->GetSafeHdc());
>    ::DescribePixelFormat(m_pDC->GetSafeHdc(), n, sizeof(pfd), &pfd);
>    CreateRGBPalette();
>
>    // create a rendering context and make it current
>    hrc = wglCreateContext(m_pDC->GetSafeHdc());
>    wglMakeCurrent(m_pDC->GetSafeHdc(), hrc);
>
>Any help would be greatly appreciated.
>clp@alumni.cse.ucsc.edu

The MSDN article "OpenGL III: Building an OpenGL C++ Class" presents a 
different method for handling multiple OpenGL contexts. 

If you don't have a subscription to MSDN, you can view the article at the 
following location:

        http://www.microsoft.com/MSDN/LIBRARY/TECHNOTE

There are other articles about OpenGL in the same location.

The source code was written for Visual C++ version 2.0 and may need to be 
tweaked for Visual C++ version 4.0.

Dale Rogerson
Microsoft


-- 
The opinions expressed in this message are my own personal views 
and do not reflect the official views of Microsoft Corporation.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads