SFML community forums
Help => Graphics => Topic started by: phoekz on December 02, 2011, 11:18:06 pm
-
Hey
In short, how would I go about partially hiding sf::Shape::Line objects like sprites (setsubrect). The picture below explains my intents.
The map screen is scroll-able so the elements inside this frame are moving and obviously when they reach border of the frame, they will be hidden and not drawn at all.
(http://i40.tinypic.com/25ib60h.png)
-
I think best solution is to calculate the intersection between the lines and the edge of the map display. :)
-
(SFML2) Draw the map to a rendertexture and draw that with a sprite onto your HUD/UI.
-
(SFML2) Draw the map to a rendertexture and draw that with a sprite onto your HUD/UI.
Wow that was genius, didn't even know you could do that :D.
-
You could use glScissor: it will only draw objects which are within a rectangle area.
It's really easy to use:
glEnable(GL_SCISSOR_TEST);
glScissor(right_x, bottom_y, width, height);
// draw your stuff
glDisable(GL_SCISSOR_TEST);
documentation: http://www.opengl.org/sdk/docs/man/xhtml/glScissor.xml