How do I use my PC to program pretty patterns on my TV/monitor?

I have been playing with C++ for about a year on a few Arduino MCs. No formal training but a retired BASIC programmer. A couple of months ago I got a 320X240 TFT LCD and got addicted to programming pretty patterns.

I outgrew 32Kb MCs and moved on to 512Kb and have been thinking of getting a bigger screen, 7"!?

Then I thought why stop at 800X480? Why not use my PC and 1920X1080 and a processor 50 times the power!?

All my prior playing was with the plentiful libraries with drawPixel, drawLine, drawRect, drawTriangle, drawCircle etc. plus the the "fill" variants like fillRect, fillCircle etc etc.

I've done searches for info on how to do this with my PC and a library(?) but have come up sadly lacking. :(

I would like to draw patterns with pixels, circles, rectangles, lines, triangles and such. Either with code or using a library?

I am retired with 6 grandkid's so this is entertainment not homework. ;)

I would be grateful if someone could point me in the right direction. I'll do the programming, I'd just like to know how to. :D
Last edited on
Look at the SFML library:
http://www.sfml-dev.org

Or SDL (it is a C library, so do not expect idiomatic C++ code from it):
https://www.libsdl.org/
http://lazyfoo.net/tutorials/SDL/index.php
Thanks.... :)

More than I found in MY searches :D
closed account (48T7M4Gy)
https://en.wikipedia.org/wiki/OpenGL

Worthy of consideration.
WOW! It's a whole new ball game isn't it? :O

This is how simple it is to draw a circle with an Arduino Due microprocessor :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "SPI.h"
#include <ILI9341_due_config.h>
#include <ILI9341_due.h>

#define _cs 10
#define _dc 9
#define _rst 8

ILI9341_due tft = ILI9341_due(_cs, _dc, _rst);// Use hardware SPI

int x = 159, y = 119, radius = 100;

void setup() {
  tft.begin();
  tft.setRotation(iliRotation270);//Landscape with pins to the left....
}

void loop() {
  tft.drawCircle(x, y, radius, 0xFFFF);
  delay(1000);
}


Thanks for your responses :)
closed account (48T7M4Gy)
At the risk of committing a mortal C++ sin, Java is not bad with graphics too. Very extensive and sophisticated graphics libraries, albeit with a fairly steep learning curve.

But don't get put off - they are all just more comprehensive rather than more difficult than that offered with the standard Arduino libraries.

You can probably easily apply all these to driving an Arduino-wifi-drone. Say, a 3d ellipsoid flight plan with coloured smoke trail or skywriting in a nice TrueType font.
You might find Processing ( https://processing.org/ )to be a good fit for such things. Something similar to your arduino program would look like:

1
2
3
4
5
6
7
8
void setup() {
  size(800, 600);  // 800 x 600 client area
}

void draw(){
  int radius = 100;
  ellipse(width/2, height/2, radius, radius);
}


Learning curve is fairly forgiving. You can peruse other folk's sketches at http://www.openprocessing.org/
I can get lost there for awhile. ;)
Topic archived. No new replies allowed.