]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/glcontext.tex
c272127cc2538917764d0acbaf75ad52493bbdcc
[wxWidgets.git] / docs / latex / wx / glcontext.tex
1 \section{\class{wxGLContext}}\label{wxglcontext}
2
3 wxGLContext is a class for sharing opengl data resources, such as display lists, with another \helpref{wxGLCanvas}{wxglcanvas}.
4
5 By sharing data resources, you can prevent code duplication, save memory, and ultimately help optimize your application.
6
7 As 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 canvas, 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.
8
9 Note 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
17 <wx/glcanvas.h>\\
18 \\
19 \wxheading{See Also}
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
40 Obtains the window that is associated with this context.
41
42 \membersection{wxGLContext::SetCurrent}\label{wxglcontextsetcurrent}
43
44 \func{void}{SetCurrent}{\void}
45
46 Sets this context as the current recipient of OpenGL calls.
47 Each context contains an OpenGL device context that has been created during
48 the creation of this window. So this call sets the current device context
49 as the target device context for OpenGL operations.
50
51 \membersection{wxGLContext::SetColour}\label{wxglcontextsetcolour}
52
53 \func{void}{SetColour}{\param{const char*}{ colour}}
54
55 Sets 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
61 Displays the previous OpenGL commands on the associated window.