Equalizer + OpenSceneGraph: Compile problems on Windows

View: New views
13 Messages — Rating Filter:   Alert me  

Equalizer + OpenSceneGraph: Compile problems on Windows

by Thomas McGuire-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have successfully managed to combine Equalizer with OpenSceneGraph, and it
works like a charm. However, it only compiles on Linux, when I tried compiling
on Windows I got errors I couldn't resolve.

The problem arises even with a very simply testcase program, which only uses
two #include statements in a single cpp file:

> #include <osgViewer/Viewer>
> #include <eq/client/channel.h>

If I try to compile that, I get the following error:

C:\Program Files\Equalizer-0.6\build\VS2005\Win32\Debug\Headers\GL/glew.h(84)
: fatal error C1189: #error :  gl.h included before glew.h

Now, if I tried the other way around, like this:

> #include <eq/client/channel.h>
> #include <osgViewer/Viewer>

Now I get the following error:

C:\Program Files\OpenSceneGraph\OpenSceneGraph\include\osg/BufferObject(203) :
error C2143: Syntaxfehler: Es fehlt ';' vor '->'
(translates to "syntax error: missing ';' in front of '->'")
The source line is: void glGenBuffers (GLsizei n, GLuint *buffers) const;

The problem seem to be the OpenGL includes, especially since they use many
#defines which seem to mess things up.

I'm using Equalizer 0.6.0 and OpenSceneGraph 2.6.1

Any suggestion on how to fix or work around this problem?

Regards,
Thomas McGuire


_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

signature.asc (201 bytes) Download Attachment

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by Paul-386 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good work Thomas. Any plan to release the code or an example ?

Regards

----- Original Message -----
From: "Thomas McGuire" <thomas.mcguire@...>
To: <eq-dev@...>
Sent: Sunday, January 04, 2009 2:19 PM
Subject: [eq-dev] Equalizer + OpenSceneGraph: Compile problems on Windows


> _______________________________________________
> eq-dev mailing list
> eq-dev@...
> http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
> http://www.equalizergraphics.com

_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by Martin Lambers-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Thomas!

On Sun, Jan 04, 2009 at 11:19:36PM +0100, Thomas McGuire wrote:
> > #include <osgViewer/Viewer>
> > #include <eq/client/channel.h>
>
> If I try to compile that, I get the following error:
>
> C:\Program Files\Equalizer-0.6\build\VS2005\Win32\Debug\Headers\GL/glew.h(84)
> : fatal error C1189: #error :  gl.h included before glew.h

It often helps to manually include <GL/glew.h> before any other header
that might include GL headers. On Windows, it might be necessary to
additionally define GLEW_STATIC first.

Regards,
Martin
--
Computer Graphics and Multimedia Systems Group
University of Siegen, Germany
http://www.cg.informatik.uni-siegen.de/

_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by Thomas McGuire-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 05 January 2009 10:32:54 Martin Lambers wrote:

> On Sun, Jan 04, 2009 at 11:19:36PM +0100, Thomas McGuire wrote:
> > > #include <osgViewer/Viewer>
> > > #include <eq/client/channel.h>
> >
> > If I try to compile that, I get the following error:
> >
> > C:\Program
> > Files\Equalizer-0.6\build\VS2005\Win32\Debug\Headers\GL/glew.h(84)
> >
> > : fatal error C1189: #error :  gl.h included before glew.h
>
> It often helps to manually include <GL/glew.h> before any other header
> that might include GL headers. On Windows, it might be necessary to
> additionally define GLEW_STATIC first.
That doesn't help, I tried:
> #define GLEW_STATIC
> #include <GL/glew.h>
> #include <eq/client/channel.h>
> #include <osgViewer/Viewer>

The error I get now is:

C:\Equalizer-0.6\build\VS2005\Win32\Debug\Headers\eq/client/objectManager.h(38) :
error C2061: Syntax error: Identifier 'GLEWContext'

I also tried various re-orderings of the #includes, but that only changes the type of error I get.

Regards,
Thomas


_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

signature.asc (201 bytes) Download Attachment

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by Stefan Eilemann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 5. Jan 2009, at 10:54, Thomas McGuire wrote:

> That doesn't help, I tried:
>> #define GLEW_STATIC
>> #include <GL/glew.h>
>> #include <eq/client/channel.h>
>> #include <osgViewer/Viewer>
>
> The error I get now is:
>
> C:\Equalizer-0.6\build\VS2005\Win32\Debug\Headers\eq/client/
> objectManager.h(38) :
> error C2061: Syntax error: Identifier 'GLEWContext'
>
> I also tried various re-orderings of the #includes, but that only  
> changes the type of error I get.

Since OSG doesn't need GLEW, defining EQ_IGNORE_GLEW before including  
Equalizer headers should help.


Cheers,

Stefan.


