So I wanted to change the color of the background of my scene and add a textured one.
I started by drawing a simple Quad and then I changed its coordinate that it can cover the whole scene.
When I added the texture, I made sure to add filters also to have a nice resolution however the background image (texture) seems to be extremely fuzzy.
texture1 = new QOpenGLTexture(QImage("C:/Users/gigi/project/app/space.jpg"));
texture1->setMinificationFilter(QOpenGLTexture::Nearest);
texture1->setMagnificationFilter(QOpenGLTexture::Linear);
texture1->setWrapMode(QOpenGLTexture::ClampToBorder);
Here is how I specified the filters. Still the image is very fuzzy whenever i try to increase its size by changing the coordinates of the quad.
I think it’s all about using the right filters or something like this ? Am I right ?
You have everything hidden behind wrappers, so you’re making it impossible to determine if your actual OpenGL code is good or bad. Could you just show the actual OpenGL code instead, please?
Resolution is also a factor. If by “fuzzy” you mean “noisy”, then you should use QOpenGLTexture::LinearMipMapLinear as the minification filter. If you mean “blurred”, then you need a higher resolution image.
He’s using Qt.
Arguably the question belongs on a Qt forum, although they’d probably suggest an OpenGL forum. FWIW, the Qt source code can be found here.
Humm I tried the QOpenGLTexture::LinearMipMapLinear , but the resolution is still not good.
I made some researchs and appearently there is something called skybox that people use to set a custom background for their scene.
I thought that, if I could render a textured cube, then I could simply render a quad and change its coordinates in such a way that it covers the whole scene and then add a texture to it. Turned out that it was even more complexe than I expected.
Also, yes I’m using Qt and OpenGL classes that already exists in Qt.
how big is your texture, and how big is your window?
thats not how you render a skybox usually. instead, you render a textured cube “around” your camera and use a “cube texture” (thats not a 2D texture type)