Wahts about OpenGL & Pixelformat?

Hello, I’m wondering about the creation of a opengl window where I set
the pixelformat
depending on the bith-depth but after checking the pixelformat of the
create surface again,
it’s always 8888 ?

It’s regardless on which system I try the code … it’s always the
same. Maybe I’ve just
done somethong wrong and someone could take a short look at my code
which I uploaded
to my littel homepage:

http://ww.anegma.com/gl-init.cpp

Thanks in Advance,
Gunnar

Gunnar Pietz wrote:

Hello, I’m wondering about the creation of a opengl window where I set
the pixelformat
depending on the bith-depth but after checking the pixelformat of the
create surface again,
it’s always 8888 ?

It’s regardless on which system I try the code … it’s always the
same. Maybe I’ve just
done somethong wrong and someone could take a short look at my code
which I uploaded
to my littel homepage:

http://ww.anegma.com/gl-init.cpp

No, it’s not always 8888. You can control the pixel format using
SDL_GL_SetAttribute, but this only sets the minimal requirements.
Note that most systems return a pixel format of the current color depth,
i.e. systems running at 32bpp return RGBA8 while systems running at
16bpp return RGB565. This does not mean other formats don’t exist, and
you can encounter RGBA10 or more on high-end machines.

So, my take on this is symply that all the systems your tried your code
on are running at 32bpp.

Stephane

What you should try, assuming it’s the m_windowDepth variable giving
trouble, i’d suggest at the beginning of the function setting the
value…then if the log is that value, then it’s safe to assume that the
value just isn’t being set.

Alex~