My preference would indeed be to do what I've done in GlowScript -- display
text in a 2D overlay in front of a 3D canvas, as this seems by far the
simplest scheme, since it doesn't involve creating a texture. But I'm
bewildered by what looks like so many different ways to try to do this in
the wxPython context that I don't know how to start.
I think the wx.Overlay is a red herring in this case -- sorry about that.
I haven't really refreshed my memory of OpenGL and wx, but...
Somewhere, you should be asking OpenGL to draw -- maybe a
SwapBuffers() call? This should happen in a PaintEvent, but also, a
presume, at other time,s like maybe a a result of a timer going off,
etc.
After GL draws, you want to try to draw on top of it:
maybe the most robust but deprecated way:
Use a wx.ClientDC:
def AfterGL_Render(self):
dc = wx.ClientDC(self)
Font = wx.FontFromPixelSize(14, wx.SWISS, wx.NORMAL, wx.NORMAL)
dc.SetFont(Font)
dc.DrawText('This is some sample text', x, y)
In modern practice, it's considered a "bad idea" to use a ClientDC --
it can interupt the systems draw order, and slow things down. What is
better is to do all drawing in a Paint Event, using a wx.PaintDC.
In that case, you put your call to tell GL to draw in the PaintDC,
then call a funcition like the above, but passing the PaintDC for it
to draw to.
If you want a refresh outside or a system PaintEvent, you call:
self.Refresh()
self.UPdate()
which triggers a Paint event.
But I'd try the ClientDC method first, as it should be easy to plug
into your code.
Good luck,
-Chris
···
On Mon, Nov 19, 2012 at 3:33 PM, Bruce Sherwood <bruce.sherwood@gmail.com> wrote:
On Mon, Nov 19, 2012 at 3:37 PM, Chris Barker - NOAA Federal > <chris.barker@noaa.gov> wrote:
> the case of GlowScript (glowscript.org), I do use a 2D overlay in front
> of
> the WebGL 3D canvas for the labels.
can you use exactly the same approach?
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
--
Christopher Barker, Ph.D.
Oceanographer
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
Chris.Barker@noaa.gov