Or maybe upgrade the graphics card. I don't have experience with that though, so I can't say for sure. Though that'd definitely would cost a lot. Or maybe it's a driver bug, which sucks too.
================
I mentioned about a High Performance power setting option in my last post. Wanted to go more into that today.
When I did the Multiple Lights tutorial on Learn OpenGL maybe a long time ago, I was pretty sure I got no errors, code wise. However, when I ran the program, it crashed. This was on a x64 Release build of the project.
I was really sure the code had no errors. I admit I was just copy n pasting code haha. Though I was just learning OpenGL for the first time. I still am new to GL right now as I'm writing it. (As long as the code works, even with copy n paste, I'm still happy with it. I'll go back to it one day and look at it more.)
I tried to run it in Debug mode in VS 2015, got this:
Even odder. When I first saw it, I found 'ig7icd64.dll' to be an interesting file. I found that in C:\Windows\System32. (Now even that's odder! I remember figuring that out for the first time, that 64-bit applications ran using dlls from the System32 folder, while 32-bit apps ran using the SysWOW64 folder. That took a long time to figure out, was a nightmare haha. I think this msdn link and stack overflow link explain what's going on well.)
I remember I even tried to look for files with the same name in other directories in my computer, and I even tried to download a .dll of the same name somewhere. I tried to temporarily replace the .dll, but nothing worked. I got other errors. So I replaced the original .dll.
Anyways, this was really puzzling me. If I remember right, back then, I also tried to mess around with the fragment shader. I found that there was a threshold to the amount of light struct objects I could instantiate in the shader. So for example, given the struct:
struct PointLight {
vec3 position;
float constant;
float linear;
float quadratic;
vec3 ambient;
vec3 diffuse;
vec3 specular;
};
If I was to make an array of maybe like 4 to 7 of these struct objects, the program would crash. Like it was just a one-liner like "PointLight array[3];" in the shader's main() function. However, if I instantiated a single struct object, it wouldn't crash. I'm still not sure about the reasoning behind this. I did some searching on that, and I think what I found was that the members of the struct object are like uniform variables, and the graphics card has a max amount of uniform variables allowed when running with OpenGL.
This was still super confusing. The most interesting part is that I tried it in my dorm-mate's computer, same 64-bit build .exe, and it worked on his. And I tried it on a university library computer, and it worked on that one too! (Ironically, it didn't work on a computer in the student center computer lab lol. If I remember right, it wasn't even the same error, like some glfw error.)
Side note:
I used VS 2015 to make these builds. I found out I had to make sure to include any image files and shader files in the same directory as my .exe. I also had to include the correct .dlls. In general, I found you need these .dlls with your .exe:
64-bit build Release:
C:\Windows\System32\msvcp140.dll
C:\Windows\System32\vcruntime140.dll
64-bit build Debug:
C:\Windows\System32\msvcp140d.dll
C:\Windows\System32\vcruntime140d.dll
32-bit build Release:
C:\Windows\SysWOW64\msvcp140.dll
C:\Windows\SysWOW64\vcruntime140.dll
32-bit build Debug:
C:\Windows\SysWOW64\msvcp140d.dll
C:\Windows\SysWOW64\vcruntime140d.dll
Anyways, jeez, so I realized that it was something to do with my laptop. I was pretty bummed out at first. (I can't upgrade/change graphics cards in my laptop. They're like "integrated" into the laptop.)
After more thought, though, I found out that my laptop has switchable graphics. When I right click in my desktop, I got this:
Here's the window that comes up afterwards:
Lol I never knew I had this before, even the fact that I had 2 graphics card in my laptop. When I first saw it, the Graphics Setting was at "Not Assigned". When I changed it to Power Saving, clicked Apply, and tried running it again, it crashed. So I assumed "Not Assigned" led to the Power Saving option at the time, even though I'm pretty sure my laptop was plugged in at the time. However, when I changed it to High Performance, it ran, the 64-bit build Release! I was so happy! : )
It ran on my desktop, ran from the USB, it was awesome. Looking back at the Device Manager and Display adapters section, I know now I have 2 graphics card. I'm pretty sure, when talking about the switchable graphics program above, that they correspond like this:
Power saving: Intel(R) HD Graphics 4000
High performance: AMD Radeon HD 7570M/HD 7670M Graphics
So ya, that was it. I always have that .exe set to "High performance". That was quite the interesting time figuring that out, especially the fact that my laptop had 2 graphics cards. Didn't even think of the idea before haha.
No comments:
Post a Comment