No announcement yet.

"Render" Strategies

  • Filter
  • Time
  • Show
Clear All
new posts

  • "Render" Strategies

    I'm new to this kind of displays (160Oled) ( only used 2x16 character lcds before) and have some questions:

    I want to draw fullscreen indicators that need to be rebuild to a significant part, not just a few pixels, each cycle. So it seemed the logical way for me to clear the screen each cycle and execute the whole drawing code. I made a very simple test, consiting just of a filled circle that grows and shrinks in radius with each cycle. So my code writes the circle command (after initializing of course), waits 100ms and then clears the screen and then writes the circle command again with different radius ... and so on.
    So I have about 10fps to draw. What happens when i execute the code is that i just get a flickering display thats black most of the time...
    When I change from CLS to drawing a black rectangle the size of the screen it works better but i think for each 100ms of circle I see about 50ms of black screen which makes the whole animation horrible to look at.
    Of course a strategy would be to think more about the actual drawing and change only the pixels necessary... something like the difference between the new and the old frame..... but shouldn't there be a more elegant solution.... like telleing the display conttroller first all the commands to assemble the frame... and then only pass the final result to the actual display matrix???
    Are there other functions to use in my case than CLS or draw a black rectangle... perhaps I#m missing something? Or is it just that the SGC OLEds are not suitable for that kind of application. However putting pure text to the display at 10fps is no problem at all and looks good...... And and in the promo video everything seems to be possible :-)

    Thanks for any suggestions


  • #2

    It's all certainly possible, we just need to understand what you are trying to achieve and how.

    Firstly what are you using GFX/4DGL or SGC?

    Internally, CLS is eatly the same as drawing a black rectangle the size of the screen, so it's hard to see how you are observing a difference.

    You couldn't possibly be waiting 100ms, clearing and then drawing the screen (without further delay) and seeing 50ms of black. Perhaps there is an additional delay in your program.

    You are better off not clearing the screen unless you have significant changes to make.

    There is not enough memory to 'pre assemble' the frame.

    You haven't said whether each different setting of the guage is 'predefinable' or almost predefinable. If it is, give consideration to placing each image on a uSD card and fetching it from there, this will give you the fastest 'full screen' transition and also simplify your code immensely


    • #3

      I have the same issues with SGC. It should buffer the frame until you tell it to flush to the screen manually.
      The SSD1306 based OLED that is sold by Adafriut works like this, you go clearScreen(), draw your stuff, then say display() and it updates the actual display then.
      That way you can spend as long as you like building up the new screen and it wont have any flicker.

      Is there such a command in SGC or some trick to do a similar thing?
      What about the new 4D serial command set?


      • #4

        I'm not familiar with the way the OLED sold by Adafruit works, but it appears that it turns off the backlight until you say display(). So if you turned of the backlight using SGC or SPE then it would behave the same.

        But there are a few more fundamental differences here that might be causing the flicker and we have to define just what flicker is. IMO turning the backlight off whilst updating the screen will make the flicker worse.

        The original poster was talking about 100ms delays, and it just doesn't take that long, so there is something else going on here.