Hello Basil,
First piece of advice, take things one step at a time, it might seem
like a lot but it's all easy once you get through it once.
Also, you seem to be going at this blind. Do you know about OSG's main site?
http://www.openscenegraph.org/projects/osg/
From there, you can follow the Documentation link on the right, and you
can click "Getting Started" to get an intro with Linux/Unix-centric
build instructions, or you can go to "Platform Specifics" and then
"Windows - Visual Studio" to get Windows-specific build instructions.
Here's the direct link:
http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/VisualStudio
1. To start off with, then I go into the folder containing OSG and run:
cmake -DBUILD_OSG_EXAMPLES=1
I am confronted with output to the extent that I am missing LibXml2, CURL,
OpenAL, wxWidgets, Qt3 (I have Qt4 though), JPEG, PNG, and TIFF. Are these
fatal errors and where can I go about getting these libraries (a Google search
for a lot of them proved fruitless)?
This is the CMake command-line tool. You seem to be building for Windows
(from what you say below) so I recommend you use the CMake GUI because
it will give you a list of the available settings you can modify. Until
you know what settings you need to modify, the GUI will be a good tool
to get your bearings.
Next, about those libs it says you're missing. You can get a prebuilt
dependencies package for Visual Studio 2008 here:
http://www.openscenegraph.org/projects/osg/wiki/Downloads/Dependencies
This will take care of the most important dependencies (IMHO the most
important are jpeg, png, gif, etc. to be able to load textures from
images, and freetype to be able to load fonts to display text). But all
in all, most dependencies are entirely optional. OpenAL, CURL,
WxWidgets, Qt, etc fall into that category. If you want to use them, you
can download binaries or build them from source, and then enter the
relevant paths to includes and libraries in the CMake GUI, but until you
know you need a specific dependency, you can assume you don't.
2. Throwing those error messages aside, I opened one of the examples with a Visual
Studio 2008 solution file (osgwidetmessagebox.. chosen completely at random) and
tried to build. It searches for the lib files, but appends a d to them
i.e.<filename>d.lib and, thus, cannot find them in my lib folder as they do not
exist. I manually went into the Linker settings and removed the d and get hit with a
slew of unresolved externals.
Am I missing debug libraries or something, what gives?
If you downloaded the OSG source, you need to compile the whole OSG, not
just an example. Here you're trying to compile an example without having
compiled OSG itself, so of course it won't find the libraries. This is
what I mean when I say to take things one step at a time. You're
skipping whole steps by opening one specific example's project file.
So, one step at a time.
1. Open the CMake GUI
2. Drag and drop the root CMakeLists.txt (in the root of your OSG source
tree) onto the CMake GUI window. This will fill the "where is the
source" and "where to build the binaries" fields, though I recommend you
change the "where to build the binaries" to some other directory so you
don't pollute your source tree. I generally add "/build_x86_vc9" or
something like that to identify which platform/compiler combination I'm
generating project files for.
3. Click Configure a first time. CMake will ask you whether you want to
create the build directory if it doesn't yet exist, then it will ask you
for which platform/compiler you want to generate. I assume you'll want
to select "Visual Studio 9 (2008) (x86)" or something like that.
4. You'll notice the center part of the window will be full of red
fields. First thing to change is to set "ACTUAL_3RDPARTY_DIR" to the
directory where you've put the prebuilt dependencies I linked to above.
Then you can click Configure again, CMake will try to find as many of
the dependencies as it can by itself.
5. At this point you can change settings as you see fit. Make sure you
show Advanced Settings at the top of the CMake window, otherwise some
important settings may be hidden, it's an annoying quirk of CMake. If
CMake didn't find some dependency you know you have, you can fill in its
*_INCLUDE_DIR and *_LIBRARY fields so it will be used. You can check
BUILD_EXAMPLES if you want it to generate project files for all the
examples. Look over the other options you have, but in the end you can
just click Configure until there are no red fields anymore.
I highly recommend you set CMAKE_INSTALL_PREFIX to some directory in
which you want to put your compiled binaries, again separate from your
source and build trees. That way you're sure where the different things
are, and you won't get files mixed up between the 3. The directory you
specify in CMAKE_INSTALL_PREFIX is the one you'll eventually use when
you want to develop an application that uses OSG - it will have an
include, a lib, and a bin subdirectories containing the files you expect.
6. Click Generate. After a few seconds, it will have finished generating
the project files, and you can close the CMake GUI.
7. Open the build directory you specified in "where to build the
binaries" in CMake, and you'll see an "OpenSceneGraph.sln" file.
Double-click that, and you'll see a solution file with a bunch of
projects, first for the OSG libs themselves, and all the examples,
applications, plugins etc. You can then select either Debug or Release,
right-click the INSTALL project and select Build.
That will start building OSG itself, the plugins, the applications and
the examples. Once all that is built, it will copy the relevant files
into the directory you specified in CMAKE_INSTALL_PREFIX.
You can, from that solution, open up one of the examples' source code
and experiment.
3. Also, is there a solid beginner's tutorial? The information on the main
site seems lacking and not much pops up in Google. This is what I am looking
for the most, I reckon.
Chris mentioned the OpenSceneGraph Quick Start Guide, which you can find at
http://www.osgbooks.com/books/osg_qs.html
and is free to download as a PDF. It's a quick read and will give you a
good start. If you want a printed book, you can check out the
OpenSceneGraph Beginner's Guide at
http://www.packtpub.com/openscenegraph-3-0-beginners-guide/book
The OSG web site has some tutorials, but unfortunately I find it's hard
to navigate and some tutorials are out of date. But you should still
have a look as you'll find some good info and explanations. The examples
that come with the source are great for learning, as long as you're
comfortable reading code. :-)
4. Is OSG even the best option here? I am only using it as my project manager
mentioned that other parts of our project were written using it (I am just
working on a utility though) and it might be good for consistency's sake to use
it. If there is a easier-to-use OpenGL toolkit/framework, I have no qualms
with switching.
I think OSG is a good abstraction over OpenGL concepts. If you want a
lightweight framework you could make your own, but among the current
OpenGL-based frameworks I think it's hard to find something better than
OSG. It's a matter of taste though, try it out and see... What do you
expect us to say, you ask this question on a mailing list called
osg-users! :-)
Hope this helps, and if you have any more questions just ask!
J-S
--
______________________________________________________
Jean-Sebastien Guay [email protected]
http://www.cm-labs.com/
http://whitestar02.dyndns-web.com/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org