PDA

View Full Version : Why the rendering color seems not smooth?



doggle
03-18-2004, 09:27 PM
I program on WindowsXP platform.

and set PIXELFORMATDESCRIPTOR members like such.

PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number
PFD_DRAW_TO_WINDOW | // support window
PFD_SUPPORT_OPENGL | // support OpenGL
PFD_DOUBLEBUFFER, // double buffered
PFD_TYPE_RGBA, // RGBA type
24, // 24-bit color depth
0, 0, 0, 0, 0, 0, // color bits ignored
0, // no alpha buffer
0, // shift bit ignored
0, // no accumulation buffer
0, 0, 0, 0, // accum bits ignored
32, // 32-bit z-buffer
0, // no stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0 // layer masks ignored
};

and then go on ChoosePixelFormat(...) and SetPixelFormat(...)

Every thing seems OK!

I check the pixel color format with code:
glGetIntegerv(GL_RED_BITS, &iParam);

And iParam is 8(bit);

But the rendering color is not smooth, looks just like in 256 color!

Why?

Thank you!

Doggle

Relic
03-18-2004, 09:51 PM
Not enough informations to answer. What and how do you draw?
Do a DescribePixelFormat() and check the other fields in the pixelformat.
Try a simple triangle with three different colors at the vertices with lighting disabled.
Make sure glShadeModel is set to the default GL_SMOOTH for Gouraud shading.

doggle
03-18-2004, 10:21 PM
Thank you, Relic!

I have tried the function DescribePixelFormat(), the result is correct: 24 bit color depth, r, g, and b each share 8 bit.

I render a 3D model with texture.

I'm sure the model is correct, because I render it with 3d explore, a application programme, the result is smooth.

It seems irrelevant to pixel format...

I'm trying other things ...

As I trying to draw an image in OpenGL with glDrawPixels(...), the image is strangely thrink! I think maybe the texture image is thrinked too, what makes the rendering looks not smooth.

Doggle