Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Viewport — Gideros Forum

Viewport

totebototebo Member
edited February 2017 in General questions
Is Viewport a good alternative to RenderTarget CPU wise? My use case is showing items outside of the screen area at the edge of the screen, like waypoint arrows but with the actual gfx scaled down to fit inside an arrow.
My Gideros games: www.totebo.com

Comments

  • hgy29hgy29 Maintainer
    If you would have refreshed your RenderTarget each frame, then yes Viewport will be more efficient, not CPU wise but GPU wise. You save the need for draw your render target on screen.
  • That's a bit of magic right there. So on a mobile phone it's likely to be a small hit in performance?
    My Gideros games: www.totebo.com
  • No, it's likely to be faster.

    The reason is that with render target you have to first render to the texture, then render the texture onto the screen. With the viewport you point to your list of sprites then put the viewport on the screen.

    A disadvantage is that viewports cannot be rotated (as far as I know, I might be wrong), but a render target can be as it's a regular sprite.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • hgy29hgy29 Maintainer
    @SinsiterSoft, Viewports can be rotated, scaled, translated, you can apply any transform matrix you like.
  • totebototebo Member
    edited February 2017
    Guys, Viewport appears to be a hidden gem! Can't wait to start playing with it.
    My Gideros games: www.totebo.com
  • @hgy29, so I can have a viewport that is a square, but tilted by 45 degrees and the clipping will work ok so that it looks like a diamond shape on the screen?
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • hgy29hgy29 Maintainer
    @SinisterSoft, no you can't because clipping only works with screen axis aligned rectangular regions. This is not a viewport limitation however, but rather a clipping one.
  • I'd have to render it to a rendertarget then show that sprite on the screen then.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
Sign In or Register to comment.