Re: [osg-users] Drawing to Texture2D

2008-07-14 Thread Jeremy Moles
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 [EMAIL PROTECTED]:
 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[EMAIL PROTECTED]
   http://www.cm-labs.com/
http://whitestar02.webhop.org/ 
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 
 
 -- 
 James Dickson 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
attachment: Screenshot-Untitled Window.png___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Drawing to Texture2D

2008-07-13 Thread Peter Wraae Marino
Hi James,

I believe you have to:

texture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);

texture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);
-- 
Regards,
Peter Wraae Marino

www.osghelp.com - OpenSceneGraph support site


On Sat, Jul 12, 2008 at 11:29 PM, James Dickson [EMAIL PROTECTED]
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 [EMAIL PROTECTED]:

 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[EMAIL PROTECTED]
   http://www.cm-labs.com/
http://whitestar02.webhop.org/

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




 --
 James Dickson
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
Regards,
Peter Wraae Marino

www.osghelp.com - OpenSceneGraph support site
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Drawing to Texture2D

2008-07-12 Thread James Dickson
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 [EMAIL PROTECTED]:

 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[EMAIL PROTECTED]
   http://www.cm-labs.com/
http://whitestar02.webhop.org/

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
James Dickson
attachment: test.JPG___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Drawing to Texture2D

2008-07-11 Thread Robert Osfield
Hi James,

Perhaps a Render To Texture Camera is what you are look for.  Have a
look at the osgprerender example.

Robert.

On Fri, Jul 11, 2008 at 3:20 PM, James Dickson [EMAIL PROTECTED] wrote:
 Hi,

 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);

 Or would I have to find an API which can create images and saves to say
 JPEGs then load them as Texture2D instances?

 Thanks,
 James
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Drawing to Texture2D

2008-07-11 Thread Jean-Sébastien Guay

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[EMAIL PROTECTED]
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Drawing to Texture2D

2008-07-11 Thread James Dickson
Many thanks, that seems to be exactly what I am looking for.

2008/7/11 Robert Osfield [EMAIL PROTECTED]:

 Hi James,

 Perhaps a Render To Texture Camera is what you are look for.  Have a
 look at the osgprerender example.

 Robert.

 On Fri, Jul 11, 2008 at 3:20 PM, James Dickson [EMAIL PROTECTED]
 wrote:
  Hi,
 
  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);
 
  Or would I have to find an API which can create images and saves to say
  JPEGs then load them as Texture2D instances?
 
  Thanks,
  James
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




-- 
James Dickson
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org