A Couple of questions on OGL Lineshapes
Javier Cámara Moreno
jcamara at lcc.uma.es
Fri Jul 13 07:53:58 PDT 2007
crjjrc escribió:
> On Jul 13, 5:19 am, jcam... at lcc.uma.es (Javier Cámara Moreno) wrote:
>
>
>> I am developing a little graph editor using python 2.5 and wx 2.8.
>> Whenever I try to add text to a line shape I get a big rectangle on the
>> background which covers the shapes. Is there a way to render the text on
>> a transparent background?
>>
>
> I think you're probably better of asking these questions in an OpenGL
> forum, like comp.graphics.api.opengl.
>
>
First of all, thank you very much for your interest, Chris. I didn't
mean OpenGL, maybe I should have specified the whole name. I was
referring to the OGL (Object Graphics Library), provided with wx
(wx.lib.ogl). The problem is specifically located in the LineShape
class. When I try to add text I always get a background rectangle
associated to the region of the line shape. I've seen several posts in
forums describing the same problem (i.e., drawing the text on a
transparent background) but haven't found any answers. I don't know if
it is a bug or maybe there is a workaround to make that background
transparent. Check out the following code snippet:
...
line = ogl.LineShape()
line.AddText('I want this text to be drawn on a
transparent background')
line.AddArrow(ogl.ARROW_ARROW,1,8,0.0,'',None,-1)
line.SetBrush(wx.BLACK_BRUSH)
line.MakeLineControlPoints(2)
source.AddLine(line, target)
self.canvas.AddShape(line)
...
If there is anybody out there experienced with OGL, I'd appreciate very
much a hint with this. Unfortunately, there isn't much documentation
about the library, nor code samples to learn from (regarding this
particular problem) available.
- Javier
> For bitmap or textured fonts, you're going to need to implement some
> blending and masking operations to get what you want, unless your
> images have alpha defined appropriately and you can use the alpha
> test. Check out nehe.gamedev.net, lesson 20, for how to use masking
> and blending. Or you can use vector fonts which are drawn using
> geometric primitives to construct each letter.
>
>
>> The second thing is: If I am drawing a lineshape as an spline, control
>> points are fixed. Is there a way to update the position of this control
>> points when I move the shapes which are connected to the line?
>>
>
> You provide the control points to build the spline. Why not just
> provide the new control points to rebuild the spline?
>
> - Chris
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>
>
More information about the wx-users
mailing list