STEP reader improvement (Pass 4): Moving to OpenGL 3.2

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
ickby
Posts: 2927
Joined: Wed Oct 05, 2011 7:36 am

Re: STEP reader improvement (Pass 4): Moving to OpenGL 3.2

Postby ickby » Mon Feb 06, 2017 10:16 am

Now how can we re-implement the SoBRepFaceSet::renderShape with it. This is where I am a little bit lost now
Hehe, no idea :) A wild guess would be that coin does make the VBO setup in the rendering code before encountering the IndexedFaceSet, when it finds the SoCoordinate3 node. So that part would need to be done in BrepFaceSet too as there we don't use coordinate nodes. But from here on you are alone, I have only ver little knoweledge about coin internals and openGL coin general. I looked at your code and did not even really understand it :)
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: STEP reader improvement (Pass 4): Moving to OpenGL 3.2

Postby vejmarie » Mon Feb 06, 2017 10:33 am

ickby wrote:
Now how can we re-implement the SoBRepFaceSet::renderShape with it. This is where I am a little bit lost now
Hehe, no idea :) A wild guess would be that coin does make the VBO setup in the rendering code before encountering the IndexedFaceSet, when it finds the SoCoordinate3 node. So that part would need to be done in BrepFaceSet too as there we don't use coordinate nodes. But from here on you are alone, I have only ver little knoweledge about coin internals and openGL coin general. I looked at your code and did not even really understand it :)
What is great with FreeCAD is that we are learning everyday ;). I think I found ways to get access to the color from a Material, so I shall be able to finish the VBO rendering as it is without Coin3d support, which I do not know (but I am interested to learn). As soon as I will have finish the OpenGL implementation, and fixed the color and faceselection issue, I will have a look to Coin and check if the implementation might be better. At least if the direct OpenGL works, we will have a made a nice step forward. We need to write a small article on how works the rendering engine of FreeCAD, it took a week to my brain to track everything ;)
triplus
Posts: 8802
Joined: Mon Dec 12, 2011 4:45 pm

Re: STEP reader improvement (Pass 4): Moving to OpenGL 3.2

Postby triplus » Mon Feb 06, 2017 6:53 pm

ickby wrote:I looked at your code and did not even really understand it :)
I know how you feel. ;)
wmayer
Site Admin
Posts: 15000
Joined: Thu Feb 19, 2009 10:32 am

Re: STEP reader improvement (Pass 4): Moving to OpenGL 3.2

Postby wmayer » Tue Feb 07, 2017 11:37 am

Here is a short description how to use VBO in Coin: https://grey.colorado.edu/coin3d/vbo_rendering.html So it's basically a matter of structuring the scene graph accordingly.

However, with custom nodes VBO support is getting a bit harder because all the related classes are internal classes. So one way is to go with SoShape::startVertexArray/SoShape::finishVertexArray or everything is done independent of Coin.
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: STEP reader improvement (Pass 4): Moving to OpenGL 3.2

Postby vejmarie » Tue Feb 07, 2017 12:37 pm

wmayer wrote:Here is a short description how to use VBO in Coin: https://grey.colorado.edu/coin3d/vbo_rendering.html So it's basically a matter of structuring the scene graph accordingly.

However, with custom nodes VBO support is getting a bit harder because all the related classes are internal classes. So one way is to go with SoShape::startVertexArray/SoShape::finishVertexArray or everything is done independent of Coin.
Yep agree this is what I read yesterday night. I am currently finishing the VBO implementation on Coin side. I think I found ways to get the color working with VBO. let's see if it works, this is part of my learning curve. And if yes, how we could replicate that with Coin ;)
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: STEP reader improvement (Pass 4): Moving to OpenGL 3.2

Postby vejmarie » Tue Feb 07, 2017 7:30 pm

Ok, good news my step branch can now display within the VBO Colors on faces ;) and Solid. So I just need to understand why I can't select a single face anymore, but the FPS is still at the same level aka x3 from standard implementation ;)

For the one who had difficulties to understand the code, good luck with the latest update, this is becoming a complex stuff, but at least it works. I will post probably a Wiki entry on what I have done and how it works if you are interested.
triplus
Posts: 8802
Joined: Mon Dec 12, 2011 4:45 pm

Re: STEP reader improvement (Pass 4): Moving to OpenGL 3.2

Postby triplus » Wed Feb 08, 2017 10:57 am

vejmarie wrote:I will post probably a Wiki entry on what I have done and how it works if you are interested.
Having it documented would for sure be useful.
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: STEP reader improvement (Pass 4): Moving to OpenGL 3.2

Postby vejmarie » Wed Feb 08, 2017 11:45 am

triplus wrote:
vejmarie wrote:I will post probably a Wiki entry on what I have done and how it works if you are interested.
Having it documented would for sure be useful.
Agree. I can now select standard surface ! Last step is to update properly the VBO when a part change occurs. I need to find a way to keep track of such event and reload the VBO with the right datas and I'll be done. Don't know yet the ETA, but progress are on track
ickby
Posts: 2927
Joined: Wed Oct 05, 2011 7:36 am

Re: STEP reader improvement (Pass 4): Moving to OpenGL 3.2

Postby ickby » Wed Feb 08, 2017 11:53 am

vejmarie wrote: Last step is to update properly the VBO when a part change occurs. I need to find a way to keep track of such event and reload the VBO with the right datas and I'll be done. Don't know yet the ETA, but progress are on track
You can easily trigger that from the viewprovider in the onChanged method. Look out if the changed property is the shape one and call a setup method in your node.
vejmarie
Posts: 551
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: STEP reader improvement (Pass 4): Moving to OpenGL 3.2

Postby vejmarie » Wed Feb 08, 2017 12:13 pm

ickby wrote:
vejmarie wrote: Last step is to update properly the VBO when a part change occurs. I need to find a way to keep track of such event and reload the VBO with the right datas and I'll be done. Don't know yet the ETA, but progress are on track
You can easily trigger that from the viewprovider in the onChanged method. Look out if the changed property is the shape one and call a setup method in your node.
Thanks, you just saved me some times and this is great !. Will try to run the implementation tonight.