Ultibo game programming

Anything and everything about programming graphics with Ultibo
Gavinmc42
Posts: 1656
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Ultibo game programming

Postby Gavinmc42 » Tue Jun 13, 2017 11:23 am

I stopped complaining when 6by9 or jamesh told me to go RTFM, all of them I think he meant :lol:
Like learning OpenGLES is going to help understand baremetaling VC4 3D?
Seriously the data is scattered all over the place and over the years.
As I learn more I have to go back and reread it because i skip over stuff I don't understand :oops:

That Geomorph link for Povray?
Yuk I needed to download/configure/make/install so many dependencies, each one needing something else.
That was one of the main reasons I left Linux for Ultibo.

Finally found a simple height map generator
http://hme.sourceforge.net/
Starting to understand the maths and soon time for me to code one in FPC.
Eventually the 3D map will be Ultibo generated then moved to VC4 but there are many stages in between.

But some more time with Povray and I should be able to do all the images I need for a simple 2D top down shooter.
Still useful after so many decades. Good practice for when VC 3D rendering is working?
Learning cameras and lighting etc.

With APNG I should be able to animate explosions etc
Apngasm is good for that, takes all the tiny pngs and puts them in one file ;)
Time to try bin2type?

Doing a game is a way to get good handle on the graphics.
Even without the Videocore stuff there are so many ways to do things with the current units.
Gavinmc42
Posts: 1656
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Ultibo game programming

Postby Gavinmc42 » Thu Jul 20, 2017 10:47 am

A jpeg post
https://www.raspberrypi.org/forums/view ... 0&start=25

Led to an interesting guy, this is a simple game type example, similar to what I want to try in Ultibo as a first step.
https://github.com/AndrewFromMelbourne/ ... aster/game.

Looks like I need to send some time in Linuxland with C to get used to all the VC interfaces.
Seeing what assembler code this generates could be interesting.
pik33
Posts: 887
Joined: Fri Sep 30, 2016 6:30 pm
Location: Poland
Contact:

Re: Ultibo game programming

Postby pik33 » Fri Jul 21, 2017 6:10 am

The scrolling image which is bigger than screen is simple in retromachine/gui environment. You declare a canvas object with dimensions you want. You load the pisture from the disk (as it is now, uncompressed, but then there are jpeg pascal libraries I didn.t add to the system yet) or you draw the image on the canvas using putpixel, box, line, circle (the circle is still to be added to canvas methods using ctrl-c,ctrl-v ). Then you wait vor vblank (there is waitvbl function) and redraw your screen using blit8 (assembly CPU function) or dma_blit (using dma). The blit functions allow to select a rectangle from the source and copy it to the destination, while the source and the destination can have different dimensions.

You can find blit function in blitter unit. The examples of how to use them are in the player unit: the winamp skin is drawn from preloaded bitmaps using blit8 function.

These functions now work with 8-bit color depth, which can be expanded to 16- and 32- bit by multiplying some variables by 2 or 4.
Gavinmc42
Posts: 1656
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Ultibo game programming

Postby Gavinmc42 » Thu Sep 28, 2017 11:07 am

Andrew's game example should just port?
There is just one file for the game but there are lots of files in the common folder that would need porting.
But once those are done all the other examples are easier to do.

Do we need another Mandelbrot example :roll:
It does use threads, will that make a difference?
Off track

I have a suspicion it might now be even easier to do in Ultibo.
The VC4 HelloDisplaymanX example does not look of much use, it just calls the code in the library.
We would need the Ultibo equivalent of the dispmanx.c code, thanks pik33
viewtopic.php?f=15&t=830
Whoops did something wrong :(
Gavinmc42
Posts: 1656
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Ultibo game programming

Postby Gavinmc42 » Fri Sep 29, 2017 11:47 am

Need to understand AndyD's code to get the dispmanx layer and png stuff I want to do.
Lots of clues in his ports on RP forum ;)

