Direct3D11 and OpenGL3+ errors

Problems building or running the engine, queries about how to use features etc.
Post Reply
Owl53
Halfling
Posts: 92
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Direct3D11 and OpenGL3+ errors

Post by Owl53 »

Ogre Version: 1.12
Operating System: Windows 10
Render System: Directx 11

Hi,

Up to this point, I've just been using RenderSystem_GL as the selected rendersystem, with no issues. I've since tried different rendersytems and only RenderSystem_GL and DirectX9 work. I know its because I'm doing something wrong, but I'm really not sure what it is.

If I try and set the rendersystem to use DirectX11 or OpenGL 3+, the program then crashes on line 3510 in OgreSceneManager.cpp, which is the following:

Code: Select all

mShadowRenderer.prepareShadowTextures(cam, vp, lightList);
It crashes with an OgreInvalidStateException

When I look at ogre.log, there is no error stated in there at what causes the problem. It does say that the RenderSystem is loaded though, the log has the following lines - (using DirectX11 as an example but this error also occurs with OpenGL 3+):

Code: Select all

Loading library RenderSystem_Direct3D11_d.dll
Installing plugin: D3D11 RenderSystem
D3D11: Direct3D11 Rendering Subsystem created.
Does anyone know what I'm doing wrong (or possibly not doing if there's additional code that I need that I don't have) that would cause the two newer rendersystems to not work? The laptop I'm using is compatible with both, so I don't think its related to that, but I could be wrong.

Thanks in advance

Pellaeon
Gremlin
Posts: 175
Joined: Thu Apr 28, 2011 12:23 pm
x 20

Re: Direct3D11 and OpenGL3+ errors

Post by Pellaeon »

DX11 has no FFP anymore. So you need shader materials or you enable RTSS of Ogre. Perhaps this could be your problem.

Owl53
Halfling
Posts: 92
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Direct3D11 and OpenGL3+ errors

Post by Owl53 »

Pellaeon wrote:
Wed Jul 01, 2020 9:37 am
DX11 has no FFP anymore. So you need shader materials or you enable RTSS of Ogre. Perhaps this could be your problem.
Thanks for the answer! I think that's probably the problem I'm having then as I'm not currently using the RTSS. I'll look into that and see if it solves the problem, thanks!

Owl53
Halfling
Posts: 92
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: Direct3D11 and OpenGL3+ errors

Post by Owl53 »

Owl53 wrote:
Wed Jul 01, 2020 11:37 am
Pellaeon wrote:
Wed Jul 01, 2020 9:37 am
DX11 has no FFP anymore. So you need shader materials or you enable RTSS of Ogre. Perhaps this could be your problem.
Thanks for the answer! I think that's probably the problem I'm having then as I'm not currently using the RTSS. I'll look into that and see if it solves the problem, thanks!
I've tried adding in the RTSS, but I'm not sure if I've done it successfully because the problem still isn't resolved. Here is my code to initialise the RTSS:

Code: Select all

if (Ogre::RTShader::ShaderGenerator::initialize())
{
	mShaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();

	Ogre::ResourceGroupManager::getSingleton().addResourceLocation(shaderLibPath, "FileSystem");

	mShaderGenerator->setShaderCachePath(shaderCachePath);

	mShaderGenerator->addSceneManager(mSceneManager);

	// Create and register the material manager listener if it doesn't exist yet.
	if (mMaterialMgrListener == nullptr) 
	{
		mMaterialMgrListener = new OgreBites::SGTechniqueResolverListener(mShaderGenerator);
		Ogre::MaterialManager::getSingleton().addListener(mMaterialMgrListener);
	}
}

this->locateResources();
	
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

Ogre::RTShader::RenderState* pMainRenderState = mShaderGenerator->createOrRetrieveRenderState(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME).first;
pMainRenderState->reset();
pMainRenderState->addTemplateSubRenderState(mShaderGenerator->createSubRenderState(Ogre::RTShader::PerPixelLighting::Type));

viewport->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
If it helps, I've also got more information about where the OgreInvalidStateException occurs. As I said before, it crashes in the function mShadowRenderer->prepareShadowTextures, but when stepping into that function, the actual crash happens on the line

Code: Select all

shadowRTT->update()
Any ideas on what I'm missing now/doing wrong?

Thanks in advance.

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 62
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 13

Re: Direct3D11 and OpenGL3+ errors

Post by sercero »

Please look into how it is done in Ogre Bites:
https://github.com/OGRECave/ogre/blob/m ... xtBase.cpp

You might want to use Bites as a framework since it handles initialization and input through SDL2.

And here is the official documentation of the RTSS:
https://ogrecave.github.io/ogre/api/latest/rtss.html

I am not using it, so I can't do more to help.

Post Reply