User avatar
PeterO
Posts: 5006
Joined: Sun Jul 22, 2012 4:14 pm

OpenGL development

Wed Feb 10, 2016 5:26 pm

Has anyone tried to build any OpenGL code yet ?
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 5006
Joined: Sun Jul 22, 2012 4:14 pm

Re: OpenGL development

Wed Feb 10, 2016 10:40 pm

I've built "Open Dynamics Engine" (ode) which has some OpenGL demos :-) Seems to work OK.

Image

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

fruitoftheloom
Posts: 20712
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: OpenGL development

Wed Feb 10, 2016 11:52 pm

PeterO wrote:Has anyone tried to build any OpenGL code yet ?
PeterO
:?: :?:
https://www.chromeexperiments.com/webgl
Retired disgracefully.....

User avatar
PeterO
Posts: 5006
Joined: Sun Jul 22, 2012 4:14 pm

Re: OpenGL development

Thu Feb 11, 2016 7:13 am

:?: :?: :!: :!:

Why is that relevant ? Hardly something you have written or built yourself !

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

fruitoftheloom
Posts: 20712
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: OpenGL development

Thu Feb 11, 2016 7:38 am

PeterO wrote:
:?: :?: :!: :!:

Why is that relevant ? Hardly something you have written or built yourself !

PeterO
Well just wondered, hence the question marks, if these projects would be a good test of WebGL, though presume you would need Chromium installed ?
Retired disgracefully.....

User avatar
PeterO
Posts: 5006
Joined: Sun Jul 22, 2012 4:14 pm

Re: OpenGL development

Fri Feb 12, 2016 12:05 pm

I've got the examples from gtkglext working :-) https://projects.gnome.org/gtkglext/index.html
Although it seems to be a dead project it continues to work. There is a package for it included in Raspbian but I wanted the examples so I clones the sources and built it from them. The Makefile.am for the examples needs a few patches as some needed libraries are not linked by some of the examples. I'll post a fixed version when I've got them all working. But here is "the" teapot rendered in a gtk widow. It can be rotated etc with the mouse.
PIteapot.png
PIteapot.png (32.31 KiB) Viewed 6192 times
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 5006
Joined: Sun Jul 22, 2012 4:14 pm

Re: OpenGL development

Fri Feb 12, 2016 2:33 pm

I have put an updated Makefile.am in http://www.peteronion.org.uk/OpenGL/Makefile.am Use it to replace Makefile.am in the examples directory and all the examples will then compile.
However color,pixmap and pixmap-mixed fail at run time, but then they also fail on my x86_64 Mint-17.3 box (which has a much more mature OpenGL implementation on it) so I think it a bit-rot in the example code rather than an OpenGL implementation problem.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: OpenGL development

Fri Feb 12, 2016 3:12 pm

I did compile KiCad with OpenGL just to find that it was recently added to the raspbian repository.

It has small glitches with real-time rendering. Diagonal lines are sometimes missing. But everything works in real time.

Image

So the OpenGL seems to be very mature imho.

It is amazing to witness how a 40€ computer can handle schematics and pcb routing.

User avatar
PeterO
Posts: 5006
Joined: Sun Jul 22, 2012 4:14 pm

Re: OpenGL development

Fri Feb 12, 2016 3:44 pm

karrika wrote: Diagonal lines are sometimes missing.
Things like that need to go on the bug reporting thread, but it's good that only such minor problems appear.

It's good that people are trying these big packages and that seem to work, but I'm more interested in hearing from people that are writing their own OpenGL code.

I'm just reinstalling (on another HDD partition) my PI2 so I can get a list of the packages needed to get gtk with gtkglext development working on a fresh Jessie installation.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
panik
Posts: 369
Joined: Fri Sep 23, 2011 12:29 pm
Location: Netherlands

Re: OpenGL development

Fri Feb 12, 2016 11:03 pm

PeterO wrote:It's good that people are trying these big packages and that seem to work, but I'm more interested in hearing from people that are writing their own OpenGL code.
I'm using GLFW 3 and OpenGL 2.1 with glsl version 120. That compiles and runs fine. Not very fast, but still impressive. Pretty basic, but it's all I need (and it had to run on older Macs as well as Linux and MS Windows).

I stripped everything except glfw, glm and glew from this cmake project: http://www.opengl-tutorial.org/ (the 2.1 port) and went from there. I have no idea if the 3.3 version works.
Microcontroller addon boards and software for Raspberry Pi A+/B+/Pi2:
- ARMinARM: ARM Cortex-M3 (STM32)
- AVRPi: ATmega32U4 & ATmega328 ("Arduino")
http://www.onandoffables.com

