Archived

This topic is now archived and is closed to further replies.

A little polygon problem...

This topic is 5881 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hey guys, i have a problem. i''m trying to draw a texture mapped blended box, with a sqaure hole in the middle of each wall. so i used 4 quads for every wall, leaving a hole in the middle, but the polygons don''t connect smoothly... and u can notice it especially while rotating the scene. i''m sure there''s a simple solution for this.

Share on other sites
you could map a texture onto the quads, where in the middle a box is cut out (alpha == 0), so one can see through...

Share on other sites
What do you mean by "do not connect smoothly" ?
You mean the quares between them, or the holes ?
At best, could you give a screenshot ?

The texture solution might not work depending on the problem. Moreover, it would cost more memory, more gpu time, and would need multitexturing if the cube already have a texture mapped. So, I''d recommend using it as a last resort.

Share on other sites
Using 4 quads by wall is your mistake. Doing that, some vertices are connected to the border of a quad, while maths used for drawing the poly on screen aren't perfect, the vertices don't stay on the border of the quad.

To avoid this, make your wall using 8 quads like this :
  |--|--|--||@@|@@|@@||--|--|--||@@|##|@@||--|--|--||@@|@@|@@||--|--|--|

(the @ are textured quads, the # is the whole)

Edited by - Melgo on January 16, 2002 7:01:47 AM

Share on other sites
Melgo, if you draw :
  +--------+|\@@@@@@/||@\@@@@/@||@@+--+@@||@@|##|@@||@@|##|@@||@@+--+@@||@/@@@@\@||/@@@@@@\|+--------+

The connection seems to be same (at least, geometrically).

Share on other sites
I think it works too.

The trick is just to avoid things like this :

  |--------||@@@@@@@@||--|--|--||@@|##|@@||--|--|--||@@@@@@@@||--------|or this|-----|--||@@@@@|@@||--|--|@@||@@|##|@@||@@|--|--||@@|@@@@@||--|-----|

cause the polys won''t stay connected when you''ll translate, rotate or scale the scene.

Sorry if you don''t understand all, i read english a lot better than i write (that''s why i draw littles pictures in ascii)...

Share on other sites
This is commonly refered to as the "T-Junctions" problem.

Y.

Share on other sites
Thanks alot Melgo! that solved the problem, it''s good 2 know these things. this forum is the best resource around for openGL programmers!