I want to draw image on my OpenGL component and stretch it to the size of the component so the width and height will be same as bounds of component. And I can’t understand the logic of the copyTexture method. My picture appears+/- 25 percent shorter or larger for some other images. Is this a bug or I do something wrong? My code below:
void MyComponent::render() {
const float desktopScale = (float) openGLContext.getRenderingScale();
glViewport(0, 0, desktopScale * getWidth(), desktopScale * getHeight());
OpenGLHelpers::clear(Colour::fromRGB(33, 33, 33));
backgroundTexture.bind();
Rectangle t (648, 988); // size of my PNG image
auto b = getBounds();
Rectangle bSize(b.getWidth(), b.getHeight());
openGLContext.copyTexture(t, bSize, b.getWidth(), b.getHeight(), false);
}
Thank you. Below you can see result of drawing. I added two same components.