User avatar
PeterO
Posts: 5006
Joined: Sun Jul 22, 2012 4:14 pm

Re: OpenGL development

Sat Feb 13, 2016 10:49 am

Interesting tutorials. They do raise the point the OpenGL 2.1 is considered "old", and having been using OpenGLES 2.0 on the PI it does feel like a step backwards going to OpenGL 2.1. I've not used GLSL with OpenGL before but I'll be looking at that soon I expect.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
derhass
Posts: 32
Joined: Thu Aug 09, 2012 4:33 pm
Location: Germany
Contact: Website

Re: OpenGL development

Sun Feb 14, 2016 7:25 pm

PeterO wrote: It's good that people are trying these big packages and that seem to work, but I'm more interested in hearing from people that are writing their own OpenGL code.
Out of curiousity, I did play a bit with the GL driver on the Pi and my own code.

My experiences so far are:
  • stuff working with the old fixed function pipeline (GL1.x) is working reasonably well in most cases
  • the programmable pipeline basically works, too. However, if you do stuff that goes beyond what
    is allowed by GLES2/GLSL ES 1.0, you are likely to encounter problems
  • some stuff like setting glPolygonMode to somehting other than GL_FILL seems to be completely ignored / not yet implemented
  • there are also some precision issues
None of that is surprising, considering the VC4 gpu was never designed for desktop GL. It is quite astounding that it actually works as well as it already does.

Running one project of mine which has a fallback code path for GL2.1 on the pi resulted in a segfault at almost every draw call. It turned out that this was caused by using a shader with a loop depending on a uniform value as iteration limit (which is not required to be supported in GLES, but it is in desktop GL). After changing the shaders, things basically work, but I still get some weird graphical glitches:
Image

Those black bands in the environment map might be some general issue with cube maps (they always appear near the edges), or some precision issue with my texcoord calculation (haven't checked that yet). The dark patches on the ground are some weirder issue. That ground plane is generated through ray-casting, but this seems not like precision issues with that approach. When outputting the texcoords as colors, I also get sane results, but as soon as I sample the texture, those blocky artifacts appear. Seems to be some issue with using texcoords which are not directly varyings (probably because they are also not dynamically uniform), but hard to tell what exactly the issue is.
"Perfection is attained not when there is nothing more to add, but when there is nothing more to remove." -- Antoine de Saint Exupéry

User avatar
PeterO
Posts: 5006
Joined: Sun Jul 22, 2012 4:14 pm

Re: OpenGL development

Sun Feb 14, 2016 7:30 pm

Very interesting. I've not got to the point of trying my own OpenGL code yet (too many issues with extracting the OpenGL bits from something much larger).
I think you should put a link to your experiences in the OpenGL bugs thread viewtopic.php?f=63&t=135790
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

anholt
Posts: 4
Joined: Mon Feb 15, 2016 8:52 pm

Re: OpenGL development

Mon Feb 15, 2016 9:41 pm

Those black bands in the environment map might be some general issue with cube maps (they always appear near the edges), or some precision issue with my texcoord calculation (haven't checked that yet).
We probably need to force the wrap mode for cubes to clamp-to-edge, if you haven't done that. I think clamp-to-border or the default GL_CLAMP is technically valid, but it's never the right answer for actual rendering.

User avatar
derhass
Posts: 32
Joined: Thu Aug 09, 2012 4:33 pm
Location: Germany
Contact: Website

Re: OpenGL development

Mon Feb 15, 2016 11:11 pm

OK, it turned out all the remaining glitches were caused by a single thing: mipmapping. So now I have it barely working on the RPi 8-)

Image
"Perfection is attained not when there is nothing more to add, but when there is nothing more to remove." -- Antoine de Saint Exupéry

User avatar
karrika
Posts: 1070
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: OpenGL development

Thu Mar 03, 2016 8:13 pm

I just installed Kivy and the OpenGL rotating Blender object (monkey head) rotated nicely. I could also change the code for color of the lights, rotating axis. It all works as it should. I mean the python bindings allow me to give kivy opengl directives in python, making graphics programming easy.
monkey.jpg
monkey.jpg (12.02 KiB) Viewed 5400 times

User avatar
PeterO
Posts: 5006
Joined: Sun Jul 22, 2012 4:14 pm

Re: OpenGL development

Thu Mar 03, 2016 8:36 pm

Just trying Neverputt on a PI3. Smoth :-) Taking about 20% of one core.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “Graphics programming”