| Home
| Previous
| Next
| Up

MGL_glSetVisual

Attempts to set the specified OpenGL visual for the MGL device context.

Declaration

ibool MGLAPI MGL_glSetVisual(
MGLDC *dc,
MGLVisual *visual)

Prototype In

mgraph.h

Parameters

dc | MGL device context
visual | Structure containing OpenGL visual information

Return Value

True on success, false if visual not supported by OpenGL implementation.

Description

This function sets the passed in OpenGL visual for the MGL device context and makes it the visual that will be used in the call to MGL_glCreateContext. Note that this function may fail if the OpenGL visual requested is invalid, and you should call MGL_glChooseVisual first to find a visual that best matches the underlying OpenGL implementation. For instance if the OpenGL implementation only supports a 16-bit z-buffer, yet you request a 32-bit z-buffer this function will fail.

The OpenGL visual is used to define the visual capabilities of the OpenGL rendering context that will be created with the MGL_glCreateContext function, and includes information such as whether the mode should be an RGB mode or color index mode, whether it should be single buffered or double buffered, whether a depth buffer (zbuffer) should be used and how many bits it should be etc.

Note: You can only set the visual for a context once, and it is an error to call MGL_glSetVisual more than once for an MGL device context, and you also cannot change a visual once you have set it without first destroying the OpenGL rendering context.

See Also

MGL_glChooseVisual, MGL_glCreateContext

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