Should I use SceneGraphs and how?

Jun 8, 2012 at 3:53 AM
Edited Jun 9, 2012 at 2:38 PM

Forgive me if this question is too basic or general; I'm new to both OpenGL and SharpGL, but so far I'm really liking this implementation of OpenGL for c#!

In my project, I'm creating a 2D scene (using a orthographic projection) on which I'll be displaying a variety of symbols (starting out with simple points but eventually I will use various primitive shapes) that indicate various 2D coordinates of objects in my data (pretty generic so far, I know).  At times I could be dealing with more than 100,000 symbols at once (grouped into "tracks" with lines drawn between symbols that make up a given track).

FYI, I've prototyped a basic display using an OpenGLControl, created a few hundred-thousand points (grouped by the 100s into "tracks" with lines between them), and implemented a pan/zoom capability that allows the user to zoom into the mouse location (or center of the screen)--all working pretty well.

ONE other piece of info before my question: when I start using symbols, I'll need them each to maintain their size (in pixels, if you will) when the user zooms in on the scene.  Their relative positions will change to reflect the zooming, but not their actual size.  I haven't tried it yet, but I THINK I can do this with the right combination of pushing and popping the ModelView matrix on either side of rendering the symbols--maybe?

Oh, AND I'll need to do hit-testing against the symbols and connecting lines for user interaction.

OKAY, so HERE's my really open question: While there are potentially many ways to approach this project, would using SceneGraphs (Primitives) be a smart way to go?  Okay, so what does that mean?  Well, if I'm dealing with lots of symbols (10,000 to, say, 500,000), needing hit tests, and needing each symbol to keep itself sized independent of zooming, will SceneGraph.Primitives handle all that pretty well (from a performance and ease-of-coding perspective)?  OR should I just design objects that can capture "redraw" events and render themselves to an OpenGLControl using standard (SharpGL-wrapped) OpenGL calls?

Finally, I'd REALLY appreciate it if someone could give me a quick example of scaling a ModelView but adding, say, a polygon that doesn't scale its size (only it's "origin" position) to match.  How would you do this both with standard OpenGL calls and with SceneGraph.Primitives?

Have I made enough sense?  I'm just trying to find the right trail to start running down so that I don't stop a week later and realize, "wait, I could have done it THAT way?"

Thanks in advance for any advice (and given the rambling nature of my question--LOTS of thanks!)

Jun 22, 2012 at 7:29 AM

Apologies for the very late replay, I have moved countries for work so have been extremely busy!

OK, in answer to your questions:

 While there are potentially many ways to approach this project, would using SceneGraphs (Primitives) be a smart way to go?

Yes, the overhead in maintaining a C# object to represent your points will not be serious in the case of a few 100s of 1000s of points, but you will get the added benefit of hit testing etcf. Even if you find the pure polygon implementation unsuitable you can write your own heavily optimised Scene Element class.

2. Scaling the MiodelView but keeping polygon size invarient

This is a bit more of a tricky one - rather than going into the maths at the moment can you explain the situation that leads to this? It may be possible that there's a way to avoid the problem earlier on :)