Derived from: public BWindowScreen
Declared in: be/opengl/GLView.h
Library: libGL.so
The BGLScreen class provides an interface to the OpenGL graphics system just like the BGLView class. The only difference is that BGLScreen displays its images in a BWindowScreen for full-screen graphics, while BGLView displays in a view.
For details on how to use OpenGL in your BeOS software, see Using OpenGL .
ErrorCallback()
Can be implemented to handle OpenGL errors.
BGLScreen(char *name, int32 screenMode, int32 type, status_t *error, bool debug = false)
Initializes the BWindowScreen and creates the OpenGL drawing context for it.
The name, screenMode, error, and debug parameters are the same as those for the BWindowScreen class.
The type parameter specifies the desired OpenGL options for the new context:
BGL_RGB | Use RGB graphics instead of indexed color (8-bit). This is the default if beitner BGL_RGB nor BGL_INDEX is specified. |
BGL_INDEX | Use indexed color (8-bit graphics). Not supported at this time. |
BGL_SINGLE | Use single-buffering; all rendering is done directly to the display. This is not currently supported by the BeOS implementation of OpenGL. This is the default if neither BGL_SINGLE nor BGL_DOUBLE is specified. |
BGL_DOUBLE | Use double-buffered graphics. All rendering is done to an offscreen buffer and only becomes visible when the SwapBuffers() function is called. |
BGL_ACCUM | Requests that the view have an accumulation buffer. |
BGL_ALPHA | Requests that the view's color buffer include an alpha component. |
BGL_DEPTH | Requests that the view have a depth buffer. |
BGL_STENCIL | Requests that the view have a stencil buffer. |
virtual ~BGLScreen()
Disposes of the OpenGL context that's attached to the BWindowScreen.
virtual void ErrorCallback(GLenum errorCode)
Called when an OpenGL error occurs. By default, this function invokes the debugger with an error message reading "GL: Error code $xxxx." You can (and probably should) reimplement this function to cope with errors more gracefully.
virtual void FrameResized(float width, float height)
Calls the inherited version of FrameResized() and resizes the OpenGL buffers.
void LockGL(void) void UnlockGL(void)
These functions lock and unlock the OpenGL context. You must lock the context before issuing any OpenGL commands, and unlock it when you're done--this is how OpenGL knows which context the drawing commands are intended for, since OpenGL itself isn't encapsulated within the BGLScreen class. For example:
LockGL(); /* lock the OpenGL context glEnable(GL_DITHER); /* turn on dithering support */ UnlockGL();
Failing to lock and unlock the context appropriately will result in unpredictable behavior and may cause your application to crash.
void ScreenConnected(bool connected)
Calls the inherited version of ScreenConnected(), then, if the connection is being established (connected is true), sets the OpenGL buffers to be the correct size for the screen.
void SwapBuffers(void)
Swaps the front buffer and back buffer, thereby making the back buffer visible.
This function has no effect if the display is single-buffered.
The Be Book, in lovely HTML, for BeOS Release 4.
Copyright © 1998 Be, Inc. All rights reserved.
Last modified February 6, 1998.