How to use and why to use Sprites (TFT_espi Programing tutorial)

Поделиться
HTML-код
  • Опубликовано: 3 окт 2024

Комментарии • 138

  • @christopherlawes9286
    @christopherlawes9286 2 года назад +29

    This is the first video of yours I have seen. For me as a beginner, the way you have gone through this is fantastic! Thank you so much.

    • @VolosProjects
      @VolosProjects  2 года назад +2

      Thank you Christopher, i am glad I helped.

    • @kennethbeal
      @kennethbeal Год назад

      @@VolosProjects Thank you so much for your videos! Just bought you a dozen coffees. Don't drink all at once! :) Thanks again.

    • @qsdrfghgujfddyffguff
      @qsdrfghgujfddyffguff Год назад

      yes me also

  • @raymondmichael4987
    @raymondmichael4987 2 года назад +2

    Dude, That's quite huge collection of displays for a single person.
    Thanks

  • @TBoy58_405
    @TBoy58_405 2 года назад +7

    Haven’t played with sprites since the days of Commodore 64 (showing my age 😄). Wish I understood them then like I do now. Many thanks! 👍🏾🤓

  • @Egon3k
    @Egon3k Год назад +1

    i like how you just chill in your garden and make great content for us :)

  • @M.Voelkel
    @M.Voelkel 3 месяца назад

    Danke dir Volo für die Mühe die du dir gemacht hast - ich konnte viel lernen, zumal mir jetzt vieles klar geworden ist.

  • @jeffreymorris1752
    @jeffreymorris1752 Год назад +6

    Great instructional videos! I remember using sprites in 1983 (40 years ago!) on a Commodore 64. Those were 24×21 pixels and if your sprite resembled anything beyond a blocky blob then you were having a very good day.

  • @fluiditynz
    @fluiditynz 2 года назад +1

    Fast to draw front arc and erase rear arc to move circle from an edge.(But beware of undrawn pixels for thin line). Also should always pause after changes to permit persistance of human vision to load the new image to brain. In ideal world, 20ms for recalculations and delay to give 50 frames per second. Ah... I am watching as typing. So I'm theorising that the operations are made to fast ESP32 RAM instead of TFT and then DMA load from RAM to TFT with your img.push operation. Thanks for tutorial!

  • @MPElectronique
    @MPElectronique 2 года назад +1

    I'M IN LOVE WITH THE SPRITES NOW :)

  • @nicktucker4916
    @nicktucker4916 2 года назад +1

    Excellent! That was a very good demo of using sprites

  • @Narfusala
    @Narfusala 2 года назад +7

    I haven't started watching, but already am super happy you made this one... i've been trying to understand what a sprite is/does and how to use it to make a little game... but i was still confused a lot! BTW, i normally dont comment on YT, but i just want to say i love your video's, i bought a couple of these ESP32's with a build-in screen for a little project and learned so much from your video's!!!

    • @VolosProjects
      @VolosProjects  2 года назад +3

      Thank you for your support, i hope this tutorial will help you.

  • @openroot
    @openroot 2 месяца назад +1

    So basically drawing to an offscreen buffer, then drawing all in one blit, its goood

  • @carloslemos6443
    @carloslemos6443 2 года назад +4

    Nice job... I was trying to put lots of code on my Lilygo T-watch (with your graphs and others that I like) and now I'm understanding a little better how do it

  • @RicardoPenders
    @RicardoPenders 2 года назад

    WOW, that was easy... Thanks for sharing, it is very much appreciated here.

  • @nikthefix8918
    @nikthefix8918 2 года назад +3

    Your screen flicker is pacman-esque.

  • @jamesmor5305
    @jamesmor5305 Год назад +3

    I really like the way you structure this video, because it reflects the ways a normal beginner will start over and you shot hot to be a pro

  • @mashurshalehin4972
    @mashurshalehin4972 2 года назад +13

    It would be great if you could explain the theory and why it's smoother and better than the other approach. I want to know the behind the scenes implementation process.

    • @1over137
      @1over137 2 года назад +6

      The sprite library waits and draws with the refresh. Basically "vSync"

    • @mashurshalehin4972
      @mashurshalehin4972 2 года назад +3

      @@1over137 Is it like this, it saves the whole frame in memory and refreshes the whole frame with one shot?

    • @1over137
      @1over137 2 года назад +8

      @@mashurshalehin4972 Not necessarily. There are several ways to do it. The approach you suggest would be called "double frame buffer", where you one complete frame ready to go as soon as the display refreshes and you have another frame which the CPU id drawing into.
      When you complete your drawing, the frames are swapped (usually just by readdressing the memory which is actually read by the display. So no memory moves or is copied, it's just the screen render is pointed to a different frame.
      The flicker is caused by the software writing into the frame that is currently on screen, so you see a series of partial images as one partial frames get drawn on each screen before it switches.
      The other way with single buffer, you just wait for the refresh and write the buffer as fast as the screen draws.
      The better way to have this implemented would be to have a parameter to UpdateDisplay() which is True/False and denotes if the display should wait on the refresh or render immediately.

  • @chipko
    @chipko 2 года назад +3

    Once again an interesting and incredibly useful video. Thank you so much!

  • @qbitsday3438
    @qbitsday3438 Год назад +1

    Subscribed Instantly!

  • @arlo4051
    @arlo4051 2 года назад +3

    Thank you for the explanations of how this works, quality information on how to program for the LCD is excellent.

  • @kunkhmer5246
    @kunkhmer5246 2 года назад +1

    Thank you very much for your tutorials,...How do you speed up Sprites? It seems to be very slow as compared to non-Sprites.

  • @nikthefix8918
    @nikthefix8918 2 года назад +1

    When ever I hear the word 'Sprite' I think of Mr Claypole in Rentaghost.

  • @StephenLiljedahl
    @StephenLiljedahl 2 года назад

    Great tutorial, very informative.

  • @jimsnodgrass8454
    @jimsnodgrass8454 Год назад +1

    Very helpful. Seems like learning to use Sprite's is critical to developing great projects. this is a Great video to show why.. Thanks jimS

  • @marshall100w6
    @marshall100w6 Год назад +1

    Interesting. Never dis anything with sprites. I’ll try to use them. Thanks one more time. 🤘🏽🤘🏽🤘🏽.

  • @psprophet
    @psprophet Год назад

    Liked, favorited, subscribed and appreciated!

  • @brianmiller6320
    @brianmiller6320 2 года назад +2

    Nice Pizza oven! Good tutorial.

  • @saydiy1528
    @saydiy1528 Год назад

    good job. the orange ball looks nice, is it OK to use a circle image instead of the ball?

  • @sebalew2642
    @sebalew2642 2 года назад +2

    Very useful, looking forward to next sprites tutorials!

  • @KVEL...
    @KVEL... 2 года назад

    Thanks for this clear explanation! I have learned a lot!

  • @SonalK
    @SonalK 5 месяцев назад

    How do you know which displays are supported? I've a few ST7735 TFT displays, flickers a lot and low resolution

  • @Sanchez9241
    @Sanchez9241 10 дней назад

    How to write sprite like background screen image, and above that moving image? Do I still need to fillscreen with black?

  • @jamesclifford194
    @jamesclifford194 7 месяцев назад

    Hey, firstly, thanks for a great video, I'm learning a lot about Arduino/ESP32 at the moment and this has been really informative. Secondly would you mind sharing the sketch for the fuel gauge shown at 20secs? I want to make a speedo gauge and the asthetic of yours is exactly what I'm hoping to achieve. Thanks again!

  • @YourDetector
    @YourDetector Год назад

    Good stuff!! But as far as I can understand, ONE sprite of 135x200 pixels takes all RAM memory of ESP32 :(

  • @jrathmer
    @jrathmer 2 года назад

    Thank you! That helped a lot understanding (:

    • @VolosProjects
      @VolosProjects  2 года назад +1

      Thank you Jan ,for comment and for coffee😀

  • @kamran_aghlami
    @kamran_aghlami 2 года назад +1

    Those screen flickers look like image buffer corruption to me. I guess it's because of unaligned memory writes or LCD's driver issue, maybe it has to do with the weird resolution this display has, and I'd say you're essentially bypassing the issue with writing full frame buffer every frame which is less efficient both in terms of CPU cycles and memory usage than the partial screen update the first approach had. I'm interested to figure the real issue out.

    • @wincydelavega653
      @wincydelavega653 Год назад

      I use the same display and i use a typical esp32 and i am not using any sprite but it works completely fine but i am happy to learn sprite 🐱

  • @wchen2340
    @wchen2340 9 месяцев назад

    I think "why you need double buffering" would be a much more suitable title. whatever. i dont care much about strange arduino lib apis. cya

  • @ChrisHalden007
    @ChrisHalden007 2 года назад

    Great video. Thanks

  • @Tony770jr
    @Tony770jr 2 года назад +1

    Nice example! Looking forward for more with sprites..

  • @egorovsa
    @egorovsa Год назад

    Hey hey Bro! Thanks too much for the tutorial.!

  • @gordsh1
    @gordsh1 8 месяцев назад

    Please do a tutorial / video on how to design a pcb board from a simple circuit using software.

  • @MaxSMoke777
    @MaxSMoke777 2 года назад

    Where is part 2??? I haven't been able to figure out how to make a masked sprite, I was hoping you had information on that.

  • @j.d.5262
    @j.d.5262 Год назад

    OMG where did you get that coffee mug?

  • @donaldkormos5529
    @donaldkormos5529 2 года назад +1

    Thank you very much ... I did learn something new!!!

  • @Darktron
    @Darktron Год назад

    Can you do a tutorial on using Lvgl library with T-Display S3 make of nice UI, fonts, colors, etc.

  • @HPVIDEO10
    @HPVIDEO10 2 года назад

    Thank you !!!

  • @krafterHD
    @krafterHD Год назад +1

    Okay. I'm going to try to explain the problem I'm having with your example.
    I have a different size display. Mine is 240x240 (size set in the user_settup.h file). Your code line by line works great but if I change the size of the sprite to 240x240 it won't run. All I get is a black screen. I've change the size of it on both x and y and the only time I can get it to run is if the size of the sprite difference between x and y is >= 10.
    img.createSprite(240, 240); doesn't work.
    img.createSprite(235, 235); works
    img.createSprite(240, 231); doesn't work
    img.createSprite(240, 230); works
    img.createSprite(230, 240); works
    img.createSprite(231, 240); doesn't work
    img.createSprite(239, 231); works
    img.createSprite(235, 235); works.
    I'm confused. Could this be something in the user_setup.h?
    Edit: I found my answer. This may help others. I’m using an ESP32 Wroom 32.
    “A Sprite is notionally an invisible graphics screen that is kept in the processors RAM. Graphics can be drawn into the Sprite just as they can be drawn directly to the screen. Once the Sprite is completed it can be plotted onto the screen in any position. If there is sufficient RAM then the Sprite can be the same size as the screen and used as a frame buffer. Sprites by default use 16 bit colours, the bit depth can be set to 8 bits (256 colours) , or 1 bit (any 2 colours) to reduce the RAM needed. On an ESP8266 the largest 16 bit colour Sprite that can be created is about 160x128 pixels, this consumes 40Kbytes of RAM. On an ESP32 the workspace RAM is more limited than the datasheet implies so a 16 bit colour Sprite is limited to about 200x200 pixels (~80Kbytes), an 8 bit sprite to 320x240 pixels (~76kbytes). A 1 bit per pixel Sprite requires only 9600 bytes for a full 320 x 240 screen buffer, this is ideal for supporting use with 2 colour bitmap fonts.”
    github.com/Bodmer/TFT_eSPI#sprites

    • @mathiasbekker211
      @mathiasbekker211 11 месяцев назад

      Awesome. Thank you *1000. I'm using an ESP32 WROOM 32D and a 240*240 tft. Changing the sprite size to 240x235 worked for me.

    • @VolosProjects
      @VolosProjects  11 месяцев назад

      You have older esp32 module which have less psram, so with sprite so big program crashes. You can try with diferent board

  • @cdunne1620
    @cdunne1620 Год назад

    ..brilliant video, you’re a great teacher, thank you!!
    ..are you looking forward to TTGO t-Display Amoled, should be cool

  • @rynait
    @rynait 2 года назад

    was commodore user and did use sprite concept alot. my explanation version to newbie. you are drawing graphic to memory (not to screen), after you done draw graphic (into memory), copy the memory to screen., done, rinse and repeat.
    to some (and on old computers) yes, this slightly slow graphics viewing-play. but the slowness is offset by the speed of cpu processing the code, modern computer makes it useless because the cpu is far faster and flicker comes back. interesting is unfazed by small development boards.

  • @headbangersworld
    @headbangersworld 2 года назад

    Interesantno. Razlika je, da se operacie kod sprite rade u memoriji a ne na ekran, tek na kraju se sprite odlikuje na ekran. Sto ukupno ispadne brze i kao neka vrsta doublebuffera. Mozda bi mogao jos i da uklonis ove dve operatie sa "TFT_BLACK" i da koristis "fillSprite(TFT_BLACK)" na pocetku. Po specifikaciju bi moglo biti jos malo brze :)

  • @eugenecrane6093
    @eugenecrane6093 Год назад

    Cool!!! thanks l use ttgo t4

  • @Scudmaster11
    @Scudmaster11 Год назад

    "Takes a drink of sprite while watching a video that is talking about sprites"

  • @rickharms1
    @rickharms1 3 месяца назад

    What User Setup do you use in "User_Setup_Select.h"?

    • @VolosProjects
      @VolosProjects  3 месяца назад

      setup 200, but you need setup pins

  • @andymouse
    @andymouse Год назад

    Nice !...cheers.

  • @BlondieSL
    @BlondieSL Год назад

    Just to confirm, this doesn't have to be on a TTGO, right?
    It can be any ESP32 board, like ESP32 WROOOM ?
    And will any TFT work, like the 4 wire ones, or does it require TFTs that have several wires?

    • @VolosProjects
      @VolosProjects  Год назад

      This will work on any board that is sušprted by boodmers tft_espi library..

    • @BlondieSL
      @BlondieSL Год назад

      @@VolosProjects I tried to confirm if what I found was right, but as expected, even without posting an actual like, the algorithm removed my comment.
      I hate the YT algo! It really is horrible. It lets seriously bad comments to remain, then removes normal comments.
      So again, let me try.
      Is what I'm looking for have the title at the top, left corner of
      Bodmer T'F'T'_'e'S'P'I'
      (I add ' to confuse the algo)
      ??
      (LET'S SEE IF THIS COMMENT STICKS... SIGH)

  • @flashgangster
    @flashgangster Год назад

    Great video. I followed along using ESP32 and ILI9341 (240x320) and it worked great until I tried to make the full-screen 240x320 sprite (scaled up from your example). It will only go so big before it stops working. I'm guessing it's a memory issue and I need som more teaching. I can't seem to find another tutorial that goes deeper :(

    • @solarprojectuk
      @solarprojectuk 10 месяцев назад +1

      Me too! I found the solution - add the line img.setColorDepth(8); to the loop function. It reduces the memory needed and the sprite works well now.

    • @flashgangster
      @flashgangster 10 месяцев назад

      @@solarprojectuk thank you!

  • @innocent431
    @innocent431 2 года назад

    and willing nice tutoet League teams and players to chose as their editor. More money for tho. It is pretty cool to see the progress I

  • @steverileyretired
    @steverileyretired 5 месяцев назад

    Very Good

  • @Sergkey42
    @Sergkey42 Год назад

    благодарю бро за такое пошаговое объяснение. Можешь рассказать так же про режим DMA на ESP32?

  • @yakhoubsurya2657
    @yakhoubsurya2657 Год назад

    Nice 👍🏻

  • @phaquasystems2685
    @phaquasystems2685 5 месяцев назад

    Absolutely clear explanation thanks

  • @ianchan2624
    @ianchan2624 10 месяцев назад

    ahhaha thanks xD

  • @qbalsdon
    @qbalsdon 4 месяца назад

    Simple, practical and even had birds chirping!

  • @Johann75
    @Johann75 9 месяцев назад

    So, Sprite will paint the objects into the memory one by one and then into the screen in one shot?

  • @zyghom
    @zyghom Год назад

    perfect! I spent so much time on looking for such thingis ;-)

  • @mibrahim4245
    @mibrahim4245 Год назад

    Thank you..
    I need your help if possible..
    Im using this TFT_eSPI library with my st7735 128x128 display.. and it works great when I show a 16-bit image using pushImage( ) function.
    but if I print a text on top of it, the text starts flickering.
    I've tried many things to no avail, but if I change the image to the 8-bit bitmaps it works perfectly ! ..
    so can I display an 8-bit color image (not bitmap) using this library ?

  • @shahabaghai
    @shahabaghai Год назад

    Hi and thanks for great videos, I am finding them very useful. I am working with ESP32-Vroom and 320*240 TFT(SPI), when I define my sprite with full length it does not work (LCD is black) but when I break it into 2 sprit of 120*320 I have no issue and it successfully updates the LCD? Any ideas?

    • @BlondieSL
      @BlondieSL Год назад

      Well, you have just answered my question of if an ESP32-WROOM and pretty much any TFT will work.
      Thanks for that.
      As for what you mentioned, have you tried messing with the X/Y screen size numbers?
      Like, perhaps reduce x and y by 1 number and use 1 to 320 (or 1 to 319) instead of 0?
      I know that with Arduino and TFT screens, I ran into issue of the screen not working right when being too "exact" with the numbers.
      I tested by reducing the numbers by 1 (I think it was) and then things would work.
      just an idea.

  • @jonathanshaw5186
    @jonathanshaw5186 7 месяцев назад

    Thanks for another great video!

  • @digihz_data
    @digihz_data 2 года назад

    Great info.
    Sprite is like a backbufferr I think

  • @buraksonmez1761
    @buraksonmez1761 Год назад

    Why am I getting this error when I trying to do something with this ttgo?
    Sketch uses 18280 bytes (59%) of program storage space. Maximum is 30720 bytes.
    Global variables use 1882 bytes (91%) of dynamic memory, leaving 166 bytes for local variables. Maximum is 2048 byt

  • @AJB2K3
    @AJB2K3 Год назад

    6:21 that's actually a useful bug!

  • @yakacm
    @yakacm 2 года назад

    Very cool, TY for sharing.

  • @Zoonie81
    @Zoonie81 Год назад

    You rock dude, thanks 👍🏼

  • @thadsr240
    @thadsr240 4 месяца назад

    not sure when i subscribed but every time i hear you say subscribe i look, this time i'll say thanks for putting so much information out! these display manufacturers should send you free screens every time and pay you!!

  • @Alan123456789876543
    @Alan123456789876543 2 года назад

    Great example of "Arduino code". You just could use a Frame buffer to avoid ANY of this flickers :\

    • @marc.lepage
      @marc.lepage Год назад

      In this case, the sprite is the frame buffer. Or are you saying the display library has more direct support for frame buffers?

  • @larsjongkees198
    @larsjongkees198 Год назад

    thank you so much for making video's with this esp board. I picked it for a school project with basicly 0 programming experience, and then i could find almost zero information on how to program it. Your videos saved my project!

  • @qsdrfghgujfddyffguff
    @qsdrfghgujfddyffguff Год назад

    great sir..very useful

  • @raymondmichael4987
    @raymondmichael4987 2 года назад

    Please, I need more on this topic

  • @danielsaccomani6277
    @danielsaccomani6277 5 месяцев назад

    Do you only provide the code if they buy you a coffee?

    • @VolosProjects
      @VolosProjects  5 месяцев назад +1

      No, usualy in my videos code is free. But this is tutorial , just fallow along and write code i wroted in tutorial, you will learn easier than just copy and past code. I dont have this code anymore.

    • @danielsaccomani6277
      @danielsaccomani6277 5 месяцев назад

      @@VolosProjects Ah yes, perfectly fair!
      I looked and couldn't find it, but now I understand. Thanks for the feedback...
      Do you have a tutorial that teaches how to overlay a numeric counter over a background image?
      I'm trying to use the information from several videos on your channel, but without success.... Thank you very much for your answer, big hug.

  • @MPElectronique
    @MPElectronique 2 года назад

    here we go!!!! 😊😮😊😊

  • @edgarmatzinger9742
    @edgarmatzinger9742 Год назад

    Interesting idea. But why don't you use "real" sprites? A circle sprite you just move over the screen? And a number sprite which you update every loop?

    • @VolosProjects
      @VolosProjects  Год назад

      i dont understand, what is real sprite?

    • @jonathanshaw5186
      @jonathanshaw5186 7 месяцев назад

      As a TFT_eSPI newbie, this confused me a bit too at first. I expected the circle to be the sprite rather than the screen (or the portion of the screen) that contains the circle.

  • @sito3453
    @sito3453 2 года назад

    Thank you Volos! I have learned a lot from this video. You explain it in a very clear and funny way. Congratulations!!

    • @VolosProjects
      @VolosProjects  2 года назад

      Thank you, i hope this will be usefull for you. Cheers from Croatia

  • @romarioavila1
    @romarioavila1 Год назад

    Hy! is possible to develop an menu user interface with sprites?

  • @donvukovic7440
    @donvukovic7440 2 года назад

    At time 00:05, we can see your pizza oven. Will you create a tutorial on how to build a pizza oven. Please.

    • @VolosProjects
      @VolosProjects  2 года назад

      Hello, sorry i dont know how to build it, my father build it. Where are you from, my wife surname is also Vukovic.

    • @donvukovic7440
      @donvukovic7440 2 года назад

      @@VolosProjects My father is from Kralievo, I was born in Cleveland.
      I would love to go there some day.

  • @carlatashkadeh5890
    @carlatashkadeh5890 2 года назад

    Thanks!

  • @markfairchild6264
    @markfairchild6264 2 года назад

    Thank you! Coffee coming your way!

  • @AJB2K3
    @AJB2K3 Год назад

    Nice video thank you but could you repeat this video but using micropython please?

    • @VolosProjects
      @VolosProjects  Год назад +1

      sorry, i dont like micropython and i dont know how to program esp32board using micropython

    • @AJB2K3
      @AJB2K3 Год назад

      @@VolosProjects Never mind, I wouldn't have know if I hadn't asked.

  • @xyntaxxian7615
    @xyntaxxian7615 2 года назад

    Can you please also tell me what is deleteSprite? What is its importance? How to use it?

    • @VolosProjects
      @VolosProjects  2 года назад

      Sprite can use lots of RAM memory, when you dont need sprite anymore you can delete it to free memory

    • @xyntaxxian7615
      @xyntaxxian7615 2 года назад

      @@VolosProjects it's because i tried using deleteSprite to clear my screen but it doesn't seem to work, can you please tell me how to use it properly or point me to a tutorial that uses the function

  • @Xavier_Everwhere
    @Xavier_Everwhere 2 года назад

    I didn't find. Any sprite bottle😅

  • @IvanEng747
    @IvanEng747 Год назад

    #include
    TFT_eSPI tft = TFT_eSPI();
    TFT_eSprite img = TFT_eSprite(&tft);
    void setup() {
    tft.init();
    tft.setRotation(1);
    img.setColorDepth(true);
    img.setColorDepth(1);
    //img.setColorDepth(8);// NO IMAGE
    img.fillSprite(TFT_RED);
    img.createSprite(480,320);
    }
    int x = 0;
    void loop() {
    img.fillCircle(x,36,30,TFT_BLACK);
    x = x + 10;
    if (x > 480)
    x = 0;
    img.fillCircle(x,36,30,TFT_GREEN);
    img.pushSprite(0, 0);
    delay(10);
    }
    Not work on stm32f401ccu6

    • @VolosProjects
      @VolosProjects  Год назад +1

      do you have latest, tft_espi library?

    • @BlondieSL
      @BlondieSL Год назад

      @@VolosProjects Any chance that you could post that specific link to the latest?
      I loved your video. That's how to get a point across. Show first what doesn't work well, then insert what does.
      This made understanding sprites so easy.
      Oh, to confirm as above, this should work with any ESP32 board, i.e. ESP32 WROOM and any TFT display?
      Thanks in advance.