]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/glcontext.tex
define _HPUX_SOURCE under HP-UX, otherwise many things are not defined in standard...
[wxWidgets.git] / docs / latex / wx / glcontext.tex
CommitLineData
38fc80ae
RN
1\section{\class{wxGLContext}}\label{wxglcontext}
2
43e8916f 3wxGLContext is a class for sharing OpenGL data resources, such as display lists, with another \helpref{wxGLCanvas}{wxglcanvas}.
38fc80ae
RN
4
5By sharing data resources, you can prevent code duplication, save memory, and ultimately help optimize your application.
6
beb3c20c 7As an example, let's say you want to draw a ball on two different windows that is identical on each one, but the dimensions of one is slightly different than the other one. What you would do is create your display lists in the shared context, and then translate each ball on the individual canvas's context. This way the actual data for the ball is only created once (in the shared context), and you won't have to duplicate your development efforts on the second ball.
38fc80ae
RN
8
9Note that some wxGLContext features are extremely platform-specific - its best to check your native platform's glcanvas header (on windows include/wx/msw/glcanvas.h) to see what features your native platform provides.
10
11\wxheading{Derived from}
12
13\helpref{wxObject}{wxobject}
14
15\wxheading{Include files}
16
f2ac0386
RN
17<wx/glcanvas.h>
18
19\wxheading{See also}
38fc80ae
RN
20
21\helpref{wxGLCanvas}{wxglcanvas}
22
23\latexignore{\rtfignore{\wxheading{Members}}}
24
25\membersection{wxGLContext::wxGLContext}\label{wxglcontextconstr}
26
27\func{void}{wxGLContext}{\param{bool }{isRGB}, \param{wxGLCanvas*}{ win}, \param{const wxPalette\&}{ palette = wxNullPalette}}
28
29\func{void}{wxGLContext}{\param{bool }{isRGB}, \param{wxGLCanvas*}{ win}, \param{const wxPalette\&}{ palette = wxNullPalette},
30 \param{const wxGLContext*}{ other}}
31
32\docparam{win}{Canvas to associate this shared context with.}
33
34\docparam{other}{Context to share data resources with.}
35
36\membersection{wxGLContext::GetWindow}\label{wxglcontextgetwindow}
37
38\func{const wxWindow*}{GetWindow}{\void}
39
40Obtains the window that is associated with this context.
41
42\membersection{wxGLContext::SetCurrent}\label{wxglcontextsetcurrent}
43
44\func{void}{SetCurrent}{\void}
45
46Sets this context as the current recipient of OpenGL calls.
47Each context contains an OpenGL device context that has been created during
48the creation of this window. So this call sets the current device context
49as the target device context for OpenGL operations.
50
51\membersection{wxGLContext::SetColour}\label{wxglcontextsetcolour}
52
53\func{void}{SetColour}{\param{const char*}{ colour}}
54
55Sets the current colour for this context, using the wxWidgets colour database to find a named colour.
56
57\membersection{wxGLContext::SwapBuffers}\label{wxglcontextswapbuffers}
58
59\func{void}{SwapBuffers}{\void}
60
61Displays the previous OpenGL commands on the associated window.
058a62b1 62