mskrpan
Posts: 3
Joined: Mon Apr 10, 2017 3:07 pm

Beginner here need advice...

Mon Apr 10, 2017 3:42 pm

Ok so i recived my rpi 3 - B and also got adafruit pitft lcd 3.5" and its all new to me. Can some one tell me am i limited to pygame and python on programig some graphic or can i do it with c/c++/java by graphic i mean games and gui??? I have exp with that 3 programming lenguage but none with pythone. Also can i do it with my adafruit pitft 3.5" i ask because all the examples i see are on python? Also have good knowledge with Arduino but none with rpi.
Any advice, tutorial or whatever that include programming graphic with c/c++ and java that i can do with my rpi and lcd would be nice.
Sry on bad English it is not my native lenguage.
Thx in advance!

User avatar
topguy
Posts: 6527
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Beginner here need advice...

Mon Apr 10, 2017 10:27 pm

I believe the TFT screen is accessible as a linux framebuffer. So any graphics library that can use framebuffers would be usable.
One such library is SDL/SDL2 (https://www.libsdl.org/index.php ) which I believe is what PyGame is using but is originally created for developing in C/C++.

mskrpan
Posts: 3
Joined: Mon Apr 10, 2017 3:07 pm

Re: Beginner here need advice...

Tue Apr 11, 2017 7:26 am

topguy wrote:I believe the TFT screen is accessible as a linux framebuffer. So any graphics library that can use framebuffers would be usable.
One such library is SDL/SDL2 (https://www.libsdl.org/index.php ) which I believe is what PyGame is using but is originally created for developing in C/C++.
ok thx for answer i know about SDL/SDL2 did some project with it on my desktop pc...but can you tell me do i need some sort of adafruit library when programming in c/c++ so that my adafruit can show result on screen like img, gui etc.? I am asking because i never did anything with tft lcd-s so i dont know how rpi is communicate with Adafruit and on adafruit pages they say it is only for python/pygame. Do i need different tft lcd or i am missing something? Sry for maybe stupid questions but what can i say i am beginner in rpi. :D

User avatar
topguy
Posts: 6527
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Beginner here need advice...

Tue Apr 11, 2017 9:39 am

Is it this one ? https://www.adafruit.com/product/2097

If you look at the images, you can see that they show both the console and the X-Desktop on the screen. This means that the screen is directly supported as a framebuffer by the kernel.

The page here: https://learn.adafruit.com/adafruit-pit ... sy-install gives you instructions how to set it up.
You don't have to move the console and X-desktop to the TFT screen, you can keep those on the normal HDMI output if you want. ( you probably dont want to do programming on a 3.5" screen )

After the necessary support has been enabled in the kernel and you have rebooted you should have two framebuffer devices.
- /dev/fb0 - The HDMI output
- /dev/fb1 - The TFT screen.

( If you browse through their next instruction page: https://learn.adafruit.com/adafruit-pit ... ed-install you will see the references to "/dev/fb1" )
I suggest you follow their instructions and learn how the screen can be used with different programs like "fbi" and "mplayer".

In the end it will be more about well you know progamming on linux.
Also I see that most people recommend using SDL1.2 instead of SDL2 because of some incompatibles with touch.
Some startng pointers can be found here: http://www.impulseadventure.com/elec/rp ... l-sdl.html

mskrpan
Posts: 3
Joined: Mon Apr 10, 2017 3:07 pm

Re: Beginner here need advice...

Tue Apr 11, 2017 10:05 am

topguy wrote:Is it this one ? https://www.adafruit.com/product/2097
Yeah that is the 3.5" that i have...
topguy wrote:If you look at the images, you can see that they show both the console and the X-Desktop on the screen. This means that the screen is directly supported as a framebuffer by the kernel.

The page here: https://learn.adafruit.com/adafruit-pit ... sy-install gives you instructions how to set it up.
You don't have to move the console and X-desktop to the TFT screen, you can keep those on the normal HDMI output if you want. ( you probably dont want to do programming on a 3.5" screen )

After the necessary support has been enabled in the kernel and you have rebooted you should have two framebuffer devices.
- /dev/fb0 - The HDMI output
- /dev/fb1 - The TFT screen.

( If you browse through their next instruction page: https://learn.adafruit.com/adafruit-pit ... ed-install you will see the references to "/dev/fb1" )
I suggest you follow their instructions and learn how the screen can be used with different programs like "fbi" and "mplayer".

In the end it will be more about well you know progamming on linux.
Also I see that most people recommend using SDL1.2 instead of SDL2 because of some incompatibles with touch.
Some startng pointers can be found here: http://www.impulseadventure.com/elec/rp ... l-sdl.html
Ok thx one more time on infos, links and everything. I aprishieted it helped me a lot... :)

Return to “Graphics programming”