Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Speed boost... — Gideros Forum

Speed boost...

SinisterSoftSinisterSoft Maintainer
edited May 2015 in Code snippets
I was chatting with Nico, John, Arturs and wondered about the need for clearing the backbuffer - if you game used a non-transparent tilemap or has an image covering the background - as not clearing it would give a speed boost and could even be used to add some nice special effects...

Anyhow Nico found an undocumented command!!!

stage:setClearColorBuffer(false)

This will stop the back buffer from clearing, true will turn it back on again. There is a corresponding getClearColorBuffer() too.

:)

Likes: hgy29, MobAmuse, pie

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
+1 -1 (+3 / -0 )Share on Facebook

Comments

  • piepie Member
    speaking about speed boosts: :)
    may setClip() - which i haven't had the time to test yet - be used to draw only the "needed" (on screen) portion of stage? or this is already managed by gideros?

    At this time I am checking at any screen movement if there are things I can hide outside screen boundaries, but setClip could change things a lot: do you know anything about its performance?

    thank you
  • SinisterSoftSinisterSoft Maintainer
    opengl won't write to memory outside the frame buffer anyway (else it would destroy textures) - so I guess that will automatically be doing the same job as setclip, but I don't know how far up the chain setclip is - if it will be more efficient or not.
    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
    setClip relies on glScissor function, which prevent pixels from being drawn in framebuffer outside a specific window. Since its done on final screen coordinates, we can expect that there won't be performance improvement at all.
    If things must be hidden, better not insert them in stage at all until they should actually be visible.
  • piepie Member
    @hgy29 my "problem" is that I have a tilemap with a lot of sprite objects placed all around: since it can be dragged around and zoomed in/out too, I need them already placed on stage (keeping them there is better than removing and placing a lot of objects together)
    Up to 2014.10, I noticed that i had a speed improvement if I hid some kind of objects instead of keeping them as they were.
    If you say that glScissor is already applied to screen boundaries maybe I am wasting resources :)
  • totebototebo Member
    stage:setClearColorBuffer(false)
    When NOT using solid bitmaps... freaky! :)
    My Gideros games: www.totebo.com
  • SinisterSoftSinisterSoft Maintainer
    On Windows it looks ok (but freaking) - on a couple of Android devices I've tried the frame buffer keeps changing places all over - so the effect doesn't work quite as well.

    It can be reproduced though using a render target and drawing that on the screen and still turning the clearcolorbuffer off to get the boost.
    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.