Basic Tutorial 3 - Black screen

Problems building or running the engine, queries about how to use features etc.
Post Reply
Haddock
Gnoblar
Posts: 6
Joined: Tue Dec 04, 2018 10:40 am

Basic Tutorial 3 - Black screen

Post by Haddock » Thu Dec 06, 2018 3:33 pm

Hi!

I have been trying to complete Basic Tutorial 3 but all I get is a black screen. The source is pre-Bites so I just copied out the relevant code to the new method as used in tutorials 1 & 2. I also attached my camera and light to scene nodes (these are not used in the tutorial 3 source), and made the calls to setDirection and setPosition on the nodes instead of the objects themselves. I've tried various combinations here, moving those calls from object to node to both etc., but always just get a black screen as if there is no light and/or no camera?

All I see is a black screen, and there are some errors in my Ogre log (attached). I was getting this same error on tutroial 2 using v1.11.3 and D3D9 but 1.11.4 fixed it there. The terrain and textures loaded ok from what I can see in the log, but I could be missing something.

Code: Select all

Ogre::InvalidParametersException::InvalidParametersException: Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at C:\Projects\Ogre\Ogre\ogre-1.11.4\OgreMain\src\OgreGpuProgramParams.cpp (line 1661)

Code: Select all

Error: ScriptCompiler - invalid parameters in UnsharpMask.material(131): setting of constant failed
An example of the code changes i made from the original tutorial 3:

Code: Select all

Ogre::Vector3 lightdir(0.55, -0.3, 0.75);
lightdir.normalise();

Ogre::Light* light = mSceneMgr->createLight("TestLight");
light->setType(Ogre::Light::LT_DIRECTIONAL);
light->setDirection(lightdir);
light->setDiffuseColour(Ogre::ColourValue::White);
light->setSpecularColour(Ogre::ColourValue(0.4, 0.4, 0.4));
to:

Code: Select all

SceneNode* lightNode = mScnMgr->getRootSceneNode()->createChildSceneNode();
Ogre::Light* light = mScnMgr->createLight("TestLight");
light->setType(Ogre::Light::LT_DIRECTIONAL);
light->setDiffuseColour(Ogre::ColourValue::White);
light->setSpecularColour(Ogre::ColourValue(0.4, 0.4, 0.4));
lightNode->setDirection(lightdir);
lightNode->attachObject(light);
Neither version works. I did the same thing with my camera object:

Code: Select all

SceneNode* camNode = mScnMgr->getRootSceneNode()->createChildSceneNode();
Ogre::Camera* cam1 = mScnMgr->createCamera("Cam1");
cam1->lookAt(Ogre::Vector3(1963, 50, 1660));
cam1->setNearClipDistance(0.1);
camNode->attachObject(cam1);
camNode->setPosition(Ogre::Vector3(1683, 50, 2116));
Still black screen whatever method I try. I've also attached my source, if anyone can provide some guidance it is greatly appreciated!


Ogre Version: v1.11.4
Operating System: Windows 10 Enterprise 1803 (x64)
Render System: Direct3D9
Attachments
BasicTutorial3.cpp
(6.93 KiB) Downloaded 13 times
ogre.log
(61.51 KiB) Downloaded 10 times
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 775
Joined: Sun Mar 30, 2014 2:51 pm
x 120
Contact:

Re: Basic Tutorial 3 - Black screen

Post by paroj » Thu Dec 06, 2018 3:49 pm

do the terrain samples in the samplebrowser work?
0 x

Haddock
Gnoblar
Posts: 6
Joined: Tue Dec 04, 2018 10:40 am

Re: Basic Tutorial 3 - Black screen

Post by Haddock » Thu Dec 06, 2018 4:05 pm

Sorry I should have said - the Environment/Terrain sample works okay. All the samples in Environment work.
0 x

Haddock
Gnoblar
Posts: 6
Joined: Tue Dec 04, 2018 10:40 am

Re: Basic Tutorial 3 - Black screen

Post by Haddock » Thu Dec 06, 2018 4:18 pm

Ooops! Newbie error.. I forgot this line:

Code: Select all

getRenderWindow()->addViewport(cam1);
I looked so many times and only just saw it now. Sorry, please ignore this post!
0 x

Post Reply