glfwInit takes 20 seconds - c++

I never had an issue with this until recently, but glfwInit() always takes 20 seconds to execute. I have seen the other stackoverflows and github issues pertaining to driver issues - but I do not have the same devices as the ones people talk about, and with the devices and drivers (fully updated) I do have, I have never had this issue until now.
RB_CORE_INFO("Creating window {0} ({1}, {2})", props.title, props.width, props.height); // log macro - for example, will print at 10:30:00
if (!gGlfwInitialized)
{
RB_CORE_TRACE("Initializing GLFW"); // prints at 10:30:00
const int success = glfwInit(); // takes 20 seconds
RB_CORE_ASSERT(success, "Could not initialize GLFW")
RB_CORE_TRACE("GLFW Initialized"); // prints at 10:30:20
glfwSetErrorCallback(GlfwErrorCallback);
gGlfwInitialized = true;
}
RB_CORE_TRACE("Creating glfw window");
mWindow = glfwCreateWindow(static_cast<int>(props.width), static_cast<int>(props.height), mData.title.c_str(),
nullptr, nullptr);
A snippet of my code, though I'm quite positive the issue is not my code. Whether my issue is glfw or windows 11 I am not sure, but I'm going mad trying to figure it out. Other work arounds and causes I've found online do not seem to be my case, as far as I can figure at least.
Any help is greatly appreciated.
For reference, I run Windows 11, fully updated and all drivers updated. RTX 3080 gpu and a Ryzen 5900x cpu. Some people have blamed Corsair keyboards, though I have a Ducky keyboard and it doesn't seem to be the cause either.
Note: I've rebooted many times since I first started having this issue a couple days ago.
Edit:
It does seem the issue is related to this and this however these point to a device driver with VID_262 in the hardware ID. But as I do not have any with that particular VID_262 I'm not sure where to start looking. Using DevCon.exe I generated this list but even after unplugging every device one by one, I can't find the issue. As of this edit, I've not yet been able to try running this on another device.

So it turns out VCPKG is evil. I started having more issues - being that ImGui first compiled, but would give me read access violations when I used their NewFrame function. Then it turned into linking errors and a whole bunch of things that really started to confuse me. Even though I'm taking all my libraries from my own folder via premake, it seems Visual Studio has gotten confused and was trying to link both my generated lib files with lib files I had installed on vcpkg.
Turning off vcpkg has fixed both my linking errors and now makes glfw init very fast. I guess I should just uninstall vcpkg completely so it fixes the problem for other games or applications that use things like glfw.
Long story short, VCPKG is a nightmare on my system.

Related

midiOutOpen on Windows 10 using Microsoft GS Wavetable Synth fails

I have an application that relies on the in built Microsoft GS Wavetable Synth. It has worked flawlessly on Windows XP, Vista, 7, 8 and 8.1. While the first call to midiOutOpen on Windows 10 works, subsequent calls result in error code 1, meaning 'Unspecified error'. The code is simple:
result = midiOutOpen(&_midiOutHandle, midiOutputDevice, NULL, 0, CALLBACK_NULL);
Any ideas regarding how to resolve this hugely appreciated.
I see it. Tracing through the machine code, I see the modMessage() function fail and return MMSYSERR_ERROR. Exactly why isn't clear to me, it looks like a missing initialization problem.
What is strange about this mishap is that there are not a lot of complaints about it, you'd expect plenty of other programs fall over as well. Or for that matter for them to be tested before Win10 shipped. Next thing I tried is adding the one thing that happens in any non-trivial audio app that I skipped in my test program. Partly inspired by seeing "ATL" back in the symbols of modMessage, although it wasn't anywhere close. I added this as the first line in main():
CoInitializeEx(NULL, COINIT_MULTITHREADED);
Badaboom, no more error. Use COINIT_APARTMENTTHREADED if you call this on the main thread of a UI thread. CoUninitialize() at the end to clean up.
Explaining it is difficult, initializing COM should not be necessary when you use MIDI. With it in place, calling midiOutOpen gets one more DLL loaded, clbcatq.dll. That's a COM+ support module. So sure looks like Win10 requires COM to be initialized.
I put a MessageBox (with nothing important to say) just before midiOutOpen, and IT WORKED!
I'm using Visual Studio 2013 C++.
WASAPI doesn't work for me anymore in sharing mode, although I think I'll be able to make it work.
When I use the CoInitializeEx(NULL, COINIT_MULTITHREADED), this helps for the midi open problem but has bad influence for using mciSendString with opening an MP3 song, which results always in error 266 in same program. Eg.:
open "d:\\music\\Fernando.mp3" type MPEGVideo alias Fernando.mp3 wait
(without the CoInitializeEx this open works and the mp3 song plays in Windows 10).
On some Windows 10 Systems the midi and mp3 open well without calling the CoInitializeEx, on others it does not play midi. It is not documented in MCI api that it must be called and causes indetermined problems. For me it is not clear when or why it must be called and when I should better not call it.
The Windows 10 incompatibility relating MCI of Microsoft is intolerable.
All Systems since XP are MCI compatible and only Windows 10 causes troubles.

