Author Topic: OpenSceneGraph (+ SDL)  (Read 9957 times)

mjpm

  • Guest
OpenSceneGraph (+ SDL)
« on: November 13, 2006, 05:58:53 pm »
Hello,

I'm trying to get OpenSceneGraph (http://www.openscenegraph.org/) to work with CB.
I set the include and lib paths in CB but I get many errors when trying to compile one of the examples.



Like this:

Code: cpp
Compiling: C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.cpp
Linking console executable: C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.exe
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x33d): undefined reference to `_imp___ZN8Producer13RenderSurfaceC1Ev'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x3f4): undefined reference to `_imp___ZN8Producer13RenderSurface13setWindowNameERKSs'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x4b6): undefined reference to `_imp___ZN8Producer13RenderSurface18setWindowRectangleEiijjb'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x4d3): undefined reference to `_imp___ZN8Producer13RenderSurface9useBorderEb'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x4f8): undefined reference to `_imp___ZN8Producer13RenderSurface7realizeEPNS_13VisualChooserEP7HGLRC__'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x522): undefined reference to `_imp___ZN7osgUtil9SceneViewC1EPN3osg15DisplaySettingsE'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x59f): undefined reference to `_imp___ZN7osgUtil9SceneView11setDefaultsEj'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x5cf): undefined reference to `_imp___ZN7osgUtil9SceneView12setSceneDataEPN3osg4NodeE'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x71c): undefined reference to `_imp___ZN3osg7Matrixd10makeLookAtERKNS_5Vec3dES3_S3_'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x72d): undefined reference to `_imp___ZN3osg5Timer8instanceEv'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x737): undefined reference to `_imp___ZNK3osg5Timer4tickEv'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x76c): undefined reference to `_imp___ZNK8Producer13RenderSurface10isRealizedEv'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x796): undefined reference to `_imp___ZN3osg10FrameStampC1Ev'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x7f3): undefined reference to `_imp___ZN3osg5Timer8instanceEv'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x807): undefined reference to `_imp___ZNK3osg5Timer4tickEv'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x81a): undefined reference to `_imp___ZN3osg5Timer8instanceEv'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x8d7): undefined reference to `_imp___ZNK8Producer13RenderSurface15getWindowHeightEv'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text+0x8f2): undefined reference to `_imp___ZNK8Producer13RenderSurface14getWindowWidthEv'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZN3osg10CameraNode13setViewMatrixERKNS_7MatrixdE[osg::CameraNode::setViewMatrix(osg::Matrixd const&)]+0x24): undefined reference to `_imp___ZN3osg4Node10dirtyBoundEv'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZN7osgUtil9SceneView11setViewportEiiii[osgUtil::SceneView::setViewport(int, int, int, int)]+0x38): undefined reference to `_imp___ZN3osg10CameraNode11setViewportEiiii'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZN3osg7MatrixdC1Ev[osg::Matrixd::Matrixd()]+0xd): undefined reference to `_imp___ZN3osg7Matrixd12makeIdentityEv'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZNK3osg4Node8getBoundEv[osg::Node::getBound() const]+0x86): undefined reference to `_imp___ZN3osg14BoundingSphere8expandByERKS0_'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZNK3osg4Node8getBoundEv[osg::Node::getBound() const]+0xbb): undefined reference to `_imp___ZN3osg14BoundingSphere8expandByERKS0_'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZN5osgDB12readNodeFileERKSs[osgDB::readNodeFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0xe): undefined reference to `_imp___ZN5osgDB8Registry8instanceEb'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZN5osgDB12readNodeFileERKSs[osgDB::readNodeFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x27): undefined reference to `_imp___ZN5osgDB12readNodeFileERKSsPKNS_12ReaderWriter7OptionsE'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZNK3osg10Referenced5unrefEv[osg::Referenced::unref() const]+0x62): undefined reference to `_imp___ZN3osg10Referenced16getDeleteHandlerEv'
C:\Program Files\OpenSceneGraph\osgsrc\OpenSceneGraph\examples\osgsimple\osgsimple.o:osgsimple.cpp:(.text$_ZNK3osg10Referenced5unrefEv[osg::Referenced::unref() const]+0x6d): undefined reference to `_imp___ZN3osg10Referenced16getDeleteHandlerEv'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 5 seconds)
0 errors, 0 warnings

Maybe someone has worked with OSG and CB in combination and can give me a hint?!

As a second part of this question, has anyone worked with SDL and OSG in combination?
I wanted to use SDL for window handling and maybe event handling.


Regards,

Marcel

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: OpenSceneGraph (+ SDL)
« Reply #1 on: November 13, 2006, 06:16:42 pm »
It looks like it isn't actually finding any of the libraries.  Have you added the OSG libraries to the linker(not just the path?).

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: OpenSceneGraph (+ SDL)
« Reply #2 on: November 13, 2006, 06:21:17 pm »
Please repeat the log having enabled the *full* compiler log (see my sig).
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

mjpm

  • Guest
Re: OpenSceneGraph (+ SDL)
« Reply #3 on: November 14, 2006, 12:29:25 am »
Hello,

I found two files for the example

Code: cpp
// C++ source file - (C) 2003 Robert Osfield, released under the OSGPL.
//
// Simple example of use of Producer::RenderSurface to create an OpenGL
// graphics window, and OSG for rendering.

#include <Producer/RenderSurface>
#include <osg/Timer>
#include <osgUtil/SceneView>
#include <osgDB/ReadFile>


int main( int argc, char **argv )
{
    if (argc<2)
    {
        std::cout << argv[0] <<": requires filename argument." << std::endl;
        return 1;
    }

    // load the scene.
    osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile(argv[1]);
    if (!loadedModel)
    {
        std::cout << argv[0] <<": No data loaded." << std::endl;
        return 1;
    }

    // create the window to draw to.
    osg::ref_ptr<Producer::RenderSurface> renderSurface = new Producer::RenderSurface;
    renderSurface->setWindowName("osgsimple");
    renderSurface->setWindowRectangle(100,100,800,600);
    renderSurface->useBorder(true);
    renderSurface->realize();

    // create the view of the scene.
    osg::ref_ptr<osgUtil::SceneView> sceneView = new osgUtil::SceneView;
    sceneView->setDefaults();
    sceneView->setSceneData(loadedModel.get());

    // initialize the view to look at the center of the scene graph
    const osg::BoundingSphere& bs = loadedModel->getBound();
    osg::Matrix viewMatrix;
    viewMatrix.makeLookAt(bs.center()-osg::Vec3(0.0,2.0f*bs.radius(),0.0),bs.center(),osg::Vec3(0.0f,0.0f,1.0f));

    // record the timer tick at the start of rendering.
    osg::Timer_t start_tick = osg::Timer::instance()->tick();

    unsigned int frameNum = 0;

    // main loop (note, window toolkits which take control over the main loop will require a window redraw callback containing the code below.)
    while( renderSurface->isRealized() )
    {
        // set up the frame stamp for current frame to record the current time and frame number so that animtion code can advance correctly
        osg::ref_ptr<osg::FrameStamp> frameStamp = new osg::FrameStamp;
        frameStamp->setReferenceTime(osg::Timer::instance()->delta_s(start_tick,osg::Timer::instance()->tick()));
        frameStamp->setFrameNumber(frameNum++);

        // pass frame stamp to the SceneView so that the update, cull and draw traversals all use the same FrameStamp
        sceneView->setFrameStamp(frameStamp.get());

        // update the viewport dimensions, incase the window has been resized.
        sceneView->setViewport(0,0,renderSurface->getWindowWidth(),renderSurface->getWindowHeight());

        // set the view
        sceneView->setViewMatrix(viewMatrix);

        // do the update traversal the scene graph - such as updating animations
        sceneView->update();

        // do the cull traversal, collect all objects in the view frustum into a sorted set of rendering bins
        sceneView->cull();

        // draw the rendering bins.
        sceneView->draw();

        // Swap Buffers
        renderSurface->swapBuffers();
    }

    return 0;
}


which are

GNUmakefile.inst
Code
TOPDIR = ../..
include $(TOPDIR)/Make/makedefs

CXXFILES =\
osgsimple.cpp\

LIBS     += -lProducer -losgDB --losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS)

EXEC = osgsimple

INC += $(PRODUCER_INCLUDE_DIR) $(X_INC)
LDFLAGS  += $(PRODUCER_LIB_DIR)

include $(TOPDIR)/Make/makerules


and

GNUmakefile
Code
TOPDIR = ../..
include $(TOPDIR)/Make/makedefs

CXXFILES =\
osgsimple.cpp\

LIBS     += -lProducer -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) -lOpenThreads

INSTFILES = \
$(CXXFILES)\
GNUmakefile.inst=GNUmakefile

EXEC = osgsimple

INC      += $(X_INC)
LDFLAGS  += -L/usr/X11R6/lib


ifeq ($(USE_OPEN_THREAD),1)
    DEF         += -D_USE_OPEN_THREAD
    INC         += $(INC_OPEN_THREAD)
    LDFLAGS     += $(LIB_OPEN_THREAD)
    LIBS        +=  -lOpenThread
endif

include $(TOPDIR)/Make/makerules



So I added Producer.lib, osgDB.lib, osgUtil.lib, osg.lib and OpenThreadsWin32.lib to Settings -> Compiler and debugger -> Linker -> Link libraries without success.

Code
mingw32-g++.exe -Wall -g  -I"C:\Program Files\MinGW\include" -I"C:\Program Files\SDL\include" -I"C:\Program Files\OpenSceneGraph\include"  -c "C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.cpp" -o "C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.o"
mingw32-g++.exe -L"C:\Program Files\MinGW\lib" -L"C:\Program Files\SDL\lib" -L"C:\Program Files\OpenSceneGraph\lib"  -o "C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.exe" "C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.o"   "C:\Program Files\OpenSceneGraph\lib\osgUtil.lib" "C:\Program Files\OpenSceneGraph\lib\Producer.lib" "C:\Program Files\OpenSceneGraph\lib\OpenThreadsWin32.lib" "C:\Program Files\OpenSceneGraph\lib\osg.lib" "C:\Program Files\OpenSceneGraph\lib\osgDB.lib"
C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.o: In function `main':
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:29: undefined reference to `_imp___ZN8Producer13RenderSurfaceC1Ev'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:30: undefined reference to `_imp___ZN8Producer13RenderSurface13setWindowNameERKSs'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:31: undefined reference to `_imp___ZN8Producer13RenderSurface18setWindowRectangleEiijjb'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:32: undefined reference to `_imp___ZN8Producer13RenderSurface9useBorderEb'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:33: undefined reference to `_imp___ZN8Producer13RenderSurface7realizeEPNS_13VisualChooserEP7HGLRC__'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:36: undefined reference to `_imp___ZN7osgUtil9SceneViewC1EPN3osg15DisplaySettingsE'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:37: undefined reference to `_imp___ZN7osgUtil9SceneView11setDefaultsEj'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:38: undefined reference to `_imp___ZN7osgUtil9SceneView12setSceneDataEPN3osg4NodeE'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:43: undefined reference to `_imp___ZN3osg7Matrixd10makeLookAtERKNS_5Vec3dES3_S3_'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:46: undefined reference to `_imp___ZN3osg5Timer8instanceEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:46: undefined reference to `_imp___ZNK3osg5Timer4tickEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:51: undefined reference to `_imp___ZNK8Producer13RenderSurface10isRealizedEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:54: undefined reference to `_imp___ZN3osg10FrameStampC1Ev'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:55: undefined reference to `_imp___ZN3osg5Timer8instanceEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:55: undefined reference to `_imp___ZNK3osg5Timer4tickEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:55: undefined reference to `_imp___ZN3osg5Timer8instanceEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:62: undefined reference to `_imp___ZNK8Producer13RenderSurface15getWindowHeightEv'
C:/Documents and Settings/mjpm/My Documents/coding/osgsimple/osgsimple.cpp:62: undefined reference to `_imp___ZNK8Producer13RenderSurface14getWindowWidthEv'
C:\Documents and Settings\mjpm\My Documents\coding\osgsimple\osgsimple.o: In function `ZN3osg7ref_ptrINS_10FrameStampEED1Ev':
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZN3osg10CameraNode13setViewMatrixERKNS_7MatrixdE[osg::CameraNode::setViewMatrix(osg::Matrixd const&)]+0x24): undefined reference to `_imp___ZN3osg4Node10dirtyBoundEv'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZN7osgUtil9SceneView11setViewportEiiii[osgUtil::SceneView::setViewport(int, int, int, int)]+0x38): undefined reference to `_imp___ZN3osg10CameraNode11setViewportEiiii'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZN3osg7MatrixdC1Ev[osg::Matrixd::Matrixd()]+0xd): undefined reference to `_imp___ZN3osg7Matrixd12makeIdentityEv'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZNK3osg4Node8getBoundEv[osg::Node::getBound() const]+0x86): undefined reference to `_imp___ZN3osg14BoundingSphere8expandByERKS0_'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZNK3osg4Node8getBoundEv[osg::Node::getBound() const]+0xbb): undefined reference to `_imp___ZN3osg14BoundingSphere8expandByERKS0_'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZN5osgDB12readNodeFileERKSs[osgDB::readNodeFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0xe): undefined reference to `_imp___ZN5osgDB8Registry8instanceEb'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZN5osgDB12readNodeFileERKSs[osgDB::readNodeFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x27): undefined reference to `_imp___ZN5osgDB12readNodeFileERKSsPKNS_12ReaderWriter7OptionsE'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZNK3osg10Referenced5unrefEv[osg::Referenced::unref() const]+0x62): undefined reference to `_imp___ZN3osg10Referenced16getDeleteHandlerEv'
C:/Program Files/OpenSceneGraph/include/osg/ref_ptr:(.text$_ZNK3osg10Referenced5unrefEv[osg::Referenced::unref() const]+0x6d): undefined reference to `_imp___ZN3osg10Referenced16getDeleteHandlerEv'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 6 seconds)
18 errors, 0 warnings
 

I also tried adding all other libs and #including the gl headers as it reads "GL_LIBS" in the makefile, all with no success.


Regards,

Marcel

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: OpenSceneGraph (+ SDL)
« Reply #4 on: November 14, 2006, 02:39:03 am »
Why do you have the full library path there?  You should just add the name of the library, the part after the "-l" in the Makefile.  The '-L"C:\Program Files\OpenSceneGraph\lib"' (which is where the library is) tell the linger where to look for them.

mjpm

  • Guest
Re: OpenSceneGraph (+ SDL)
« Reply #5 on: November 14, 2006, 06:55:52 am »
Hello,

when I insert the libs via the browse button, it gets inserted with the full command line.
And when I delete the rest of the command line and just leave the lib name like Producer.lib compilink/linking stops at the very first lib, because it can not be found.

I also tried combinations of backslah trailing in the lib path and enforcing quotes etc., still no success.


Regards,
Marcel

mjpm

  • Guest
Re: OpenSceneGraph (+ SDL)
« Reply #6 on: November 14, 2006, 08:23:30 am »
Hello,

the problem is solved.

The Problem is that the release just is not suitable for MingW, it could not work.
For MingW I have to compile it all myself.


Regards,
Marcel