I am currently writing a program which is causing high cpu usage (24% by itself) and 100% gpu usage.
It seems to me that it is inefficient to run the program through a loop which does a whole lot of the same thing over and over. 99% of my current program, is things that never change. My current model has no moving parts yet, unless you count the occasional rotation applied by keystrokes, but even that doesn’t change the model, it only changes the way you see it. So what I have is a whole lot of things that never change and a camera angle that changes infrequently.
It seems to me I should have no gpu usage. The irony is that I learned OpenGl long ago, right about the time of its inception. I still haven’t learned the new core/shader stuff. I’m using GLFW which, I am often told doesn’t utilize the hardware. Then why is it at 100% usage? lol.
Off topic: So, what am I doing that is causing this high gpu/cpu usage?
I think a lot of it is from applying portions of one large texture to a lot of different triangles. I’m pretty sure that is where the cpu usage is coming from, because to do that, I have to do a lot of cpu math to select the correct portion of the texture. I suppose that might be causing the GPU usage too as I am constantly feeding calculations into tex coords and vertices. That also seems inefficient to me. I initially tried to set some anchor tex coords, figuring the texture would be properly wrapped across all of my triangles just from 4 corners. Nope. Every single vertex needs to be given its own tex coord. I feel like it should only need 4. Given a 2d texture, applied on a 3d surface it already has the range of x and y. The vertex of each corner tex coord could set those boundaries. I don’t think the CPU should have to do that. I could massively lower the CPU usage by saving the tex coord parameters along with my vertices. Memory isn’t currently an issue I’m using very little actually, but saving 5 points of data for each vertex seems inefficient too.