[2.1] Getting my project to run on Windows (works on Linux) Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
gabbsson
Halfling
Posts: 65
Joined: Wed Aug 08, 2018 9:03 am
x 13

[2.1] Getting my project to run on Windows (works on Linux)

Post by gabbsson »

Hello!

I have been developing my program using Ogre for appr. a year and finally decided it was time to test it on Windows (which I probably should have been doing continuously).

I've immediately run into runtime issues which seem to stem from opengl, specifically it seems to crash in "createRenderWindow(..)".
The debugger trace says an exception is being thrown in GLSLShader::getShaderID which is called from HlmsLowLevel::executeCommand.

To allow for multiple views (i.e. renderwindows) i followed this forum post.
It says to use a "dummy window" which creates a glContext and then any subsequent windows should use "currentGLContext = true".
Does this change on windows?
Turning off "currentGLContext" does avoid the createRenderWindow crash but then it crashes during renderOneFrame instead (some assert fails in the destructor of instant radiosity regarding the mapSize). Additionally in this case an OpenGL error is also thrown: "GL_INVALID_OPERATION".

I also tried to just use the dummywindow and not attempt creating more, since it can create the dummy window just fine.
Then it crashes somewhere else instead...

I realize its hard to help me without more specific information, but its also hard to just post "everything" so I'm hoping this wide net might catch some hints on where to look. Any tips of what might need to change when running on windows instead of linux would help!

I am running Ogre "inside" Qt. It runs fine on linux (Ubuntu). Could that be causing some strange interaction?

I have been developing with only OpenGL in mind, no plan or way to test it using DX etc unfortunately.

Lastly I tried to build Ogre with samples but I can't find the samplebrowser anywhere, is it not part of 2.1?
What is the recommended fastest way to see if "minimal" Ogre actually runs?

Thanks for reading! Cheers
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] Getting my project to run on Windows (works on Linux)

Post by dark_sylinc »

Getting multiple windows to work on OpenGL always requires a bit of praying.

For Windows/OpenGL the procedure is similar but slightly different. See this post (use externalGLContext): http://www.ogre3d.org/forums/viewtopic. ... 08#p522313

Cheers and good luck!

PS. If it keeps crashing, make sure the crash is not happening in a worker thread (check the threads window in Visual Studio). Running OpenGL from other threads is not supported in any platform but it might have been working for you by accident.
gabbsson
Halfling
Posts: 65
Joined: Wed Aug 08, 2018 9:03 am
x 13

Re: [2.1] Getting my project to run on Windows (works on Linux)

Post by gabbsson »

dark_sylinc wrote: Tue Jul 16, 2019 4:29 pm Getting multiple windows to work on OpenGL always requires a bit of praying.

For Windows/OpenGL the procedure is similar but slightly different. See this post (use externalGLContext): http://www.ogre3d.org/forums/viewtopic. ... 08#p522313

Cheers and good luck!

PS. If it keeps crashing, make sure the crash is not happening in a worker thread (check the threads window in Visual Studio). Running OpenGL from other threads is not supported in any platform but it might have been working for you by accident.
Oh! I recognize that post! I'll give it a shot.

Thanks!

I suspect there's more than just multiple windows that is going to give me a hard time, but one step at a time.
gabbsson
Halfling
Posts: 65
Joined: Wed Aug 08, 2018 9:03 am
x 13

Re: [2.1] Getting my project to run on Windows (works on Linux)

Post by gabbsson »

dark_sylinc wrote: Tue Jul 16, 2019 4:29 pm Getting multiple windows to work on OpenGL always requires a bit of praying.

For Windows/OpenGL the procedure is similar but slightly different. See this post (use externalGLContext): http://www.ogre3d.org/forums/viewtopic. ... 08#p522313

Cheers and good luck!

PS. If it keeps crashing, make sure the crash is not happening in a worker thread (check the threads window in Visual Studio). Running OpenGL from other threads is not supported in any platform but it might have been working for you by accident.
Alright, I gave this a shot (after coming back from vacation) and it doesn't seem to make a difference.
I now save the glContext as a size_t after creating the first dummy window and set it as externalGLContext for all subsequent windows.
Previously I was simply setting "currentGLContext false" for the first and "true" for the subsequent, I've tried all permutations and none seem to work.

It still says its crashing in GLSLShader::getShaderID which is called from HlmsLowLevel::executeCommand when I call createRenderWindow.
However after looking in to it I'm not confident Qtcreator is giving me a correct stack trace, at the very least it seems incomplete (i.e. there are more steps that it is not showing).
The Ogre log does however also mention getShaderID:

Code: Select all

GL3PlusRenderSystem::_createRenderWindow "Window0", 640x480 windowed  miscParams: externalGLContext=131072 vsync=No
Created Win32Window 'Window0' : 656x518, 32bpp
Exception at 0x7fefd8db87d, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance) in RenderSystem_GL3Plus!Ogre::GLSLShader::getShaderID
Exception at 0x7fefd8db87d, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) in RenderSystem_GL3Plus!Ogre::GLSLShader::getShaderID
I'm not using Visual Studio, I'm using Qtcreator, but I'll look into making sure I'm not running in a separate thread, if I am it is not intentional.

I really have no leads on what might cause this (other than the threading), especially since it works fine on Linux.
Do you have any other ideas of things I could test?
gabbsson
Halfling
Posts: 65
Joined: Wed Aug 08, 2018 9:03 am
x 13

Re: [2.1] Getting my project to run on Windows (works on Linux)

Post by gabbsson »

It seems the crash was caused by not having the same parameters in new window as the dummy window.
Should probably test some more to verify that is true, but for now that seems to be the rule.

I'll wait with marking all of this as solved as it not crashes for a different reason.
The (passBufferPtr - startupPtr) * 4u == mapSize assert is failing.
But I'll be doing some cleanup first before asking any further questions so I'm sure it's not caused by something temporary I changed while debugging the above.

I found the reason for the crash while creating a minimal Ogre project without Qt to isolate the problem, I was getting GL_INVALID_OPERATION which was fixed by what you suggested (and also mentioned in FAQ), so the gl context stuff seems to be required even if it was not the reason for the crash.

Cheers!
Post Reply