wglMakeCurrent FAILS using DetourCreateProcessWithDll - opengl

I am using DetourCreateProcesswithDLL in Visual Studio 2010 and providing replacement dlls for Opengl32.dll , glu32.dll and glut32.dll while creating process for abgr.exe demo application from glut demo programs.
That way I am intercepting Opengl32, glu32, glut32 libraries. The apis then call the respective apis from the system folder or usual dlls.
These dlls have all the apis defined in their respective libraries.
Problem is that wglMakeCurrent returns 0 or fails with glut demo app like abgr.exe on NVidia GTX480 on Win 7 x64 bit. It doesnt work with other demo apps either.
It does work if i change the Compatibility of the abgr.exe or the GLIntercept executable which is invoking DetourCreateProcesswithDLL. i.e. right click on exe -> change properties ->Compatilibity ->Check Run in 256 colors.
However this looks like a work around and the display doesn't look all that good. How can i use without have to do that. How to get a good value for wglMakeCurrent.
wglMakeCurrent is called from within glutCreateWindow.
This is not a problem on the AMD Fusion GPU. There wglMakeCurrent and returns a good value. The problem is only on NVIDIA GTX 480. Does anyone know how to fix this problem? I have updated the driver and shows version 4.3.790.0 on the NVIDIA Control Panel Help->About
wglCreateContext returns 0x00010000

Related

Qt tableview model not native Windows system font

I created a tableview with model, but the font is not the native system font. It currently looks like this (a combobox inside the tableview):
But in another textinput in the same application it looks correctly like this:
I use no custom fonts and have not overridden the Qt::FontRole (return invalid QVariant()). Why doesn't it use the system font? This is on Windows 10.
EDIT:
There doesn't seem to be any issue when running the executable on my laptop. I'm suspecting a mismatch in .dll files. It should be using the exact same ones but perhaps its using .dll files it finds on my system PATH.
EDIT:
After checking with ProcessExplorer it seems that it loads the correct dlls which are exactly the same my other system loads. The Visual C++ Redistributables versions are also exactly the same.
EDIT
Tried with Visual Studio 2017 (from 2015) with fresh Qt installation, but that doesn't solve the problem either.

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.

Running qt creator via remote desktop

We are developing a software using QT creator. The software is meant to run on windows and on an ARM mini-computer running Debian. To test the software on the mini-computer, we logged in on the mini computer using ssh and an exported display. Some programs like Inkscape run fine, but we can't get to run QT Creator. It always displays the following errors:
No tool chain set from kit "Desktop".
No tool chain set from kit "Desktop".
Cant find EGLConfig, returning null config
Unable to find an X11 visual which matches EGL config 0
Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.
Cant find EGLConfig, returning null config
Unable to find an X11 visual which matches EGL config 0
Could not initialize OpenGL
We also tried to log in from another x86 linux computer, but this created the same errors. Thus we suppose that the problems are linked to the architecture. Does anybody know how to solve this issue?
EDIT: We just tried to access QT creator from another ARM Debian mini-computer and it also fails. Thus it does not seem to be related to the architecture as we first suspected.
(We could of course do cross compiling and remote debugging, but we try to avoid this)
Try loading qtcreator without the Welcome addon:
qtcreator -noload Welcome
The Welcome addon uses OpenGL which probably isn't supported by X forwarding.

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.

Phonon problem in Windows 7 with code compiled in XP

I have some code compiled using Visual Studio 2010 (C++), with Qt for the GUI and Phonon to show some videos.
I compile and run the code in a Windows XP machine and everything works fine. The videos and controls are shown correctly, and the same in other Windows XP machines. But at the moment that I try to use a Windows 7 machine, the video is not shown. Phonon controls are loaded, I can adjust the size of the Phonon VideoWidget but nothing is shown. I am using the SetFile method to indicate the file location and I have also tried (of course, with no luck) with setCurrentSource in the MediaObject (it works, though, in Windows XP).
I have tried different locations of files (absolute/relative) but nothing seems to work. Also, in XP when a video is not found an alert message is shown while in Windows 7 there is no error message, but also no video is shown. If I try to open the videos with other players, they work fine (I tried also with videos with different formats).
Any idea on what can be wrong? Is there something that I am missing with Phonon and Windows 7? Thanks!
When deploying your application to a different computer, make sure you don't forget to copy the Phonon backend. Not just the DLL contained in it (the ds backend for me), but also the directory itself.
That is
-Application Directory
¦-myexe.exe
¦-phonon_backend
¦-phonon_ds94.dll
Furthermore the Phonon backend on Windows (and Mac I think) makes use of the QtOpenGL module. So don't forget to copy this either. It can go inside the application directory.
In any case you could help yourself out a bit by adding a small bit of code that shows (perhaps writes to a file) which mimetypes are available. If it doesn't spit out anything, there is a problem with your backend. (Well, that of your application...)
This is what I had to do when I used Phonon to play video inside my application. Since I only quickly added this some time ago to my application, I'm not 100% sure that this is the only (or even the proper) way to do this, so anyone who has different insights feel free to comment on this.