D3D11 CORRUPTION: ID3D11DeviceContext::RSGetScissorRects

Starting roughly two days ago, every D3D11 application I've run has exploded within the first 30 seconds of being started [including code I've never touched].
I'm using Visual Studios 2013 with the Windows 8.1 SDK installed [reinstalled today for good measure].
Since it's a D3D error, it only explodes in Debug, but a crash somewhere is a problem somewhere else.
D3D11 CORRUPTION: ID3D11DeviceContext::RSGetScissorRects: First parameter out of range. [ MISCELLANEOUS CORRUPTION #13: CORRUPTED_PARAMETER1]
I've never used ID3D11DeviceContext::RSGetScissorRects for any purpose ever. I don't even know what parameters it takes in, spits out, what it does or any combination of otherwise.
Since there's a ID3D11DeviceContext::RSGetScissorRects I assume there's a ID3D11DeviceContext::RSSetScissorRects as well, but as with ID3D11DeviceContext::RSGetScissorRects, I don't know what it does.
Since it's relatively important for me to be able to Graphics, what's the potential solution for this problem?
This is my current DirectX11 initialization as it stands.
Members of my team are able to run our DirectX11 Application for hours without problems, but when it's passed to my machine via USB...explosions
Any help would be greatly appreciated.
As per comments, in your call stack "ltc_game32" appears to be attributable to Raptr, which is part of AMD Gaming Evolved. This has hooked your D3D11 application to provide some sort additional capture/record functionality and appears not to run "clean" with regards to the D3D11 Debug Layer.
Try uninstalling Raptr from the Control Panel to remove this additional "feature" of the driver and see if the problem continues to occur. It may also be sufficient to simply close AMD Gaming Evolved from your task tray and see if the problem goes away.

Works when run from Visual C++ but sometimes not standalone

The actual question: what are the differences between running in Visual C++ 2010 (both release and debug mode) and standalone, excluding anything that couldn't cause the problem stated at the bottom of this post?
I have a very specific problem with my program, so I am not going to post the code. If you would like to know details of the problem to gain some understanding, I post them at the bottom. Instead, I ask: what are the differences in running in visual c++ and standalone?
I am using Visual C++ 2010, and my program is using SFML 2.0. It runs fine in studio (I am calling it studio because it is easier to type), but when run standalone on some computers only a bug will occur within the program, to do with movement being delayed but other parts not. I cannot find any links between the computer specs of the users who test it and whether they work or not.
All dlls and such are included (at least, I think they are - the program runs fine, as detailed at the bottom - maybe some users have some framework installed?). On my computer, it works all the time in studio but not standalone. On my netbook, it works, on my older computer, it doesn't. The only project settings I changed with vc++ directories and linker settings.
Problem details:
All the sounds sound slightly different and there is a possible high pitched background noise. Character movement, enemy movement and space bar delay which is supposed to be 0.5 seconds is increased to about 5 seconds but "generating pixels" (an aspect in the game with the arrow keys isn't.
I'm stressing again that it only happens on SOME COMPUTERS, mine included, but always works when run within studio. A number of people have tested the game, and some reported the problem and others different.
[NOT THE MAIN POINT OF THE QUESTION BUT HERE IS AN EXTRA BIT: If you are so willing to help me that you wish to look through the entire source code, it's here: http://dl.dropbox.com/u/53835113/EVERYTHING.zip [note: ignore the massive amount of bugs and memory leaks other than the problem described :P]]
EDIT: THE POINT ISN'T THAT I WANT MY PROGRAM DEBUGGED! That is an optional extra. The question: what are the differences in running in visual c++ and standalone?
More edits: Found that the problem is due to the frame time not being correct. Not sure if this provides some insight.
Thanks to anyone who tries to help me!
GetFrameTime() in SFML was removed in a recent version because it returns the time since last frame rather than the time since last update. As a result, the it may return 0.

OpenGL stopped rendering

First things first: Platform is Windows 7 64-bit, language is VC++, IDE is VS2010. Graphics card is nVidia GTX 460, drivers are version 290.53.
So here's the situation. I am currently working in OpenGL using Glew 1.7 and Glut. I set everything up a few days ago and managed to successfully code and complete an assignment for my classes. The assignment ran beautifully and displayed and did everything it was supposed to. That was wonderful. So I submitted my assignment and didn't touch it again until tonight.
Now, tonight I tried running the code again and instead of my beautifully tessellated polygons I am getting a plain white window. As far as I know, nothing related to OpenGL has changed on my system since I last ran the code. I haven't changed the code at all, I haven't changed the graphics drivers, I haven't changed anything that I am aware of. I couldn't seem to find anything related to this kind of problem, and I am at a loss of what could possibly be causing the issue. I even tried recompiling Glew, but it didn't change anything. I know it's not a code issue since it was working fine a few days ago and nothing has changed, so it has to be a configuration issue.
Could someone please point me in the right direction?
Edit
One more thing to add to this. When I was originally doing the project in question, attempting to run it produced the error message "unable to find glew32d.dll" until I placed glew32d.dll and glut32.dll in the source folder of my project.
Now, I don't remember deleting them from my project folder, but when I tried to debug it last night, I noticed that both of them had disappeared from my project folder. However, I was not getting any .dll missing errors. Replacing them in the folder didn't solve the problem, but I am wondering if their disappearance has something to do with this. They are also located in the VC/bin/ directory of the VS2010 install path, and deleting them from both locations produces the error message, but having them in either location is now sufficient for building and running when previously I needed them in both.
One possibility is that you're scaling by an infinite value (1.#INF), or something of the sort. I've run into a very similar situation, and that turned out to be the problem. However, if you have not changed the code, then you may be able to rule this out. Have you tried throwing in some code to render a simple quad or triangle to the screen?
As for the .dlls, I recommend putting them in your C:/Windows/SysWOW64 and C:/Windows/System32 folders. SysWOW64 specifically houses all the 32-bit .dlls, but it's safe to put them in both locations. Visual Studio will look in both your project folder and these system folders for necessary dynamic libraries. The advantage of placing them in the system folders is that they are then available for all OpenGL applications you may write.
One last thing that might help in finding the issue is making use of OpenGL's error reporting. You can use a function such as:
void HandleGLError()
{
GLenum error;
int i = 0;
while ((error = glGetError()) != GL_NO_ERROR) {
printf("GL ERROR(%d) %s\n",i,gluErrorString(error));
i++;
}
}
Try calling that at the beginning and end of your render function, and in any other places you think might be causing a problem.

Invalid lock sequence error in an OpenSceneGraph application

I have an application that is built against OpenSceneGraph (2.6.1) and therefore indirectly OpenGL. The application initializes and begins to run, but then I get the following exception "attempt was made to execute an invalid lock sequence" in OpenGL32.dll. When I re-run it, I sometimes get this exception, and sometimes an exception about a "privileged instruction". The call stack looks like it is corrupted, so I can't really tell exactly where the exception is being thrown from. I ran the app quite a bit a couple of days ago and never saw this behavior. Since then I have added an else clause to a couple of ifs, and that is all. My app is a console application, is built with Visual Studio 2008, and it sets OpenScenGraph to SingleThreaded mode. Anybody seen this before? Any debugging tips?
Can you reproduce it with one of the standard examples?
Can you create a minimal app that causes this?
Do you have a machine with a different brand video card you can test it on (eg Nvidia vs. ATI) there are some issues with openscenegraph and bad OpenGL drivers.
Have you tried posting to osg-users#lists.openscenegraph.org
The problem turned out to be our app was picking up an incorrect version of the OpenGL DLL , instead of the one installed in System32.