Can't load Cg shaders when RenderDoc is attached in OpenGL - opengl

I'm trying to debug my OpenGL game using RenderDoc, but if I launch from RenderDoc, then no graphics are shown and Cg outputs errors on startup. How can I get RenderDoc to work with my game?
I get a couple of errors:
cgGLGetLatestProfile(CG_GL_VERTEX) returns CG_PROFILE_ARBVP1 (a much lower profile than is returned when not launching from RenderDoc)
cgGLGetLatestProfile(CG_GL_FRAGMENT) returns CG_PROFILE_UNKNOWN
When trying to load a shader with this profile, or with a hardcoded newer one, it says The profile is not supported.
After that an additional error is output: fatal error C9999: InitHAL failed.
RenderDoc documentation mentions that dbghelp.dll shouldn't be used in combination with RenderDoc, so I removed our inclusion of dbghelp.lib and all references to the dll and the header from our code, so I think I'm not using dbghelp.dll anymore.
The GPU being used is a GeForce GTX 560 and on startup of the game GL_VERSION is reported as 4.6.0 NVIDIA 391.35. I've also tried running on a different computer with a newer videocard (Nvidia 1050ti) and I've tried installing the newest drivers but this didn't make any difference. This is all on Windows 10 64bit.
We also have a DirectX9 option in our engine. When I use this and launch the game from RenderDoc it starts fine and shows the RenderDoc overlay over the game. However, since RenderDoc doesn't actually support DirectX9 I can't capture a frame that way (which is as expected).

Related

GLSL shaders won't compile on VM Fusion - Windows 10/Visual Studio 2017

I have VMFusion installed on an external hard drive that I have connected to my 2014 Macbook Pro Retina Display. In this VM I have Windows 10 installed (not genuine) and Visual Studio 2017. I have my solution loaded (we use OpenGL), but when I compile and run, the console complains "error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, and 1.00 ES" when compiling any of our shaders.
In the VMFusion settings menu under Display, I see that the option for "Accelerate 3D Graphics" is already on. This option supposedly "Supports DirectX 10 and OpenGL 3.3". So I'm confused as to why I'm getting the error message about GLSL when I'm running my project. Does anyone have any ideas as to what is going on or how to solve this? I have the proper nuget packages installed and it seems like all the C++ code compiles just fine. It's purely the shaders. Is this a VMFusion problem or something not set up with my laptop?
On your virtual machine, try to add next variables:
MESA_GL_VERSION_OVERRIDE 3.3
MESA_GLES_VERSION_OVERRIDE 3.2
MESA_GLSL_VERSION_OVERRIDE 330
in both sections "User variables" and "System variables"
To open "Advanced system settings" follow Control Panel -> System and Security -> System click on "Adanced system settings"
It's difficult to answer without further details (your GPU, the exact settings of the VM, etc).
However, I would suggest to check a few things:
Are VMware tools installed correctly on the guest OS?
What kind of profile are you requesting when you create your context (core or compatibility?) As far as I understand, VMware guests can get only OpenGL 3.3 core profile.
Then you can also have a look at VMware Fusion documentation about these issues here

OpenGL code runs perfectly from IDE, CodeXL and GPU PerfStudio, but gives blank screen if started from Windows

I have been improving an OpenGL code of my own since some days, and now I got a terrible surprise: My code works properly if run from inside CodeBlocks IDE (by Menu-> Build -> Run), but if I open it from the Windows Explorer, the program will still open and issue messages on the console as if it would be running properly, but I just get a blank screen.
I have trying re-building the code to see if the problem disappears from Windows, or to see if it also affects the run from inside CodeBlocks, but the outcome is still the same.
Some days ago (before much of the code change), I could start the program from both Windows and CodeBlocks and run perfectly in both cases, so this is totally surprising for me now.
I use GLFW3 and GLEW and I am linking to the following libraries:
C:\msys64\mingw64\lib\libglew32.dll.a
C:\msys64\mingw64\lib\libglfw3.a
opengl32
C:\msys64\mingw64\lib\libsfml-system.dll.a (I use the clock of this library)
gdi32
On the meantime I have deinstalled and installed msys64, but this didnt affect my other OpenGL projects linking the same libraries, so I suppose this is not the source of the problem
How would I proceed to debug such an issue? I have no clue about how to start troubleshooting this, so any comment on what extra info I should post is welcome.
Update: If I open the application from the GPU PerfStudio and CodeXL, everything works just fine, but not when I open via Windows Explorer.
How would I proceed to debug such an issue?
When I deal with bugs like this I use a tool called CodeXL. You can download the latest version here. It automatically breaks on any OpenGL error and shows you which of your OpenGL function calls caused it.
It is free and it works also with non-AMD GPUs.
It should not take you long time to learn how to use it: you just create a new project, give it path to your project folder and .exe and hit run. (make sure that Debug->Breakpoints->Break on OpenGL error is checked)
//Moreover, it visualizes your buffers, shows you your loaded textures, etc.. Definitely check it if you plan to program more Windows+OpenGL in the future.

