MGL_glEnableMGLFuncs

Enables MGL 2D drawing functions using an OpenGL surface

Declaration

void MGLAPI MGL_glEnableMGLFuncs(
MGLDC *dc)

Prototype In

mgraph.h

Parameters

dc | Device context to enable 2D MGL functions for

Description

This function enable support for MGL 2D functions for hardware accelerated OpenGL surfaces. In order to be able to draw to a hardware OpenGL surface using 2D OpenGL drawing functions, the MGL needs to re-program the state of the OpenGL rendering context such that it maps to a 2D integer coordinate system rather than the 2D or 3D coordinate system the user application code is using for OpenGL drawing. Hence this function saves the the state of the OpenGL rendering context so it can be restored with MGL_glDisableMGLFuncs, and sets the rendring context into a state that is suitable for 2D drawing via internal functions in the MGL.

Although it is not necessary to call this function to use the MGL 2D drawing functions (such as MGL_fillRect, MGL_bitBlt, MGL_drawStr etc), the process of saving and restoring the rendering context is expensive. Internally the MGL will call this function before doing any 2D operations, which means the state is saved and restore for every 2D MGL function that is called. Hence if you will be calling a number of 2D MGL drawing functions, you can bracket your code with MGL_glEnableMGLFuncs and MGL_glDisableMGLFuncs to ensure that the MGL only saves and restores the rendering context once for all MGL 2D drawing functions you call.

See Also

MGL_glDisableMGLFuncs

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com