2D clipping problem - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: 2D clipping problem (/thread-5853.html)
2D clipping problem - McSebi - Feb 22, 2005 01:55 PM
Hi, this is my code for creating a context for a 2D view:
glViewport(0, 0, window_width, window_height);
glOrtho(0, window_width, window_height, 0, -1.0, 1.0);
Everything looks ok, but every quad with negative coordinates will now be clipped away, which make objects disappear too soon when moving out of the window left or up.
I do it like this:
if rect.GetLeft() or rect.GetTop() is lower than 0 the whole rect won't be drawn even if parts of it should be visible!?! Why that?
2D clipping problem - arekkusu - Feb 22, 2005 03:04 PM
What hardware/OS is this happening on?
2D clipping problem - McSebi - Feb 22, 2005 07:28 PM
OS 10.3.8 G5 tower with ATI 9600 card
2D clipping problem - arekkusu - Feb 22, 2005 10:28 PM
That definitely should not be happening. Are you sure your coordinates are valid all the time? (i.e. GetRight() returns a short, not an unsigned short?)
If the project is small, and doesn't depend on any weird 3rd party libraries, post a link to an archive and we'll take a look.
2D clipping problem - McSebi - Feb 22, 2005 11:37 PM
Thanks for this offer. I've figured it out... It was not in my drawing code. I've found out my draw function was not called at all when coordinates were negative...