[osg-users] question about drawing/modifying lines in OpenSceneGraph

Jeremy Moles jeremy at emperorlinux.com
Fri Nov 6 14:25:39 PST 2009


On Fri, 2009-11-06 at 16:19 -0600, Nguyen Tien Dat wrote:
> Dear Jeremy,
> Well, I have a Toshiba Qosmio laptop that has a NVidia GTX 9800 on it.
> I can render a scene at that high resolution at 30fps or more (I'm
> using the laptop with an HMD, so I need two 1280x1024 images for two
> eyes). And yes, frame rate is very important to me.
> Let me play with OpenGL lines for a while to see how that goes, then
> I'll be back :D
> Thanks,
> Dat

Just let me know. :) I enjoy doing small projects like this to see how
stuff performs, and how I can improve the usability of various software
I fiddle with.

> On Fri, Nov 6, 2009 at 4:03 PM, Jeremy Moles <jeremy at emperorlinux.com> wrote:
> > On Fri, 2009-11-06 at 15:59 -0600, Nguyen Tien Dat wrote:
> >> Dear Jeremy,
> >> osgCairo sounds very interesting. Is that a new component of OSG. I
> >> don't see it in my OSG 2.8.2 folder.
> >
> > It's just a hobby project I work.
> >
> >> One more question, that if you draw a large transparent image with
> >> size 2560x1024, does it affect your frame rate?
> >> Thanks,
> >
> > Technically, in this case, you'd use a Canvas object, which is a group
> > of smaller osg::Texture2D objects arranged to "simulate" one big large
> > texture (although you could use a single 2560x1024 image if you wanted,
> > though I don't know if many cards support that).
> >
> > At any rate, yes, it would affect your framerate. :) How much I cannot
> > say, it depends really on what you need. I guess the question you have
> > to ask is do you need maximum performance (in which case stick to using
> > regular GL lines, which you may be able to turn anti-aliasing on somehow
> > to make them look good) or do you need maximum quality...
> >
> > Just an idea.
> >
> >> Dat
> >>
> >> On Fri, Nov 6, 2009 at 3:52 PM, Jeremy Moles <jeremy at emperorlinux.com> wrote:
> >> > On Fri, 2009-11-06 at 15:39 -0600, Nguyen Tien Dat wrote:
> >> >> Dear all,
> >> >> I use the line as a tool to select an object in the scene. I want to
> >> >> implement a kind of "laser pointer" in which user controls the
> >> >> direction of the line by a Wiimote. So the line must be visible to
> >> >> user, and I don't think the one I have now is good enough. I'll change
> >> >> the color and the width to see how it works.
> >> >> Thank all,
> >> >> Dat
> >> >
> >> > Well, if you need high quality vector lines, I would be able to help you
> >> > do that using osgCairo. Basically, what you'd do is use osgCairo to draw
> >> > a number of large, completely transparent images tiled over your scene
> >> > (a grid of 256x256 or 512x512 or whatever).
> >> >
> >> > Then, as you determine the 3D coordinates your lines exist in, you can
> >> > flatten those coordinates into 2D, pass them to cairo, osgCairo will
> >> > updated the textures as you drawn, and in the end you get some very
> >> > nice, high-quality vector lines in whatever style and color you want.
> >> >
> >> > I only mention this because it would be fun to do. :)
> >> >
> >> >> On Fri, Nov 6, 2009 at 2:27 PM, Jeremy Moles <jeremy at emperorlinux.com> wrote:
> >> >> > On Fri, 2009-11-06 at 20:25 +0000, Kim Bale wrote:
> >> >> >> Haha, I had a feeling you'd jump in ;)
> >> >> >>
> >> >> >> K.
> >> >> >
> >> >> > Haha, I'm sorry. :) I'm not trying to be annoying, I'm just trying to
> >> >> > get new ideas for the ways people use stuff and what kinds of things I
> >> >> > may be forgetting are important to people. No advertising here, just
> >> >> > leeching infos!!!
> >> >> >
> >> >> >> 2009/11/6 Jeremy Moles <jeremy at emperorlinux.com>:
> >> >> >> > On Fri, 2009-11-06 at 14:12 -0600, Nguyen Tien Dat wrote:
> >> >> >> >> Dear all,
> >> >> >> >> I draw a line as following:
> >> >> >> >>
> >> >> >> >>         osg::Geometry* geo = new osg::Geometry();
> >> >> >> >>       // define some vertices
> >> >> >> >>       osg::Vec3Array* v = new osg::Vec3Array;
> >> >> >> >>       v->push_back(start);
> >> >> >> >>       v->push_back(end);
> >> >> >> >>
> >> >> >> >>       // draw lines
> >> >> >> >>       geo->setVertexArray(v);
> >> >> >> >>
> >> >> >> >>       geo->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, 2, 1));
> >> >> >> >>
> >> >> >> >>       geode->addDrawable(geo);
> >> >> >> >>
> >> >> >> >> But the line is hardly to be seen because it's too thin and has white
> >> >> >> >> color. So my question is:
> >> >> >> >> - Can I change the color of the line? If yes, please tell me how.
> >> >> >> >> - Can I change the thickness of the line? If yes, pleas tell me how.
> >> >> >> >
> >> >> >> > Out of curiosity, what are you using the line drawing for? And how
> >> >> >> > high-quality must the lines be? :)
> >> >> >> >
> >> >> >> >> Thanks,
> >> >> >> >> Dat
> >> >> >> >> _______________________________________________
> >> >> >> >> osg-users mailing list
> >> >> >> >> osg-users at lists.openscenegraph.org
> >> >> >> >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >> >> >> >>
> >> >> >> > --
> >> >> >> > Follow us on Twitter! http://twitter.com/emperorlinux
> >> >> >> >
> >> >> >> > EmperorLinux, Inc.
> >> >> >> > http://www.emperorlinux.com
> >> >> >> > 1-888-651-6686
> >> >> >> >
> >> >> >> > _______________________________________________
> >> >> >> > osg-users mailing list
> >> >> >> > osg-users at lists.openscenegraph.org
> >> >> >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >> >> >> >
> >> >> >> _______________________________________________
> >> >> >> osg-users mailing list
> >> >> >> osg-users at lists.openscenegraph.org
> >> >> >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >> >> >>
> >> >> > --
> >> >> > Follow us on Twitter! http://twitter.com/emperorlinux
> >> >> >
> >> >> > EmperorLinux, Inc.
> >> >> > http://www.emperorlinux.com
> >> >> > 1-888-651-6686
> >> >> >
> >> >> > _______________________________________________
> >> >> > osg-users mailing list
> >> >> > osg-users at lists.openscenegraph.org
> >> >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >> >> >
> >> >> _______________________________________________
> >> >> osg-users mailing list
> >> >> osg-users at lists.openscenegraph.org
> >> >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >> >>
> >> > --
> >> > Follow us on Twitter! http://twitter.com/emperorlinux
> >> >
> >> > EmperorLinux, Inc.
> >> > http://www.emperorlinux.com
> >> > 1-888-651-6686
> >> >
> >> > _______________________________________________
> >> > osg-users mailing list
> >> > osg-users at lists.openscenegraph.org
> >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >> >
> >>
> >>
> >>
> > --
> > Follow us on Twitter! http://twitter.com/emperorlinux
> >
> > EmperorLinux, Inc.
> > http://www.emperorlinux.com
> > 1-888-651-6686
> >
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> 
> 
> 
-- 
Follow us on Twitter! http://twitter.com/emperorlinux

EmperorLinux, Inc.
http://www.emperorlinux.com
1-888-651-6686



More information about the osg-users mailing list