OpenSCAD with a hacky-first-try OpenGL ES2 and built on Raspberry Pi 3

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

OpenSCAD with a hacky-first-try OpenGL ES2 and built on Raspberry Pi 3

grit
Hello Community! I have some good news regarding running and building
OpenSCAD on Raspberry Pi 3 with Raspbian stretch and QtOpenGL.

Yes - finally I have hacked a working example - as in working (not feature
complete though) - and the code is on Github  
https://github.com/henwist/hacky_openscad_2018
<https://github.com/henwist/hacky_openscad_2018>   on branch opengles2.

The code is not in production state yet and will not be for some time to
come. Bear in mind that this is a hack and I have commented code and added
code on top of functions, added classes to
existing ones, left code that don't do anything useful and probably done
some bad looking solutions that would not pass any code reviews at all. That
said - I have built this version natively on a
Raspberry Pi 3 with 2GB swap partition and standard Qt5.7.1 as delivered by
Raspbian.
GLEW is not in the way anymore and compilation works beautifully natively as
expected.

Now to functionality of OpenSCAD: F6 render works as expected and will
output a model that can be zoomed and rotated in a rudimentary way, but F5
preview will not function as expected. F5
will just output models without knowing if it is a hole or a solid object,
so there will just be solids on top on each other. *And* there may be
leftovers from a earlier render or preview - the vertices
are not deleted between runs.

So I think we have some options to discuss on the armhf platform (or any
other platform that only have OpenGL ES2):
1. Disable F5 preview (the easiest one).
2. Rewrite OpenCSG to use  OpenGL ES2 functions instead of the ones used now
and not use GLEW.
3. The one you think of...

Regardless of the outcome of the OpenCSG matter, I think it is of interest
to be able to use OpenSCAD on armhf platforms than not being able to use it
at all. I am ready to code the full solution
(not OpenCSG though) with OpenGL ES2 so that all GUI functions using OpenGL
under the hood will be usable in F6 render mode - if the Community thinks
this is viable.

What do you think the solution is to the matter of F5 preview on platforms
with OpenGL ES2 renderer?

//Best regards Henrik



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: OpenSCAD with a hacky-first-try OpenGL ES2 and built on Raspberry Pi 3

kintel
Administrator
Hi Henrik,

This sounds great!

Regarding Preview support, I would suggest:

1. Make it possible to turn off (probably at compile time), with reasonable GUI behavior (e.g. warning popup or greyed out menu entries)
2. Port OpenCSG to OpenGLES.

Since 2. will take some time, starting on 1. would make sense.
For 2., this is perfectly doable; there is nothing in OpenCSG that inherently requires OpenGL proper. Before embarking on that, touching base with the OpenCSG author would make sense. I can also be of assistance as I'm quite familiar with the underlying algorithm used in OpenCSG.

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: OpenSCAD with a hacky-first-try OpenGL ES2 and built on Raspberry Pi 3

grit
kintel wrote

> Regarding Preview support, I would suggest:
>
> 1. Make it possible to turn off (probably at compile time), with
> reasonable GUI behavior (e.g. warning popup or greyed out menu entries)
> 2. Port OpenCSG to OpenGLES.
>
> Since 2. will take some time, starting on 1. would make sense.
> For 2., this is perfectly doable; there is nothing in OpenCSG that
> inherently requires OpenGL proper. Before embarking on that, touching base
> with the OpenCSG author would make sense. I can also be of assistance as
> I'm quite familiar with the underlying algorithm used in OpenCSG.
>
>  -Marius

Hi Marius,

This sounds ok to me... I think I'll start with 1. and a compile time #ifdef
could prohibit F5 preview from working on OpenGL ES2-only platforms in
addition to greyed out menu entries.

Regarding 2., which I don't have the knowledge of to be able to port yet -
but someone may find it an adventourus journey:
I have researched which OpenGL functions that are needed in OpenCSG and
which are  in Raspbian stretch:

*OpenCSG OpenGL functions in use vs libGLESv2 OpenGL ES2 functions in
Raspbian stretch: *
/
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glBindFramebuffer
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glBindRenderbuffer
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glBindTexture
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glCheckFramebufferStatus
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glClearColor
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glClearDepth
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glClearStencil
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glCullFace
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDeleteFramebuffers
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDeleteRenderbuffers
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDeleteTextures
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDepthFunc
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDepthMask
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDepthRange
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glFramebufferRenderbuffer
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glFramebufferTexture2D
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glFrontFace
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGenFramebuffers
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGenRenderbuffers
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGenTextures
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGetFloatv
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGetIntegerv
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glPixelStorei
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glReadPixels
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glScissor
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glTexImage2D
1  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glViewport
2  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glColorMask
2  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glIsEnabled
2  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glRenderbufferStorage
2  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glStencilFunc
2  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glStencilMask
2  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glStencilOp
2  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glTexParameteri
3  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDisable
3  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDrawArrays
3  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:  glEnable
8  in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:  glClear
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glAlphaFunc
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glBeginOcclusionQueryNV
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glBeginQueryARB
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glBindFramebufferEXT
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glBindProgramARB
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glBindRenderbufferEXT
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glCheckFramebufferStatusEXT
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glColor3f
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glColor4ub
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glColor4ubv
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDeleteFramebuffersEXT
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDeleteOcclusionQueriesNV
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDeleteProgramsARB
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDeleteQueriesARB
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDeleteRenderbuffersEXT
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDepthBoundsEXT
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDisableClientState
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glDrawPixels
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glEnableClientState
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glEndOcclusionQueryNV
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glEndQueryARB
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glFramebufferRenderbufferEXT
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glFramebufferTexture2DEXT
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGenFramebuffersEXT
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGenOcclusionQueriesNV
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGenProgramsARB
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGenQueriesARB
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGenRenderbuffersEXT
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGetOcclusionQueryuivNV
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glGetQueryObjectuivARB
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glLoadIdentity
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glLoadMatrixf
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glMatrixMode
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glMultMatrixf
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glPopAttrib
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glPopMatrix
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glProgramStringARB
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glPushAttrib
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glPushMatrix
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glRasterPos2i
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glRenderbufferStorageEXT
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glTexEnvi
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glTexGenfv
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glTexGeni
no match in file:  /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0  for:
glVertexPointer
/

//Henrik



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: OpenSCAD with a hacky-first-try OpenGL ES2 and built on Raspberry Pi 3

kintel
Administrator

> On Mar 11, 2019, at 10:14, grit <[hidden email]> wrote:
>
>
> Regarding 2., which I don't have the knowledge of to be able to port yet -
> but someone may find it an adventourus journey:
> I have researched which OpenGL functions that are needed in OpenCSG and
> which are  in Raspbian stretch:
>
> *OpenCSG OpenGL functions in use vs libGLESv2 OpenGL ES2 functions in
> Raspbian stretch: *

OpenCSG implements multiple variants of algorithms for different generations of GPU hardware.
Focusing on the most modern algorithm and ifdef'ing out the rest would also be a good start.

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org