In trying to learn about how to use OpenGL in the wxPython context, I looked for working examples but was disappointed that none of the following examples actually work, perhaps due to subtle changes in wxPython in the last few years:
In the wxPython demo package, in the Miscellaneous section there is an example “GLCanvas” which does work, but it’s not a self-standing program; it’s driven by the demo package framework. I managed to pull out of that framework the critical part and combine it with the GLCanvas example to make a self-standing single file, which I attach. I hope this might be useful to someone else who might start out as confused as I was. Perhaps someone could put it in some permanent place where a new user might be likely to look.
I have a question about the following code in the demo program:
#** Enable this to show putting a GLCanvas on the wx.Panel
if 0:
c = CubeCanvas(self)
c.SetSize((200, 200))
box.Add(c, 0, wx.ALIGN_CENTER|wx.ALL, 15)
Changing to “if 1:” has no effect. I assume that it’s supposed to put the cube in the same window the buttons are in, but this doesn’t happen even if the window is large. I’m definitely interested in the possibility of placing an OpenGL canvas in a window that also has buttons and other elements, so I’m curious about how to do this.
In trying to learn about how to use OpenGL in the wxPython context, I looked for working examples but was disappointed that none of the following examples actually work, perhaps due to subtle changes in wxPython in the last few years:
In the wxPython demo package, in the Miscellaneous section there is an example “GLCanvas” which does work, but it’s not a self-standing program; it’s driven by the demo package framework. I managed to pull out of that framework the critical part and combine it with the GLCanvas example to make a self-standing single file, which I attach. I hope this might be useful to someone else who might start out as confused as I was. Perhaps someone could put it in some permanent place where a new user might be likely to look.
On Mon, Sep 3, 2012 at 7:37 PM, Chris Barker <chris.barker@noaa.gov> wrote:
The ex python wiki is user-editable...hint hint...
Sent from my iPhone
On Sep 2, 2012, at 5:18 PM, Bruce Sherwood <bruce.sherwood@gmail.com> wrote:
In trying to learn about how to use OpenGL in the wxPython context, I looked
for working examples but was disappointed that none of the following
examples actually work, perhaps due to subtle changes in wxPython in the
last few years:
In the wxPython demo package, in the Miscellaneous section there is an
example "GLCanvas" which does work, but it's not a self-standing program;
it's driven by the demo package framework. I managed to pull out of that
framework the critical part and combine it with the GLCanvas example to make
a self-standing single file, which I attach. I hope this might be useful to
someone else who might start out as confused as I was. Perhaps someone could
put it in some permanent place where a new user might be likely to look.
Oops. That wiki page (GLCanvas - wxPyWiki) is not
editable, and it's not clear to me how/where I should/could put my
information.
···
On Mon, Sep 3, 2012 at 10:37 PM, Bruce Sherwood <bruce.sherwood@gmail.com> wrote:
Ah. Okay, I'll contribute. Thanks for the hint.
Bruce Sherwood
On Mon, Sep 3, 2012 at 7:37 PM, Chris Barker <chris.barker@noaa.gov> wrote:
The ex python wiki is user-editable...hint hint...
Sent from my iPhone
On Sep 2, 2012, at 5:18 PM, Bruce Sherwood <bruce.sherwood@gmail.com> wrote:
In trying to learn about how to use OpenGL in the wxPython context, I looked
for working examples but was disappointed that none of the following
examples actually work, perhaps due to subtle changes in wxPython in the
last few years:
In the wxPython demo package, in the Miscellaneous section there is an
example "GLCanvas" which does work, but it's not a self-standing program;
it's driven by the demo package framework. I managed to pull out of that
framework the critical part and combine it with the GLCanvas example to make
a self-standing single file, which I attach. I hope this might be useful to
someone else who might start out as confused as I was. Perhaps someone could
put it in some permanent place where a new user might be likely to look.
Thanks. I've added the working demo program to the wiki.
Just so it doesn't get lost, I repeat my question about placing an
OpenGL canvas in a window that also contains other elements such as
buttons, as that feature of the demo doesn't work.
···
On Mon, Sep 3, 2012 at 11:58 PM, Werner <werner.bruhin@sfr.fr> wrote:
On 04/09/2012 06:41, Bruce Sherwood wrote:
Oops. That wiki page (GLCanvas - wxPyWiki) is not
editable, and it's not clear to me how/where I should/could put my
information.
Click on "Login" top right, create an account and then it is editable.
The GLCanvas is working fine in that example, it's the layout that is not working as expected. If you use the WIT (press F6 when running a demo sample) you can see that the GLCanvas has a size of (1,1). (Look very closely at the window and you can probably see one pixel that is black.) If you change the c.SetSize to c.SetMinSize then the sizer will reserve 200x200 pixels for the canvas and will resize it to that size instead of the default.
···
On 9/4/12 12:23 PM, Bruce Sherwood wrote:
Thanks. I've added the working demo program to the wiki.
Just so it doesn't get lost, I repeat my question about placing an
OpenGL canvas in a window that also contains other elements such as
buttons, as that feature of the demo doesn't work.
I guess that correction should also be made in the official docs-demo package.
···
On Tue, Sep 4, 2012 at 2:32 PM, Robin Dunn <robin@alldunn.com> wrote:
On 9/4/12 12:23 PM, Bruce Sherwood wrote:
Thanks. I've added the working demo program to the wiki.
Just so it doesn't get lost, I repeat my question about placing an
OpenGL canvas in a window that also contains other elements such as
buttons, as that feature of the demo doesn't work.
The GLCanvas is working fine in that example, it's the layout that is not
working as expected. If you use the WIT (press F6 when running a demo
sample) you can see that the GLCanvas has a size of (1,1). (Look very
closely at the window and you can probably see one pixel that is black.) If
you change the c.SetSize to c.SetMinSize then the sizer will reserve 200x200
pixels for the canvas and will resize it to that size instead of the
default.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception