[osg-users] Drawing to Texture2D

Jeremy Moles jeremy at emperorlinux.com
Mon Jul 14 11:07:57 PDT 2008


With libraries like Cairo available, I'm not sure why you'd need to
write your own. I've written a "glue" module for Cairo/OSG which lets
you use a vector graphics API on a Texture2D "canvas." 

For example, the attached image was rendered using Cairo on a small
texture (256x256). No image files were loaded or anything like that...

http://osgcairo.googlecode.com

It's not feature-complete or anything like that, but it demonstrates the
concept.

On Sat, 2008-07-12 at 22:29 +0100, James Dickson wrote:
> I decided to go down the route of writting my own line, circle etc
> algorithms as I only need a few, but I have hit a slight snag. :-( I
> have attached an image to show the effect I am getting, ideally I
> would like the Texture2D which is projected onto the billboard to be
> sharper? I.e the lines drawn on the white billboard not to
> have blurred edges. The texture resolution is 256x256, and increasing
> it only partially helps, are there any filters I can turn on\off for
> the texture to help fix it?
>  
> Many thanks,
> James
> 
> 
> 2008/7/11 Jean-Sébastien Guay <jean-sebastien.guay at cm-labs.com>:
>         Hi James, 
>         
>         
>                 I was wondering if it is possible to draw on a
>                 Texture2D instance. I know this isn't possible, but I
>                 am wondering if you can do the equivalent of:
>                 Texture2Dinstance->DrawCircle(x,y,r);
>         
>         
>         OSG does not do 2D drawing to images. You can do your own by
>         getting the data pointer from an osg::Image and drawing pixels
>         into that (if you feel the need to write your own line,
>         circle, flood-filling etc. algorithms :-) ), or you can use an
>         imaging library (ImageMagick, etc.) to make the image and then
>         get the data from that library and copy it into an osg::Image
>         (or perhaps even use the same pointer if it's a raw format).
>         No need to save the image to disk and re-read it with OSG.
>         
>         Hope this helps,
>         
>         J-S
>         -- 
>         ______________________________________________________
>         Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
>                                       http://www.cm-labs.com/
>                                http://whitestar02.webhop.org/ 
>         
>         
>         _______________________________________________
>         osg-users mailing list
>         osg-users at lists.openscenegraph.org
>         http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>         
> 
> 
> 
> -- 
> James Dickson 
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot-Untitled Window.png
Type: image/png
Size: 26205 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080714/4c3aadfb/attachment-0003.png>


More information about the osg-users mailing list