#include <vuGLCanvas.h>
Inheritance diagram for vuGLCanvas:
Public Member Functions | |
vuGLCanvas (wxWindow *parent, const wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name="vuGLCanvas", int *gl_attrib=NULL) | |
Initializes the canvas with the same parameters as the wxGLCanvas parent. | |
void | redraw () |
Redraws the contents of the canvas. | |
int | getWidth () const |
Returns the width of the OpenGL canvas. | |
int | getHeight () const |
Returns the height of the OpenGL canvas. | |
void | enableOpenGL () |
activate OpenGL Support | |
void | disableOpenGL () |
deactivate OpenGL Support | |
Protected Member Functions | |
virtual bool | glInit () |
Initializes openGL for use in the canvas. | |
virtual void | render () |
Renders the scene to the canvas using OpenGL. | |
virtual void | resize () |
Alters the OpenGL state after a resize event. | |
Private Member Functions | |
void | onPaint (wxPaintEvent &event) |
Implements the OnPaint event. | |
void | onSize (wxSizeEvent &event) |
Implements the default OnSize event. | |
void | onEraseBackground (wxEraseEvent &event) |
Implements the OnEraseBackground event. | |
Private Attributes | |
int | m_Width |
The width of the canvas. | |
int | m_Height |
The height of the canvas. | |
bool | m_init |
Whether the canvas has been initialized or not. | |
bool | m_useOGL |
Whether the OpenGL should be used or not. |
Steven Bergner, 30May02: redraw() now just triggers PAINT event, not calling render() directly. This caused problems in windows.
Definition at line 28 of file vuGLCanvas.h.
|
Initializes the canvas with the same parameters as the wxGLCanvas parent. The constructor acts in the same way as the wxGLCanvas constructor, with the same parameters. Any open gl initialization commands must be made by overriding the glInit() method.
Definition at line 20 of file vuGLCanvas.cpp. References size. |
|
deactivate OpenGL Support This is useful to hold the drawing canvas free for other drawing functions than OpenGL, e.g. if you want to use the GUI blit function instead of glDrawPixels() (which is said to be rather slow on PCs) Alternatively you can use vuDrawTools then, which should provide more direct frame buffer access. Definition at line 41 of file vuGLCanvas.cpp. References m_useOGL. Referenced by vuBasicUtility::useOpenGL(). |
|
activate OpenGL Support OpenGL is active in a vuGLCanvas by default. This function is intended to reactivate the OpenGL context. Definition at line 32 of file vuGLCanvas.cpp. References m_useOGL. Referenced by vuBasicUtility::useOpenGL(). |
|
|
|
Initializes openGL for use in the canvas. This method is called by vuGLCanvas as soon as the canvas' open gl classes are created, and openGL calls can be made. All initializiation should be done by overriding this method.
Reimplemented in vuPreviewWin, vuBasicSubWindow, vuFBRSubCanvas< SIZE, TYPE >, vuKeyFrameCanvas, vuSimpleFVRCanvas, vuSphericViewWin, vuTransferCanvas, vuBasicGLCanvas, and vuFBRSubCanvas< SIZE, byte >. Definition at line 85 of file vuGLCanvas.h. Referenced by onPaint(). |
|
Implements the OnEraseBackground event. This method actually eliminates the EraseBackground event from the event stack so that the windowing system doesn't erase the window itself. This causes flickering because the paint event is put right after the background is erased. Definition at line 134 of file vuGLCanvas.cpp. |
|
Implements the OnPaint event. It prepares the window's onPaint() drawing context, as required for an onPaint() event. It creates a clientDC for the window, as required for drawing to it, calls the render() method, then flushes the GL buffers to the canvas. Definition at line 77 of file vuGLCanvas.cpp. |
Here is the call graph for this function:
|
Implements the default OnSize event. It updates the internal vuGLCanvas variables and resizes the openGL viewport to the new canvas area. If different behaviour is desired, the derived class should implement it's own onSize event handler. The onPaint() event is called by wxWindows immediately afterwards, so the glCanvas does not need to be explicitly refreshed. Definition at line 110 of file vuGLCanvas.cpp. |
Here is the call graph for this function:
|
|
Renders the scene to the canvas using OpenGL. This is an interior method for the canvas that encapsulates all the rendering calls. It is called both when the user wants a redraw, and when the operating system requests one. These two cases need different preparation, and so are implemented in the redraw() and onPaint() methods. The method should be overriden and implement all the rendering calls to OpenGL. The two methods that call it set up the needed device contexts, activate the canvas' GL context, and flush the buffers, so no setting up is necessary. The method encapsulates just the openGL calls. Reimplemented in vuPreviewWin, vuBasicSubWindow, vuFBRSubCanvas< SIZE, TYPE >, vuKeyFrameCanvas, vuSimpleFVRCanvas, vuSphericViewWin, vuTransferCanvas, vuBasicGLCanvas, and vuFBRSubCanvas< SIZE, byte >. Definition at line 99 of file vuGLCanvas.h. Referenced by onPaint(). |
|
Alters the OpenGL state after a resize event. This method is called by the vuGLCanvas interior OnSize() method when it gets a canvas resize event. The OnSize() method handles the interior management related to the resize event, then passes control to this method so that any application specific calculation can be done. These are calls such as setting view matrices or updating necessary states. Reimplemented in vuFBRSubCanvas< SIZE, TYPE >, vuKeyFrameCanvas, vuSimpleFVRCanvas, vuTransferCanvas, vuBasicGLCanvas, and vuFBRSubCanvas< SIZE, byte >. Definition at line 109 of file vuGLCanvas.h. Referenced by vuPreviewWin::glOnMouse(), onPaint(), and onSize(). |
|
The height of the canvas.
Definition at line 141 of file vuGLCanvas.h. Referenced by onSize(). |
|
Whether the canvas has been initialized or not.
Definition at line 143 of file vuGLCanvas.h. Referenced by onPaint(). |
|
Whether the OpenGL should be used or not.
Definition at line 145 of file vuGLCanvas.h. Referenced by disableOpenGL(), and enableOpenGL(). |
|
The width of the canvas.
Definition at line 139 of file vuGLCanvas.h. Referenced by onSize(). |