Page 1 of 1

OpenGL development

Posted: Wed Feb 10, 2016 5:26 pm
by PeterO
Has anyone tried to build any OpenGL code yet ?
PeterO

Re: OpenGL development

Posted: Wed Feb 10, 2016 10:40 pm
by PeterO
I've built "Open Dynamics Engine" (ode) which has some OpenGL demos :-) Seems to work OK.

Image

PeterO

Re: OpenGL development

Posted: Wed Feb 10, 2016 11:52 pm
by fruitoftheloom
PeterO wrote:Has anyone tried to build any OpenGL code yet ?
PeterO
:?: :?:
https://www.chromeexperiments.com/webgl

Re: OpenGL development

Posted: Thu Feb 11, 2016 7:13 am
by PeterO
:?: :?: :!: :!:

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

PeterO

Re: OpenGL development

Posted: Thu Feb 11, 2016 7:38 am
by fruitoftheloom
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 ?

Re: OpenGL development

Posted: Fri Feb 12, 2016 12:05 pm
by PeterO
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 6267 times
PeterO

Re: OpenGL development

Posted: Fri Feb 12, 2016 2:33 pm
by PeterO
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

Re: OpenGL development

Posted: Fri Feb 12, 2016 3:12 pm
by karrika
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.

Re: OpenGL development

Posted: Fri Feb 12, 2016 3:44 pm
by PeterO
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

Re: OpenGL development

Posted: Fri Feb 12, 2016 11:03 pm
by panik
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.

Re: OpenGL development

Posted: Sat Feb 13, 2016 10:49 am
by PeterO
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

Re: OpenGL development

Posted: Sun Feb 14, 2016 7:25 pm
by derhass
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.

Re: OpenGL development

Posted: Sun Feb 14, 2016 7:30 pm
by PeterO
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

Re: OpenGL development

Posted: Mon Feb 15, 2016 9:41 pm
by anholt
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.

Re: OpenGL development

Posted: Mon Feb 15, 2016 11:11 pm
by derhass
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

Re: OpenGL development

Posted: Thu Mar 03, 2016 8:13 pm
by karrika
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 5475 times

Re: OpenGL development

Posted: Thu Mar 03, 2016 8:36 pm
by PeterO
Just trying Neverputt on a PI3. Smoth :-) Taking about 20% of one core.
PeterO