Jump to content

Orange Pi Zero Graphic Programming


Hikmet TEKIN

Recommended Posts

Dear All,

 

I am beginner to linux and Opi Zero. I have written some programs on OPI Zero with WiringOP-Zero library. I got all of them working. Right now I am stuck on graphic library.  I need to make a graphic library based program. I am going to draw some vertex data and update them according to received data on serial port. 

 

I don't have any idea where to start. I used C# and XNA in the past. I know something about game programming. ( Please note, I did not make a game, I made a program which draws some information visually on screen with XNA framework)

 

Could you please suggest me, Where should I start?

 

I have two board. I am using Armbian Debian Jessie 3.4.113 and Armbian Ubuntu Xenial Legacy 3.4.113

 

Thanks

Best Regards.

Link to comment
Share on other sites

You say that you have the Orange Pi Zero, but it only has composite video out. What type of display will you use? SPI LCD? composite video?

 

Once you specify that, I can help you with choices for how to do it. If you're using a Linux Desktop, you can use GTK+ to do the windowing and graphics. It has "low speed" pixel level access to the display. If you plan to do video/animation then you can make use of SDL2. Here is a simple project I wrote which displays the tags in TIFF files using GTK+:

 

https://github.com/bitbank2/tifftool

 

I've also written a "bare metal" library for drawing on RGB565 framebuffers (e.g. inexpensive LCD display):

 

https://github.com/bitbank2/bbgfx

 

More info once you clarify what you want to do

 

Link to comment
Share on other sites

Larry Bank,

I am planning to use SPI LCD.  I ordered this LCD 3.5" SPI TFT. But I need 5 inch display but I only found Video Input Display. If you suggest me a good 5" SPI TFT I can use it too. As a result, I will use both SPI TFT and Video Out.

 

I will going to program all the things in C. 

 

How can I install librarys and I can start programming some little stuffs and go further. 

 

Thanks

Link to comment
Share on other sites

20 minutes ago, Hikmet TEKIN said:

Larry Bank,

I am planning to use SPI LCD.  I ordered this LCD 3.5" SPI TFT. But I need 5 inch display but I only found Video Input Display. If you suggest me a good 5" SPI TFT I can use it too. As a result, I will use both SPI TFT and Video Out.

 

I will going to program all the things in C. 

 

How can I install librarys and I can start programming some little stuffs and go further. 

 

Thanks

It appears that the display you chose is supported by my SPI_LCD library. The refresh rate will be slow (at best maybe 9 FPS). I haven't seen any larger SPI LCD displays because the interface isn't fast enough to make them practical. The AllWinner SoCs max out at around 33Mhz as a functional SPI speed. At that speed, you need to divide it by 16 (bits per pixel) and then a bit more due to the command/data overhead of working with these displays. That makes it impractical to use SPI for a display larger than 320x480.

 

As far as installing things, my SPI_LCD library is probably the easiest place to start. you would do the following to get it going:

 

git clone https://github.com/bitbank2/SPI_LCD

make

make -f make_sample

sudo ./lcd

 

Before you build the library, you need to edit spi_lcd.c and uncomment the #USE_GENERIC and the board you're using (#USE_ORANGEPIZERO) and comment out the other choices. This will enable the correct pin->GPIO translation table for your board.

 

Before you build the sample, you need to edit main.c and change the values in the spilcdInit() statement to work for your specific display type and the pins used to connect it. The correct SPI channel for RPI0 should be 1. The pin numbers for the D/C, RST and LED pins are dependent on how you connected the display to the board.

 

Link to comment
Share on other sites

Larry Bank,

 

I also need to use 5inch monitor. According to your suggestion about SPI, I am going to use Composite Video Input Display. What library should I use to make programming. Also my plan is something like this: There is a power button to suppy orange pi zero, when we open it. It will boot up and start our program at the boot up. User will not do anything as user login or program start. Everything will start at boot up. 

 

Thanks

Link to comment
Share on other sites

You still haven't shared enough info to help you decide how to proceed. Using composite video is fine, but do you want the user to interact with a mouse and manipulate a windowed GUI or would you prefer simple graphics without much of a UI. If you boot Linux without a desktop on the composite video out, you'll get a framebuffer with no OS support for drawing. This is easy to work with if you don't mind drawing everything explicitly with your own code. If you want a system with overlapping sizable windows and easy to use controls, then you'll probably want to use an X11 based desktop with GTK+.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines