1wxGLContext(3) Erlang Module Definition wxGLContext(3)
2
3
4
6 wxGLContext - Functions for wxGLContext class
7
9 An instance of a wxGLContext represents the state of an OpenGL state
10 machine and the connection between OpenGL and the system.
11
12 The OpenGL state includes everything that can be set with the OpenGL
13 API: colors, rendering variables, buffer data ids, texture objects,
14 etc. It is possible to have multiple rendering contexts share buffer
15 data and textures. This feature is specially useful when the applica‐
16 tion use multiple threads for updating data into the memory of the
17 graphics card.
18
19 Whether one only rendering context is used with or bound to multiple
20 output windows or if each window has its own bound context is a devel‐
21 oper decision. It is important to take into account that GPU makers may
22 set different pointers to the same OGL function for different contexts.
23 The way these pointers are retrieved from the OGL driver should be used
24 again for each new context.
25
26 Binding (making current) a rendering context with another instance of a
27 wxGLCanvas however works only if the both wxGLCanvas instances were
28 created with the same attributes.
29
30 OpenGL version 3 introduced a new type of specification profile, the
31 modern core profile. The old compatibility profile maintains all legacy
32 features. Since wxWidgets 3.1.0 you can choose the type of context and
33 even ask for a specified OGL version number. However, its advised to
34 use only core profile as the compatibility profile may run a bit
35 slower.
36
37 OpenGL core profile specification defines several flags at context cre‐
38 ation that determine not only the type of context but also some fea‐
39 tures. Some of these flags can be set in the list of attributes used at
40 wxGLCanvas ctor. But since wxWidgets 3.1.0 it is strongly encouraged to
41 use the new mechanism: setting the context attributes with a wxGLCon‐
42 textAttrs (not implemented in wx) object and the canvas attributes with
43 a wxGLAttributes (not implemented in wx) object.
44
45 The best way of knowing if your OpenGL environment supports a specific
46 type of context is creating a wxGLContext instance and checking
47 wxGLContext::IsOK() (not implemented in wx). If it returns false, then
48 simply delete that instance and create a new one with other attributes.
49
50 wxHAS_OPENGL_ES is defined on platforms that only have this implementa‐
51 tion available (e.g. the iPhone) and don't support the full specifica‐
52 tion.
53
54 See: wxGLCanvas, wxGLContextAttrs (not implemented in wx), wxGLAt‐
55 tributes (not implemented in wx)
56
57 wxWidgets docs: wxGLContext
58
60 wxGLContext() = wx:wx_object()
61
63 new(Win) -> wxGLContext()
64
65 Types:
66
67 Win = wxGLCanvas:wxGLCanvas()
68
69 new(Win, Options :: [Option]) -> wxGLContext()
70
71 Types:
72
73 Win = wxGLCanvas:wxGLCanvas()
74 Option = {other, wxGLContext()}
75
76 Constructor.
77
78 setCurrent(This, Win) -> boolean()
79
80 Types:
81
82 This = wxGLContext()
83 Win = wxGLCanvas:wxGLCanvas()
84
85 Makes the OpenGL state that is represented by this rendering
86 context current with the wxGLCanvas win.
87
88 Note: win can be a different wxGLCanvas window than the one that
89 was passed to the constructor of this rendering context. If RC
90 is an object of type wxGLContext, the statements "RC.SetCur‐
91 rent(win);" and "win.SetCurrent(RC);" are equivalent, see
92 wxGLCanvas:setCurrent/2.
93
94 destroy(This :: wxGLContext()) -> ok
95
96 Destroys the object.
97
98
99
100wxWidgets team. wx 2.1 wxGLContext(3)