MGL_glCreateContext

Creates the OpenGL rendering context for the MGL device context.

Declaration

ibool MGLAPI MGL_glCreateContext(
MGLDC *dc,
int flags)

Prototype In

mgraph.h

Parameters

dc | MGL device context to enable OpenGL API for
flags | Flags to force type of OpenGL library used

Return Value

True if context was created successfully, false otherwise

Description

This function creates an OpenGL rendering context for the MGL device context, and enables support for OpenGL functions for the MGL device context. To provide a quick and easy way to get the MGL up and running with OpenGL support, you can pass in some simple flags that let the MGL know what OpenGL features you want enabled in the OpenGL visual for the MGL device context, by combining values in the MGL_glContextType enumeration. For instance if you wanted to start OpenGL with support for an RGB, double buffered and z-buffered mode you would pass in:

MGL_GL_RGB | MGL_GL_DOUBLE | MGL_GL_DEPTH

If you wish to have complete control over the OpenGL visual that is used for the MGL device context, you can call MGL_glChooseVisual and MGL_glSetVisual before calling MGL_glCreateContext, and then pass in a value of MGL_GL_VISUAL to tell the MGL to use the visual you have already set for the device context instead of trying to create one from the passed in flags.

Note: Once you have created an OpenGL rendering context for the MGL device context, you must first call MGL_glMakeCurrent to make that specific MGL device context the current OpenGL rendering context before you call any core OpenGL API functions.

Note: You must call this function first before you attemp to make any calls to the core OpenGL API functions (such as glVertex3f etc), as the MGL will not have initialised its internal dispatch tables until this call is made.

See Also

MGL_glChooseVisual, MGL_glSetVisual, MGL_glMakeCurrent

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