Been doing OpenVG blimps flying over jpg bitmap terrain ;)
It is too slow when all on the same layer and the whole lot needs redrawing every frame.
Until the terrain is on another layer I not sure how fast animated OpenVG sprites can go.
But it sure is nice to adjust sprite sizes by changing just one variable ;)

I am not sure why but Ajstark's code when ported to Ultibo seems easier to use than the C version.
Now convinced AFM's dispmanx needs porting as well, so brain worn out coders like me can figure it out and use it as a starting point.
https://github.com/AndrewFromMelbourne/raspidmx

Time to rest the brain, must be the heat wave? crazy summer in spring :shock:
pik33
Posts: 887
Joined: Fri Sep 30, 2016 6:30 pm
Location: Poland
Contact:

Re: Ultibo game programming

Postby pik33 » Fri Sep 29, 2017 3:12 pm

If you want to fly an sprite UFO over a jpg terrain, you can fill the terrain using openVG, then paint the UFO on the small rectangle using Dispmanx example. Then you can move UFO over the background using pure dispmanx calls.
Gavinmc42
Posts: 1656
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Ultibo game programming

Postby Gavinmc42 » Sun Feb 11, 2018 2:41 am

A recent post reminded me I have not been doing anything re game stuff for a while.
To have a scrolling 3D landscape with heights and textures OpenGLES would be the way to go.

Now that the VC4 stuff works time to explore OpenGLES, starting with the basics.
http://blog.db-in.com/all-about-opengl-es-2-x-part-1/

Eric Anholt has been doing OpenGL in Mesa on the VC4/5.
The big difference I can see between OpenGL and OpenGLES is quads.
The VC4 hardware only supports points, lines and triangles,
If I read his posts right Eric fakes the quads by using two triangles.

The OpenVG shape demo stuff was easy because it had lots of VG examples in the one demo.
The HelloGLES is just one example, but like the OpenVG demo is does not require any linked C object file like the camera examples.

Now that I have started looking at it it does look simple :o texture maps is one line of code :D
Now to find more examples, hmm there are some OpenGLES examples in the Mali SDK, in C of course.
Android sources is not where I would have looked till now, but it makes sense, Android hardware was restricted to OpenGLES in the early days.

But a Free Pascal 3D terrain example would be nice or port Andrew from Melbourne's game code?
Need to test C code first to make sure it works, so Ultibo on Raspbian time.
Is it time now to move Ultibo development to Raspbian?
pik33
Posts: 887
Joined: Fri Sep 30, 2016 6:30 pm
Location: Poland
Contact:

Re: Ultibo game programming

Postby pik33 » Sun Feb 11, 2018 5:49 am

Is it time now to move Ultibo development to Raspbian?


It always was :)
Gavinmc42
Posts: 1656
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Ultibo game programming

Postby Gavinmc42 » Thu Jun 07, 2018 5:28 am

Putting this here for inspiration
https://www.raspberrypi.org/forums/view ... 8&t=214695

Been reading lots of OpenGLES stuff but none of it was clicking.
Thanks to Tim's post it all snapped into place.

Get 3D things into obj format then convert them to OpenGLES arrays.
A bit more googling about UV 2D textures and that bit fits into place too.

The trouble with simple examples is they can be a bit too simple but look complex.

Use FreeCAD (cause I know it already) etc to make obj 3D files.
Obj to OpenGLES parser, something like this one for Blender
https://github.com/ricardo-rendoncepeda/GLBlender1

OpenSCAD should be able to export to obj format too?
Gavinmc42
Posts: 1656
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: Ultibo game programming

Postby Gavinmc42 » Wed Jun 20, 2018 1:02 pm

Putting this here in case I lose it again, found it years ago but did not understand it at the time.
https://github.com/Zaflis/nxpascal
It is OpenGL based but I need somewhere to start.
Is it small enough to port to Ultibo?

Some map rendering stuff here, not just for games but for flight control displays and GPS mapping.
https://github.com/tangrams
Will be interesting to see if for mapping OpenVG can be used as an overlay.

It can also be used for 3D data visualization?

Return to “Graphics”

Who is online

Users browsing this forum: No registered users and 1 guest