OpenGL

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

Re: OpenGL

Postby Gavinmc42 » Wed Jul 31, 2019 11:52 am

Buried in here is some OpenGL and GLES examples,
/home/pi/ultibo/core/fpc/source/packages

These compiled/ran using Geany on a Pi4, ie no need for Lazarus.

FreeGLUT looks like it could be the base of a game engine or viewer.
But it is all in C.
I found the glutSolidSphere/glutWireSphere very handy for making 3D blimps.
A Pascal version of GLUT would be similar to AJ Starkes OpenVG lib?

Leave it as C code and learn how to call it from Pascal?
Gavinmc42
Posts: 1662
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: OpenGL

Postby Gavinmc42 » Sun Aug 18, 2019 3:50 am

A cut down GLUT replacement in Free Pascal.
https://github.com/daar/GLPT
Not sure why the gears demo is so slow.

So many OpenGL demos and tuts in Delphi and German.
But a good place to start is here, at least for some terrain and sky box stuff.
http://www.sulaco.co.za/opengl.htm

One of the things I am finding with these Pi4's is so much just works it is very hard to sort it all out.
Finding stuff that can be ported to Ultibo is not easy if there are dependencies.
x11 being the main one that needs to go.
pik33
Posts: 889
Joined: Fri Sep 30, 2016 6:30 pm
Location: Poland
Contact:

Re: OpenGL

Postby pik33 » Mon Aug 19, 2019 6:23 pm

The most important thing now... is... to have a base: a Ultibo running on Ri4 with a simple framebuffer

We don't need to have X here: mesa can output to GBM framebuffer without X

The GBM framebuffer is, in reality, some RAM.

We have to (1) know how to recompile mesa for Ultibo (2) know how to tell mesa to render to our framebuffer
Gavinmc42
Posts: 1662
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: OpenGL

Postby Gavinmc42 » Tue Aug 20, 2019 2:07 am

Yep Pi4 frame buffer first.

If the rest takes a year or two to figure out I'm not worried.
The Ultibo and Lazarus/FPC world is mostly unknown to me, much still to explore.

Mesa is talking to the VC6 hardware direct, no blob in the way.
In theory it should be easier to port, for someone who knows how :lol:
Mesa can also do OpenGL on Wayland, which I want to try.
The mesa demos has code for Wayland OpenGL and plain EGL.

But right now GLSL Shader stuff has really got me hooked, "ohh shiny, pretty".

X11 and Wayland support are not needed for me, too big, too complex.
Much more fun learning how to do without.
pik33
Posts: 889
Joined: Fri Sep 30, 2016 6:30 pm
Location: Poland
Contact:

Re: OpenGL

Postby pik33 » Tue Aug 20, 2019 5:50 pm

With, or without X, is only an initialization stuff. The rest is the same. So there may be easier to program and debug GL stuff using Lazarus under X. You have an OpenGL control there, so... no init (near) at all, no egl, glx, glut, the component does it for you. Put it on the form and play. Then all your OpenGL calls and shaders can be moved to your X-less environment including Ultibo as soon as you can init OpenGL there.

As I noticed there is no platform and OS related code (!) in my test Lazarus/OpenGL/RPi4 program so I can try to move it to PC/Windows as is and check if it works :)

Update: it works on Windows PC. I only found a time measurement procedure which had to be commented out as it uses linux stuff (I have a windows version too so I can replace it), the rest simply worked as it was on RPi4.

The Lazarus is really "write once, compile everywhere" stuff
Gavinmc42
Posts: 1662
Joined: Sun Jun 05, 2016 12:38 pm
Location: Brisbane, Australia

Re: OpenGL

Postby Gavinmc42 » Wed Aug 21, 2019 1:20 am

The Lazarus is really "write once, compile everywhere" stuff

Yep, the more I use it the more impressed I get and Ultibo is sitting in that Laz/fpc tool chain.
I serious doubt any other "baremetal" toolset will be able to get close to Ultibo in usability.

I have noticed the OpenGL package examples are so clean, I can even use fpc in Geany without Lazarus.
If I did that with C the include dependencies would(have) drive me nuts, only the C mesa demos are as clean.

Return to “Graphics”

Who is online

Users browsing this forum: No registered users and 0 guests