GLSL version error with any version OS X

I am trying to run an SDL2 application and it has shaders written in GLSL. When the shaders are compiled I get this message -> error version '130' is not supported.
I am on OS X 10.10, I have tried setting the the shaders to a different shader model version but with no luck.
Does anyone know anything that could cause this? The program runs but I get a black screen, I can hear the sound and I get the FPS output to a console.

How to build and run examples in OpenGL Superbible 6th edition?

My system is Win 8.1 64-bit and using VS2013 Express. I can verify my video cards support the latest OpenGL and OpenCL. I used the latest code and media files from authors github and site: https://github.com/openglsuperbible/sb6code and http://www.openglsuperbible.com/example-code/ respectively.
I am able to make debug and release builds of the project(s) successfully but cannot correctly run it either via debug mode or the .exe in the bin folder. A white window will show up and then exit. I was able to step through and found that glfwOpenWindow will return false causing the exit but I cannot step further and see why it is returning so. I found some solutions that suggested changing
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
to
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, 0);
but this does not change my results. I can verify also that major version is 4 and minor is 3 for the book code. I have found a few other people having the same problem but no resolution. Another possible solution (but to a different problem it seems) was changing the project subsystem to Console from Windows but this throws an error regarding main and so it may not be what I'm looking for.
For reference, this book is using glfw version 2.7.6 when (currently) the latest is 3.0.4. I tried swapping this too but it understandably blew up due to all of the changes.
Any further ideas would be great and very helpful!
I have discovered that while my GPU does support the latest OpenGL, my computer was instead using the integrated Intel HD 4600! By switching my computer to use the dedicated GPU by default, I am able to run the latest OpenGL.
If it successfully compiled, then please do following:
Ensure that you do have the latest graphic card drivers installed (eg. if you have nVIDIA card, go to www.nvidia.com and get newest drivers).
Ensure that files which these examples are trying to load (I guess jpg/tga/png files, maybe some obj/fbx/3ds files for geometry, whatever else these examples need) are present at expected path (relative path to exe).
Run it as a debug, place breakpoints in app initialization, see that OpenGL is initialized correctly and that required files are loaded. I think you will find that required files are not in expected path(s).
P.S.
I think the best practice for learning OpenGL is not to rely on some library to open window and initalize OpenGL for you - it's better you learn it all step by step - how to open an application window, how to initialize gl render context associated with device context etc. You'd also avoid things like this when you don't know where the problem could be.

NSight crash at frame profile

I'm using Visual Studio 2012.
Nsight Visual Studio:
Version 3.2.2
Build Number: 3.2.2.13342
My Graphics Card Information:
GeForce GT 720M
Driver version: 33182
Directx 3D version: 11.1
OpenGL 4.4
Each time I try to pause and capture a frame, and then click in Frame Profile, my program crash. This apply for all OpenGL program in my computer. First, I though it could be due to the Operating System, so I installed the OS again, but it still crashes.
This is the stack at the time the program crashes.
Before crash
Crash
I saw a crash error by NSight here, but it seems different from me.
You're best off reporting bugs in Nsight to Nvidia. 3.2.2 is a very new version and chances are it's going to be something someone hasn't reported yet.
https://devtalk.nvidia.com/default/board/84/nsight-visual-studio-edition/
The likely culprits will be using a newer or slightly out-of-the-ordinary OpenGL extension that the tool doesn't support yet. If you want to get to the bottom of it, binary chop parts of your application out until it does capture properly and add them back in until it stops working.