1wxGLCanvas(3)              Erlang Module Definition              wxGLCanvas(3)
2
3
4

NAME

6       wxGLCanvas - Functions for wxGLCanvas class
7

DESCRIPTION

9       wxGLCanvas is a class for displaying OpenGL graphics. It is always used
10       in conjunction with wxGLContext as the context can only be made current
11       (i.e.  active  for  the  OpenGL  commands)  when  it is associated to a
12       wxGLCanvas.
13
14       More precisely, you first need to create a wxGLCanvas window  and  then
15       create  an  instance  of  a  wxGLContext  that is initialized with this
16       wxGLCanvas and then later use either setCurrent/2 with the instance  of
17       the  wxGLContext  or  wxGLContext:setCurrent/2 with the instance of the
18       wxGLCanvas (which might be not the same as was used for the creation of
19       the  context)  to bind the OpenGL state that is represented by the ren‐
20       dering context to the canvas, and then finally  call  swapBuffers/1  to
21       swap  the  buffers of the OpenGL canvas and thus show your current out‐
22       put.
23
24       Please note that wxGLContext always uses physical pixels, even  on  the
25       platforms  where  wxWindow uses logical pixels, affected by the coordi‐
26       nate scaling, on high DPI displays. Thus, if you want to set the OpenGL
27       view  port  to  the size of entire window, you must multiply the result
28       returned by  wxWindow:getClientSize/1  by  wxWindow:getContentScaleFac‐
29       tor/1  before  passing it to glViewport(). Same considerations apply to
30       other OpenGL functions and other coordinates, notably  those  retrieved
31       from wxMouseEvent in the event handlers.
32
33       Notice  that  versions  of wxWidgets previous to 2.9 used to implicitly
34       create a wxGLContext inside wxGLCanvas itself. This is still  supported
35       in the current version but is deprecated now and will be removed in the
36       future, please update your code to create the  rendering  contexts  ex‐
37       plicitly.
38
39       To  set  up the attributes for the canvas (number of bits for the depth
40       buffer, number of bits for the stencil buffer and so on) you pass  them
41       in  the  constructor using a wxGLAttributes (not implemented in wx) in‐
42       stance. You can still use the way before 3.1.0 (setting up the  correct
43       values of the attribList parameter) but it's discouraged.
44
45       Note:  On  those platforms which use a configure script (e.g. Linux and
46       macOS) OpenGL support is automatically enabled if the relative  headers
47       and  libraries  are  found.  To  switch it on under the other platforms
48       (e.g. Windows), you need to edit the setup.h file and set  wxUSE_GLCAN‐
49       VAS  to  1 and then also pass USE_OPENGL=1 to the make utility. You may
50       also need to add opengl32.lib (and glu32.lib for old  OpenGL  versions)
51       to the list of the libraries your program is linked with.
52
53       See:  wxGLContext,  wxGLAttributes (not implemented in wx), wxGLContex‐
54       tAttrs (not implemented in wx)
55
56       This class is derived  (and  can  use  functions)  from:  wxWindow  wx‐
57       EvtHandler
58
59       wxWidgets docs: wxGLCanvas
60

DATA TYPES

62       wxGLCanvas() = wx:wx_object()
63

EXPORTS

65       new(Parent) -> wxGLCanvas()
66
67              Types:
68
69                 Parent = wxWindow:wxWindow()
70
71       new(Parent, Options :: [Option]) -> wxGLCanvas()
72
73              Types:
74
75                 Parent = wxWindow:wxWindow()
76                 Option =
77                     {id, integer()} |
78                     {attribList, [integer()]} |
79                     {pos, {X :: integer(), Y :: integer()}} |
80                     {size, {W :: integer(), H :: integer()}} |
81                     {style, integer()} |
82                     {name, unicode:chardata()} |
83                     {palette, wxPalette:wxPalette()}
84
85              This  constructor is still available only for compatibility rea‐
86              sons.
87
88              Please use the constructor with wxGLAttributes (not  implemented
89              in wx) instead.
90
91              If  attribList  is  not  specified,  wxGLAttributes::PlatformDe‐
92              faults() (not implemented in wx) is used, plus  some  other  at‐
93              tributes (see below).
94
95       setCurrent(This, Context) -> boolean()
96
97              Types:
98
99                 This = wxGLCanvas()
100                 Context = wxGLContext:wxGLContext()
101
102              Makes the OpenGL state that is represented by the OpenGL render‐
103              ing context context current, i.e.
104
105              it will be used by all subsequent OpenGL calls.
106
107              This is equivalent to wxGLContext:setCurrent/2 called with  this
108              window as parameter.
109
110              Note:  This function may only be called when the window is shown
111              on screen, in particular it can't usually  be  called  from  the
112              constructor as the window isn't yet shown at this moment.
113
114              Return: false if an error occurred.
115
116       swapBuffers(This) -> boolean()
117
118              Types:
119
120                 This = wxGLCanvas()
121
122              Swaps  the  double-buffer of this window, making the back-buffer
123              the front-buffer and vice versa, so that the output of the  pre‐
124              vious OpenGL commands is displayed on the window.
125
126              Return: false if an error occurred.
127
128       destroy(This :: wxGLCanvas()) -> ok
129
130              Destroys the object.
131
132
133
134wxWidgets team.                    wx 2.1.4                      wxGLCanvas(3)
Impressum