File: wx.glcanvas.GLContext.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (155 lines) | stat: -rw-r--r-- 5,524 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.glcanvas.GLContext:

==========================================================================================================================================
|phoenix_title|  **wx.glcanvas.GLContext**
==========================================================================================================================================

An instance of a :ref:`wx.glcanvas.GLContext`  represents the state of an OpenGL state machine and the connection between OpenGL and the system.          

The OpenGL state includes everything that can be set with the OpenGL API: colors, rendering variables, display lists, texture objects, etc. Although it is possible to have multiple rendering contexts share display lists in order to save resources, this method is hardly used today any more, because display lists are only a tiny fraction of the overall state. 

Therefore, one rendering context is usually used with or bound to multiple output windows in turn, so that the application has access to the complete and identical state while rendering into each window. 

Binding (making current) a rendering context with another instance of a :ref:`wx.glcanvas.GLCanvas`  however works only if the other :ref:`wx.glcanvas.GLCanvas`  was created with the same attributes as the :ref:`wx.glcanvas.GLCanvas`  from which the :ref:`wx.glcanvas.GLContext`  was initialized. (This applies to sharing display lists among contexts analogously.) 

Note that some :ref:`wx.glcanvas.GLContext`  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. 

``HAS_OPENGL_ES`` is defined on platforms that only have this implementation available (eg the iPhone) und don't support the full specification. 







         



.. seealso:: :ref:`wx.glcanvas.GLCanvas`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>GLContext</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.glcanvas.GLContext_inheritance.png" alt="Inheritance diagram of GLContext" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Object.html" title="wx.Object" alt="" coords="48,5,129,35"/> <area shape="rect" id="node2" href="wx.glcanvas.GLContext.html" title="wx.glcanvas.GLContext" alt="" coords="5,83,173,112"/> </map> 
   </p>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.glcanvas.GLContext.__init__`                                          Constructor.
:meth:`~wx.glcanvas.GLContext.SetCurrent`                                        Makes the OpenGL state that is represented by this rendering context current with the :ref:`wx.glcanvas.GLCanvas`  `win`.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.glcanvas.GLContext(Object)

   **Possible constructors**::

       GLContext(win, other=None)
       
   
   An instance of a GLContext represents the state of an OpenGL state
   machine and the connection between OpenGL and the system.



   .. method:: __init__(self, win, other=None)

      Constructor.                  




      :param `win`: The canvas that is used to initialize this context. This parameter is needed only temporarily, and the caller may do anything with it (e.g. destroy the window) after the constructor returned. 

        It will be possible to bind (make current) this context to any other :ref:`wx.glcanvas.GLCanvas`  that has been created with equivalent attributes as win.   
      :type `win`: wx.glcanvas.GLCanvas
      :param `other`: Context to share display lists with or ``None`` (the default) for no sharing.   
      :type `other`: wx.glcanvas.GLContext






                  





   .. method:: SetCurrent(self, win)

      Makes the OpenGL state that is represented by this rendering context current with the :ref:`wx.glcanvas.GLCanvas`  `win`.                  

                


      :param `win`: 
      :type `win`: wx.glcanvas.GLCanvas




      :rtype: `bool`







      .. note:: 

         `win`  can be a different :ref:`wx.glcanvas.GLCanvas`  window than the one that was passed to the constructor of this rendering context. If ``RC``  is an object of type :ref:`wx.glcanvas.GLContext`, the statements `"RC.SetCurrent(win);"`  and `"win.SetCurrent(RC);"`  are equivalent, see :meth:`wx.glcanvas.GLCanvas.SetCurrent` .