Re: [osg-users] Infinite Grid in OSG

2009-08-10 Thread Andrew Thompson
Hi Chris, Thanks for the heads up, I was digging around and found the drawImplementation method in Drawable myself so decided to give it a go. However I've had less than spectacular results! My first test was to take the code from ShapeDrawable that draws a box. Here it is for completeness

Re: [osg-users] Infinite Grid in OSG

2009-08-10 Thread Simon Hammett
The clipping you are seeing is probably due to osg's computation of the near and far clipping planes. You'll need to implement computeBound so osg knows about your object. Have a look in ShapeDrawable.cpp 2009/8/10 Andrew Thompson andyb1...@yahoo.co.uk: Hi Chris, Thanks for the heads up, I was

Re: [osg-users] Infinite Grid in OSG

2009-08-10 Thread Andrew Thompson
Hi, Well, that was simple Code: virtual osg::BoundingBox computeBound() const { osg::BoundingBox bbox; // Compute the min/max X and Y values for the grid float miny = (m_posY-(m_vHeight/2*m_zoom)); float maxy = (m_posY+(m_vHeight/2*m_zoom)); float minx =

[osg-users] Infinite Grid in OSG

2009-08-07 Thread Andrew Thompson
Hi there, A simple question, would anyone know how I could implement an infinite grid in OSG? This is an image showing what I am trying to achieve. [Image: http://i137.photobucket.com/albums/q217/andyb1979/InfiniteGrid.png ] Ideally as the user zooms in/out I would like the grid to

Re: [osg-users] Infinite Grid in OSG

2009-08-07 Thread Andrew Thompson
Edit: Perhaps another way of asking this question - I know how to render my grid using OpenGL calls, I would basically use glBegin(GL_LINES) / glEnd and draw the lines at the appropriate spacing and thickness. So the question is - is there a way to directly push something onto the GL

Re: [osg-users] Infinite Grid in OSG

2009-08-07 Thread Brian R Hill
wrote: - To: osg-users@lists.openscenegraph.org From: Andrew Thompson andyb1...@yahoo.co.uk Sent by: osg-users-boun...@lists.openscenegraph.org Date: 08/07/2009 09:42AM Subject: [osg-users] Infinite Grid in OSG Hi there, A simple question, would anyone know how I could implement an infinite

Re: [osg-users] Infinite Grid in OSG

2009-08-07 Thread Andrew Thompson
Ok, so I could use a HUD and attach behind my scene - clever, I like it :-) Now the question is, how do I get access to just glBegin/glEnd? I was thinking of creating a class that inherits ShapeDrawable and just rendering my lines (I have found some legacy code that calculates the lines and

Re: [osg-users] Infinite Grid in OSG

2009-08-07 Thread Brian R Hill
...@lists.openscenegraph.org wrote: - To: osg-users@lists.openscenegraph.org From: Andrew Thompson andyb1...@yahoo.co.uk Sent by: osg-users-boun...@lists.openscenegraph.org Date: 08/07/2009 10:57AM Subject: Re: [osg-users] Infinite Grid in OSG Ok, so I could use a HUD and attach behind my scene - clever, I

Re: [osg-users] Infinite Grid in OSG

2009-08-07 Thread Andrew Thompson
Ok, wise advise, just since this is a grid (Rendered once) per frame, I will need to resize the grid lines/thicknesses/spacing on every frame (as I zoom/pan my scene). I guess I have enough to go digging now though, certainly you've given me some good ideas, Thank you, Andrew

Re: [osg-users] Infinite Grid in OSG

2009-08-07 Thread Chris 'Xenon' Hanson
Brian R Hill wrote: Andrew, You could implement it as an ortho projection (look at HUD examples) and draw text and lines as geometry based on current scale and position. You can create a custom drawable that does anything at all you want when its code is called. Brian -- Chris 'Xenon'