<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>openGL guru needed, masking problem :S.</title>
		<link>http://www.allegro.cc/forums/view/594450</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 21 Dec 2007 17:43:28 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>EDIT: the problem was that i had forgotten to enable alpha testing..</p><p>Notice that some invisible quad seems to block out the pixels of those behind it?, this invisible quad is the masked area of the bomb which you should also be able to see, for some reason this happens to objects if they are drawn after and behind a masked quad, as you can see the ground is unaffected because it&#39;s drawn before the bomb and the player. I use a custom view port and orthographic view, except from that everything is as it usually is when it works <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />..</p><p>This seems like the kind of problem people know the answer too, so any ideas?</p><p>Kisses <img src="http://www.allegro.cc/forums/smileys/kiss.gif" alt=":-*" />// A.P.E
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Albin Engström)</author>
		<pubDate>Wed, 19 Dec 2007 23:29:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Don&#39;t ever post screenshots in BMP format.</p><p>As for the solution: turn off depth writing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Wed, 19 Dec 2007 23:46:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>EDIT: woops.. forgot to enable alpha testing....</p><p>It was so small it thought it wouldn&#39;t matter <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />, won&#39;t happen again!</p><p>Turning off depth testing would pose another problem.. the depth?! :S<br />(tried it of course, unfortunately no unexpected results <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" />)</p><p>But it has to be something about the depth :/</p><p>I&#39;ve used ortho and depth testing before and these problems didn&#39;t show up :/.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Albin Engström)</author>
		<pubDate>Wed, 19 Dec 2007 23:48:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As far as I can get it to work, transparency needs depth testing turned off, and you have to draw all the transparent objects after all the others, and you have to sort the transparent objects by distance.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Thu, 20 Dec 2007 02:05:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You don&#39;t have to if you use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Albin Engström)</author>
		<pubDate>Thu, 20 Dec 2007 16:30:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://sjbaker.org/steve/omniv/alpha_sorting.html">YAOL (Yet Another Obligatory Link)</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Rash)</author>
		<pubDate>Thu, 20 Dec 2007 20:38:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s really easy to save as a png. Chances are, you have to paste your screenshot to save it anyway, even mspaint will save to a png quick and easy.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Fri, 21 Dec 2007 05:05:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Haven&#39;t bothered looking at the screenshot, but here&#39;s the thing.<br />When you have a masked polygon, you want depth testing anyway, and probably alpha blending as well. If the non-masked areas of the polygon are supposed to be solid, you also want depth writes - but ONLY FOR THE SOLID PIXELS. Which means you need alpha TESTING, not only alpha BLENDING: alpha blending always &quot;writes&quot; the pixel; if its alpha value is zero, it will still write to the depth buffer.<br />So here&#39;s what you want:<br /><b>Solid polygons</b>: Disable alpha testing and blending. Enable depth test and depth write.<br /><b>Masked polygons</b>: Enable alpha testing, disable blending. Enable depth test and depth write.<br /><b>Blended polygons</b>: Disable alpha testing, enable blending. Enable depth test, disable depth write.</p><p>You may want to enable alpha blending on masked polygons; this will give you smoother edges where a masked pixel and a non-masked one are next to each other, but because the alpha test can only ever result in &quot;accept&quot; or &quot;reject&quot;, the depth testing that happens afterwards will lead to slightly incorrect results (halfway masked pixels obscuring solid pixels from other polygons). So I&#39;d suggest you turn off blending for these, and let the graphic driver&#39;s scene anti-aliasing handle this for you.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Fri, 21 Dec 2007 17:43:28 +0000</pubDate>
	</item>
</rss>

