PDA

View Full Version : OPEnGL low picture quality



zulunation
22nd October 2014, 19:55
Hi all,

I'm using Qt 5 on WInXP 32 bit.
I'm rendering bitmap image in the window.
The problem is that the quality of the picture is poor. I have made the program using WInAPI and OpenGL and the picture looks like original.
It seems that the resolution of the picture is low.
I have tryied to change the QSurfaceFormat. The strange thing when i get it from the QWindow the Red/Green/Blue buffer sizes are set to -1.
I have changed the surface format like the following:



m_context = new QOpenGLContext(this);
QSurfaceFormat format = requestedFormat();
format.setBlueBufferSize(8);
format.setRedBufferSize(8);
format.setGreenBufferSize(8);
format.setAlphaBufferSize(8);
format.setDepthBufferSize(8);
format.setRenderableType(QSurfaceFormat::OpenGL);
format.setSamples(16);

setFormat(format);
m_context->setFormat(format);



The quality is still low.
Here is the screenshot.

10690

The upper is rendered using QT engine the lower is from my WinAPI application.
I can't exactly understand why the upper image looks poor? Is that color or resolution problem?
It seems to me that the pixel sizes on the upper image are bigger.

wysota
23rd October 2014, 08:50
Please provide a minimal compilable example reproducing the problem.

zulunation
23rd October 2014, 11:51
Hello wysota,

I have simplified the problem.
I draw a short vertical line and i see that the thickness of this line is two times bigger than it should be.
I have attached two source files.
I'm trying to change surface format but it has no effect.
Maybe it is sampling problem but it is disabled by default.
Let me know if there is a problem with compiling the sources.

ChrisW67
23rd October 2014, 12:20
In your original images it looks like the top button has been scaled up from its native size, and the lower image has not. The interpolation and anti-aliasing that results could easily lead to blurry results.

zulunation
23rd October 2014, 15:07
I have solved the problem with the line thickness. I forgot to add 0.5f to the coordinates.
But the bmp is still blurry.
How could i disable interpolation and anti aliasing?

I have solved the problem with the line thickness. I forgot to add 0.5f to the coordinates.
But the bmp is still blurry.
How could i disable interpolation and anti aliasing?

Added after 54 minutes:

Now i'm sure that there is interpolation problem.
I have compared two pictures.
To the right there is colors are interpolated.
It seems that QT OpenGL doing that by default.

wysota
23rd October 2014, 15:21
Qt is not issuing any OpenGL calls. You are.

zulunation
23rd October 2014, 16:06
Yes but i don't do any specific calls. The native WinAPI application shows no interpolation with the same code.

wysota
23rd October 2014, 17:42
Apparently the code is not the same. To me it seems the second image is still stretched while the first is not.