_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by Thomas McGuire-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Monday 05 January 2009 20:03:55 Paul wrote:
> Good work Thomas. Any plan to release the code or an example ?

I'm not sure what our internal policy is about releasing the complete code. Anyway, we basically took the eqPly example and added
rendering with a osgViewer::Viewer to it.

For this to work, the following needs to be done:
- in Channel::frameDraw, pass the frustum and the viewport of the channel to  
  the camera of the viewer.
- Set a osgViewer::GraphicsWindowEmbedded as the context of the camera so that
  OSG doesn't try to create its own window.

That is all.
The relevant code is:

bool Channel::configInit( const uint32_t initID )
{
    if( !eq::Channel::configInit( initID ))
        return false;

    osg::ref_ptr<osg::Node> root = createSceneGraph().get();
    mViewer = new osgViewer::Viewer();
    mViewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
    mViewer->setSceneData(root.get());
    mContext = new osgViewer::GraphicsWindowEmbedded;

    return true;
}

void Channel::frameDraw( const uint32_t frameID )
{
    eq::Channel::frameDraw( frameID );
    mViewer->getCamera()->setGraphicsContext( mContext.get() );
    const vmml::Frustumf& channelfrustum = getFrustum();
    mViewer->getCamera()->setProjectionMatrixAsFrustum(
           channelfrustum.left, channelfrustum.right,
           channelfrustum.bottom, channelfrustum.top,
           channelfrustum.nearPlane, channelfrustum.farPlane );
    const eq::PixelViewport& channelviewport = channel->getPixelViewport();
    mViewer->getCamera()->setViewport( channelviewport.x,channelviewport.y,
                                       channelviewport.w,channelviewport.h );
    mViewer->frame();
}

Regards,
Thomas



_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

signature.asc (201 bytes) Download Attachment

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by Thomas McGuire-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Monday 05 January 2009 11:06:04 Stefan Eilemann wrote:

> On 5. Jan 2009, at 10:54, Thomas McGuire wrote:
> > That doesn't help, I tried:
> >> #define GLEW_STATIC
> >> #include <GL/glew.h>
> >> #include <eq/client/channel.h>
> >> #include <osgViewer/Viewer>
> >
> > The error I get now is:
> >
> > C:\Equalizer-0.6\build\VS2005\Win32\Debug\Headers\eq/client/
> > objectManager.h(38) :
> > error C2061: Syntax error: Identifier 'GLEWContext'
> >
> > I also tried various re-orderings of the #includes, but that only
> > changes the type of error I get.
>
> Since OSG doesn't need GLEW, defining EQ_IGNORE_GLEW before including
> Equalizer headers should help.
Thanks, that indeed helps! All builds fine now.

Regards,
Thomas


_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

signature.asc (201 bytes) Download Attachment

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by Stefan Eilemann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Thomas,

Thanks for posting this code!

One minor comment:

On 5. Jan 2009, at 11:09, Thomas McGuire wrote:

