2.0 Differences betwen GL and GL3Plus renderers

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


libolt
Greenskin
Posts: 126
Joined: Wed Jan 19, 2005 4:48 am
x 9

2.0 Differences betwen GL and GL3Plus renderers

Post by libolt »

For Ogre 2.0 is there any major difference in the initialization process for the GL3Plus render system versus the old GL render system? I understand that in 2.0 GL3Plus is considered to be in an alpha state.

The reason that i ask is that I've been able to get a minimal test case of my code to load and render a model in the compositor with the GL render system but not GL3Plus. I've only been able to test both render systems on Linux as I can't get the GL render system to build on MSVC 2019 whil GL3Plus is fine.

Here is the code I use to set everything up:

Code: Select all

    mSceneMgr = sharedPtr<Ogre::SceneManager>(RERoot->createSceneManager(Ogre::ST_GENERIC, 4, Ogre::INSTANCING_CULLING_THREADED, "SceneManager")); // creates the scene manager

    mCamera = sharedPtr<Ogre::Camera>(mSceneMgr->createCamera("camera"));

#if OGRE_VERSION_MAJOR == 2

    const Ogre::IdString workspaceName( "MyOwnWorkspace" );
    compositorManager = sharedPtr<Ogre::CompositorManager2>(RERoot->getCompositorManager2());
    if( !compositorManager->hasWorkspaceDefinition( workspaceName ) )
        compositorManager->createBasicWorkspaceDef( workspaceName, Ogre::ColourValue( 0.6f, 0.0f, 0.6f ) );
    compositorManager->addWorkspace( mSceneMgr.get(), mWindow.get(), mCamera.get(), workspaceName, true );

#endif

    // Position it at 500 in Z direction
    mCamera->setAutoAspectRatio(true);
    mCamera->setPosition(Ogre::Vector3(0, 0, 455));
    // Look back along -Z
    mCamera->lookAt(Ogre::Vector3(0, 0, -300));

    mCamera->setNearClipDistance(5);
    mCamera->setFarClipDistance(5000);
    cameraNode = OgreSceneNodeSharedPtr(mSceneMgr->getRootSceneNode()->createChildSceneNode());
    mCamera->detachFromParent();
    cameraNode->attachObject(mCamera.get());

    viewPort = sharedPtr<Ogre::Viewport>(mWindow->addViewport());

#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
    viewPort->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
#endif
    viewPort->setOverlaysEnabled(true);	// sets overlays true so that MyGUI can render

    bool overlayEnabled = viewPort->getOverlaysEnabled();
    logMsg(func +" overlayEnabled = " +convert->toString(overlayEnabled));

    // Set ambient light
    mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));

    // Create a light
    light = sharedPtr<Ogre::Light>(mSceneMgr->createLight());
    lightNode = OgreSceneNodeSharedPtr(mSceneMgr->getRootSceneNode()->createChildSceneNode());
    lightNode->attachObject(light.get());
    lightNode->setPosition(20,80,56);
    light->setPowerScale(1);

    if (mWindow == nullptr)
    {
        logMsg(func +" createScene mWindow 2 == nullptr!");
        exit(0);
    }

    bball = OgreEntitySharedPtr(mSceneMgr->createEntity("bball.mesh", "UBCData"));
    bballNode = OgreSceneNodeSharedPtr(mSceneMgr->getRootSceneNode()->createChildSceneNode());
    bballNode->setName("bball");
    bballNode->attachObject(bball.get());
    bballNode->setScale(1.0f,1.0f,1.0f);
    bballNode->setPosition(0.8f,-5.0f,352.0f);
    compositorManager->addNodeDefinition("bball");

    if (bball == nullptr)
    {
        logMsg(func +"bball.mesh didn't load");
        exit(0);
    }
As mentioned earlier it loads the mesh on the GL render system but on the GL3Plus render system all I see is the default magenta color of the compositor. I just want to verify that I'm not missing something before I begin porting to Ogre 2.1.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5511
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1379

Re: 2.0 Differences betwen GL and GL3Plus renderers

Post by dark_sylinc »

I don't think there were any major differences when loading GL vs GL3+ renderer.

Were you using fixed function pipeline in 1.x?

Because GL3+ needs shaders (RTSS can emulate the fixed function pipeline).
That could explain if nothing shows up. There might be more info in the Ogre.log

In Ogre 2.1 the Hlms automatically takes care of generating shaders (replaces the RTSS, which doesn't work in 2.1) so that shouldn't be a problem.
libolt
Greenskin
Posts: 126
Joined: Wed Jan 19, 2005 4:48 am
x 9

Re: 2.0 Differences betwen GL and GL3Plus renderers

Post by libolt »

Okay that makes sense that it would be due to not using RTSS with GL3Plus. I have used RTSS with 1.x and the GLES render system on android in the past.

Is there any point to setting up RTSS with 2.0 or would it make more sense to port to 2.1 and learn Hlms since that is my end goal anyways?

Thanks
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5511
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1379

Re: 2.0 Differences betwen GL and GL3Plus renderers

Post by dark_sylinc »

libolt wrote: Wed Oct 16, 2019 12:42 am Is there any point to setting up RTSS with 2.0 or would it make more sense to port to 2.1 and learn Hlms since that is my end goal anyways?
There's no point unless it takes you little time and you want to check geometry is working.

If you know a bit of GLSL, you could check geometry is working by setting up a quick shader that can output to screen.

If that's too hard, then move on to 2.1; we can better help you there.
libolt
Greenskin
Posts: 126
Joined: Wed Jan 19, 2005 4:48 am
x 9

Re: 2.0 Differences betwen GL and GL3Plus renderers

Post by libolt »

I don't know any GLSL yet but I plan on learning it in the future. I will go ahead and port to 2.1.

Thanks again for your help.