OpenGL Performance on Windows

Hey folks, I stumbled upon this thread and it is quite similar to the problem I am having right now.

I made a component that inherits OpenGLRenderer. Inside the renderOpenGL() method I want to pass content that was created in another class to an OpenGLTexture and by that to the OpenGLShaderProgram.

In the renderOpenGL() it looks somewhat like this:

anotherClass->createContent();
    
openGLTexture.loadImage(*anotherClass->getImagePointer());
openGLTexture.bind();
texUniform->set(0);

It works, but uses up all of my machines capacity and I'm quite sure this is because of the call to .loadImage(). Is there a better way to do this? Note that I already made the Image in "anotherClass" of the type OpenGLImageType.

Help is appreciated!

I think it will always be a bad idea to call loadImage in the renderOpenGL() method. The renderOpenGL method should be as light-weight as possible. I think the correct solution is more complex: you'll need a sort of of texture FIFO: one thread loads and pushes new images into the available texture units, while the renderOpenGL() will simply render the correct texture unit depending on the current time. Does his make sense?

I see. So the renderGL() should really only render the textures, the processing of the images should happen in another thread.

How could I change the textures on my GPU? Are Image-Objects of type OpenGLImageType a correct solution? How can I pass them to the shader as an Sampler2D?