> The relevant code is:
>
> bool Channel::configInit( const uint32_t initID )
> {
>    if( !eq::Channel::configInit( initID ))
>        return false;
>
>    osg::ref_ptr<osg::Node> root = createSceneGraph().get();
>    mViewer = new osgViewer::Viewer();
>    mViewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
>    mViewer->setSceneData(root.get());
>    mContext = new osgViewer::GraphicsWindowEmbedded;

I think one osgViewer per eq::Pipe should be enough, since you set all  
Channel parameters in frameDraw, and all Channels of a Pipe are  
executed serially and share a context with each other.


Cheers,

Stefan.


_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by Thomas McGuire-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 05 January 2009 12:59:44 Stefan Eilemann wrote:

> On 5. Jan 2009, at 11:09, Thomas McGuire wrote:
> > The relevant code is:
> >
> > bool Channel::configInit( const uint32_t initID )
> > {
> >    if( !eq::Channel::configInit( initID ))
> >        return false;
> >
> >    osg::ref_ptr<osg::Node> root = createSceneGraph().get();
> >    mViewer = new osgViewer::Viewer();
> >    mViewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
> >    mViewer->setSceneData(root.get());
> >    mContext = new osgViewer::GraphicsWindowEmbedded;
>
> I think one osgViewer per eq::Pipe should be enough, since you set all
> Channel parameters in frameDraw, and all Channels of a Pipe are
> executed serially and share a context with each other.

Right, thanks for pointing this out.

Regards,
Thomas

_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by 3dhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all

may we should use one single osg::Viewer as the main rendering window, and all others as slave camera. (addSlave) with shared context. if i am right understood what stefan told.

if someone could the example / code i would be happy :-) as i am working for Spatial View Display Support, may a cluster of 5 PCs would linearly increase with eq the fps.

/adrian

2009/1/5 Thomas McGuire <thomas.mcguire@...>
On Monday 05 January 2009 12:59:44 Stefan Eilemann wrote:
> On 5. Jan 2009, at 11:09, Thomas McGuire wrote:
> > The relevant code is:
> >
> > bool Channel::configInit( const uint32_t initID )
> > {
> >    if( !eq::Channel::configInit( initID ))
> >        return false;
> >
> >    osg::ref_ptr<osg::Node> root = createSceneGraph().get();
> >    mViewer = new osgViewer::Viewer();
> >    mViewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
> >    mViewer->setSceneData(root.get());
> >    mContext = new osgViewer::GraphicsWindowEmbedded;
>
> I think one osgViewer per eq::Pipe should be enough, since you set all
> Channel parameters in frameDraw, and all Channels of a Pipe are
> executed serially and share a context with each other.

Right, thanks for pointing this out.

Regards,
Thomas

_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com



--
********************************************
Adrian Egli

_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by Stefan Eilemann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 5. Jan 2009, at 15:12, Adrian Egli OpenSceneGraph (3D) wrote:

> Hi all
>
> may we should use one single osg::Viewer as the main rendering  
> window, and all others as slave camera. (addSlave) with shared  
> context. if i am right understood what stefan told.

Yes, that sounds in line with the eq::Window::getSharedContextWindow().

Basically 'the main rendering window' is the shared context window  
(the first of each pipe) and all others have the slave camera.


Cheers,

Stefan.

_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by 3dhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-> have a look at void View::setUpViewForWoWVxDisplay(unsigned int screenNum, unsigned char wow_content, unsigned char wow_factor, unsigned char wow_offset, float wow_disparity_Zd, float wow_disparity_vz, float wow_disparity_M, float wow_disparity_C)
{


    osg::ref_ptr<osg::Camera> camera = new osg::Camera;
        camera->setName("Front face camera");
        camera->setGraphicsContext(gc.get());
        camera->setViewport(new osg::Viewport(0,0,camera_width, camera_height));
        camera->setDrawBuffer(buffer);
        camera->setReadBuffer(buffer);
        camera->setAllowEventFocus(false);
        // tell the camera to use OpenGL frame buffer object where supported.
        camera->setRenderTargetImplementation(renderTargetImplementation);

        // attach the texture and use it as the color buffer.
        camera->attach(osg::Camera::COLOR_BUFFER, texture);
        camera->attach(osg::Camera::DEPTH_BUFFER, textureD);

        addSlave(camera.get(), osg::Matrixd(), osg::Matrixd());

2009/1/5 Stefan Eilemann <eilemann@...>

On 5. Jan 2009, at 15:12, Adrian Egli OpenSceneGraph (3D) wrote:

> Hi all
>
> may we should use one single osg::Viewer as the main rendering
> window, and all others as slave camera. (addSlave) with shared
> context. if i am right understood what stefan told.

Yes, that sounds in line with the eq::Window::getSharedContextWindow().

Basically 'the main rendering window' is the shared context window
(the first of each pipe) and all others have the slave camera.


Cheers,

Stefan.

_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com



--
********************************************
Adrian Egli

_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Re: Equalizer + OpenSceneGraph: Compile problems on Windows

by 3dhelp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-> have a look at void View::setUpViewForWoWVxDisplay(unsigned int screenNum, unsigned char wow_content, unsigned char wow_factor, unsigned char wow_offset, float wow_disparity_Zd, float wow_disparity_vz, float wow_disparity_M, float wow_disparity_C)
{


    osg::ref_ptr<osg::Camera> camera = new osg::Camera;
        camera->setName("Front face camera");
        camera->setGraphicsContext(gc.get());
        camera->setViewport(new osg::Viewport(0,0,camera_width, camera_height));
        camera->setDrawBuffer(buffer);
        camera->setReadBuffer(buffer);
        camera->setAllowEventFocus(false);
        // tell the camera to use OpenGL frame buffer object where supported.
        camera->setRenderTargetImplementation(renderTargetImplementation);

        // attach the texture and use it as the color buffer.
        camera->attach(osg::Camera::COLOR_BUFFER, texture);
        camera->attach(osg::Camera::DEPTH_BUFFER, textureD);

        addSlave(camera.get(), osg::Matrixd(), osg::Matrixd());

2009/1/5 Stefan Eilemann <eilemann@...>

On 5. Jan 2009, at 15:12, Adrian Egli OpenSceneGraph (3D) wrote:

> Hi all
>
> may we should use one single osg::Viewer as the main rendering
> window, and all others as slave camera. (addSlave) with shared
> context. if i am right understood what stefan told.

Yes, that sounds in line with the eq::Window::getSharedContextWindow().

Basically 'the main rendering window' is the shared context window
(the first of each pipe) and all others have the slave camera.


Cheers,

Stefan.

_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com



--
********************************************
Adrian Egli

_______________________________________________
eq-dev mailing list
eq-dev@...
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com