Hello Frank,

I think that it's probably due to the fact that I'm fairly new at this whole game.

If you're new to graphics programming (that wasn't clear from your previous messages, I thought you were just new to OSG but had some background knowledge of graphics programming) I highly recommend you get a few good real-time graphics / OpenGL books to get the basics of graphics programming. Good examples I'd recommend are Real-Time Rendering by Tomas Akenine-Möller and Eric Haines (more general, touches a very large number of subjects, great references to follow up if you need more info about specific subjects), and OpenGL Distilled by our very own Paul Martz (more focused on programming with OpenGL, which is the graphics API that OSG abstracts).

But I think that last word is key. Abstraction. You don't need to understand how OSG works to use it. You can understand the general flow, the concepts (which those books will explain) but I doubt many people are intimate with 100% of OSG's code. Go slow, start small and you'll be fine.

Now for your specific questions:

Why, for instance, is there a GraphicsWindow and a GraphicsContext?

An OpenGL context is a general OpenGL concept which you'll learn about in an OpenGL book. Basically, OpenGL renders to what it calls a graphics context, so you need one. The context will in general be attached to a window, but it knows nothing of the window itself. The GraphicsContext class wraps an OpenGL context.

A GraphicsWindow is a derived class from GraphicsContext, and provides windowing specific behavior in addition to an OpenGL context. So for example, when you make a WX canvas, it's a subclass of GraphicsWindow because it provides the WX-specific windowing behavior, and an OpenGL context in which to render.

What does the Viewer do and why do I need to call setGraphicsContext?

The viewer, as its name implies, is what allows you to view your scene / game / simulation. It does a lot of things, like have an update loop that allows the graphics to update, receives and dispatches events (keyboard, mouse etc.), and so on. In your case, for osgviewerWX, you need to call setGraphicsContext because by default the viewer will create a graphics context which knows nothing about WX. So in order for it to use your subclass of GraphicsContext (the WX-specific one in the example) you have to give it (a pointer to it) to the viewer.

In short, again, I would like to know the theory, the design principles, etc. Is there such documentation available?

In general, no. Apart from the Quick Start Guide and the Reference Guide (written by Paul Martz and Bob Kuehne), there is little in way of formal documentation for OSG.

But as I said, I don't think you need to go as in-depth as that. The general concepts of graphics programming will be invaluable however, and you can read those in the books I suggested above. This is of course just a recommendation, if you want to go really in-depth go ahead, but the source code will be your guide in that case.

To recap, the background information you probably want is:

* What is OpenGL, what does it do in general, what does it not do.
* What is a scene graph, what capabilities does it offer in general (OSG is an implementation of a scene graph), what are the advantages of using a scene graph (why do we use one?).
* What are the basic features of OSG and how to use them.

These are things that the books above, and the OSG Quick Start Guide, will help you with.

Once you have that info, you'll better understand what you need to do to accomplish your goals, even if you don't know every little detail of the implementation. We can then help you with specific questions (as you've seen above).

In the meanwhile I've been able to get things working. Not in the way I would like everything to work, but I at least have a working canvas for OSG to render on.

That's great, good to know you're getting some progress. If you hit another snag, you can always post another question.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [EMAIL PROTECTED]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to