opengl fonts w/mfc

opengl fonts w/mfc

Post by Dre » Tue, 27 Jan 1998 04:00:00



Hi,

I am trying to get fonts to work using mfc & opengl

I can get m_pDC to work.

Any ideas?

Know where I can find an example?

thanks,
Drew

 
 
 

opengl fonts w/mfc

Post by David Calkin » Wed, 28 Jan 1998 04:00:00


What do you mean, you can get m_pDC to work?? What does that mean?

Try setting PFD_SUPPORT_OPENGL and PFD_SUPPORT_GDI in your
PIXELFORMATDESCRIPTOR when you initialize.  Then, in your drawing routine do
all your GL drawing, swap buffers (if appropriate), call glFinish(), and
then do GDI drawing (e.g. TextOut(), etc.)

--

{

   New River Kinematics,
   MEDBASE SYSTEMS

};

>Hi,

>I am trying to get fonts to work using mfc & opengl

>I can get m_pDC to work.

>Any ideas?

>Know where I can find an example?

>thanks,
>Drew


 
 
 

opengl fonts w/mfc

Post by Mike Brinkma » Wed, 28 Jan 1998 04:00:00


Check out Microsoft's Text3D OpenGL screen saver.
The source code is available for download at the following site:

<http://premium.microsoft.com/msdn/library/devprods/vc++/vcsamples/f14...
35/s1ccc4.htm>

Hope this helps,
Mike Brinkman



Quote:> Hi,

> I am trying to get fonts to work using mfc & opengl

> I can get m_pDC to work.

> Any ideas?

> Know where I can find an example?

> thanks,
> Drew

 
 
 

opengl fonts w/mfc

Post by James C. Stut » Wed, 28 Jan 1998 04:00:00



>What do you mean, you can get m_pDC to work?? What does that mean?

>Try setting PFD_SUPPORT_OPENGL and PFD_SUPPORT_GDI in your
>PIXELFORMATDESCRIPTOR when you initialize.  Then, in your drawing routine do
>all your GL drawing, swap buffers (if appropriate), call glFinish(), and
>then do GDI drawing (e.g. TextOut(), etc.)

>--

Of course, using GL and GDI in the same window removes the option to use
double-buffering.

JCS

 
 
 

opengl fonts w/mfc

Post by Dre » Wed, 28 Jan 1998 04:00:00





>>What do you mean, you can get m_pDC to work?? What does that mean?

I am using MFC's doc view format
and I need an example showing how to set up fonts in OpenGL.
The example that I have from "Opengl Programming for Windows 95 and
WIndows NT" by Ron Fosner uses m_pDC which is not a
member of the Class I am using.

Thanks,
Drew

 
 
 

opengl fonts w/mfc

Post by David Calkin » Wed, 28 Jan 1998 04:00:00


First:  I suggest going to the Win32 SDK, and reading up on device contexts.

Any drawing you do in windows will be done through a device context (DC).
MFC wraps device context handles with a class called CDC.  So, if your
writing an MFC App, anytime your going to draw you need to get the device
context for the window you wish to draw in.

m_pDC is a member that was probably defined in the example.  Its just a
convenient place to store a device context.  However, you can do the
following to get the same effect:

CDC* m_pDC = GetDC();
if (m_pDC)
{
    // use device context here

    ReleaseDC(m_pDC);

Quote:}

The example probably just defined m_pDC as being a member of the class
(hence the m_).  They probably use GetDC() and then save the CDC pointer for
later

--

{

   New River Kinematics,
   MEDBASE SYSTEMS

};





>>>What do you mean, you can get m_pDC to work?? What does that mean?

>I am using MFC's doc view format
>and I need an example showing how to set up fonts in OpenGL.
>The example that I have from "Opengl Programming for Windows 95 and
>WIndows NT" by Ron Fosner uses m_pDC which is not a
>member of the Class I am using.

>Thanks,
>Drew

 
 
 

opengl fonts w/mfc

Post by David Calkin » Wed, 28 Jan 1998 04:00:00


No, you can still use double-buffering for the GL drawing.  But of course,
you can't do the GDI drawing right into OpenGL's memory so that it gets
swapped with the other GL stuff.

One alternative is to create a DIB section.  Attach a GL rendering context
to that DIB section, and have GL render (in single buffer mode) directly to
the DIB section.  Then do your GDI drawing on the DIB section, and blit the
whole thing into the window.

This way you can combine GL and GDI, and still get double-buffering.

--

{

   New River Kinematics,
   MEDBASE SYSTEMS

};



>>What do you mean, you can get m_pDC to work?? What does that mean?

>>Try setting PFD_SUPPORT_OPENGL and PFD_SUPPORT_GDI in your
>>PIXELFORMATDESCRIPTOR when you initialize.  Then, in your drawing routine
do
>>all your GL drawing, swap buffers (if appropriate), call glFinish(), and
>>then do GDI drawing (e.g. TextOut(), etc.)

>>--

>Of course, using GL and GDI in the same window removes the option to use
>double-buffering.

>JCS

 
 
 

opengl fonts w/mfc

Post by Ron Fosne » Sun, 01 Feb 1998 04:00:00



> Hi,

> I am trying to get fonts to work using mfc & opengl

> I can get m_pDC to work.

> Any ideas?

> Know where I can find an example?

> thanks,
> Drew

lookup wglUseFontOutlines
 
 
 

1. Fonts and MFC/OpenGL

I've used the sample code provided with Visual C++ 5.0 showing
how to use wglUseFontBitmaps(), etc., but I get no fonts to
appear. I've tried the MS OpenGL and the SGI OpenGL libs, but
to no avail. Everything else I've tried using OpenGL works, except
for fonts.

I'm double-buffering and I've heard that prevents the native
WIN32 fonts from working - they work with minor flickering if
you render them after swapping buffers - but I expect the wgl
font stuff to work regardless of double-buffering.

Can anyone Help?!   ...thanks in advance...

-Dave

2. Newbie: Brush Strokes

3. Windows 95 mfc - Opengl Fonts

4. Bezier points for sinewave?

5. Problem with 3D fonts (i've seen the MFC text tutorial)

6. Flickering of two TImage

7. wgl font on Windows (+MFC)

8. NeHe 3D Fonts in MFC

9. Display 3D Font in MFC program

10. Internation font print out in MFC

11. Vector Fonts, OpenGL and Adobe Fonts Libraries

12. MFC button control in MFC vissual C++