Advertisement

3D acceleration or depth buffer?

Started by April 07, 2003 05:58 AM
7 comments, last by Blowin 21 years, 10 months ago
Hi all, i am the author of the Blowin''Flower screensaver (you can download it from the download section on this site), and now i have a problem with it. The only machine where i had seen my screensaver was the mine and it runs quite good on it, but yesterday i have seen it on two different computers and it runs very bad, there is a lot of z-fighting (there are holes in the petals like if there is confusion on what polygon draw and what not), and background is not displayed at all (this is the worst thing). Now, since my machine is without a 3D accelerated video cards and the two ones where i''ve tryed the screensaver are equipped with a geforce class video card, i thought that the problem was in the 3D acceleration. So i''ve written a version that forces software rendering (with a nice routine i''ve found on opengl.org) but it still doesn''t work.. you can download the updated version here: http://www-und.ida.liu.se/~marfr960/ Maybe the problem is in the wrong use of the depth buffer, i don''t know.. Both the releases are provided with source code, so, if you want you can take a look. Is there anybody that know where can be the problem and how to solve it? Greetz, Marco
Many OpenGL drivers force a depth buffer bit resolution that is related to the display bit resolution. If somebody is running their desktop at 16bit colour, this will often result in a 16bit depth buffer being used. To get a 24bit depth buffer, make sure you explicitly switch the display to 24/32bit colour (and specify it in your pixel format description as well).

Kippesoep
Advertisement
mmh.. i guess it''s not a problem of how many bits are used for the depth buffer because:
. the screensaver works fine even with 8 bit depth buffer (on my machine)
. the accelerated machines on which i''ve tested it have 32 bit display colors setted..

however i''ve forced 24 bit depth buffer with software rendering and nothing is changed..


this problem makes me mad.. :/
Z fighting can''t be solved with the zbuffer.(z-fighting is a roundoff error when two polygons are on the same plane but not the same size)
I suggest adding a little offset between the polygons or making shure they use the same vertic''s(if possible)
It looks perfect on my system (Intel P4, WinXP, GeForce 3) in 32bit mode. When I switch to 16bit mode, everything is screwed up (I don''t mean Z-fighting, but polygons in the wrong place and a really low frame rate [looks like 0.5fps]).

Kippesoep
I looked at the sourcecode and your using the polygons the wrong way.

the polyogn must be made so that if you take a line from any point to any point it will never cross the edges of the polygon.

It must be flat to.
Advertisement
aaaaaaaaaaah,
i''m so satisfied, the problem is fixed.
The error was... in the BLENDING FUNCTION!!! For some odd reason with
glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);
doesn''t work on some cards, while with
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
all goes in the right way

I have updated once again bin & source code if you want to get it at
http://www-und.ida.liu.se/~marfr960/

thank you very much guys, you are super!

PS Kippesoep try now, it should work even with 16 bit colour depth..
quote:
Original post by Blowin
PS Kippesoep try now, it should work even with 16 bit colour depth..

Yep, much better.


Kippesoep
Blending is funky if you''re not in 32 bit mode. I''ve noticed that all of gametutorials.com''s examples run really slow in windowed mode unless you are in 32 bit mode. I imagine theres more to it than just enabling blending but thats one of the causes or so it seems.

This topic is closed to new replies.

Advertisement