PDA

View Full Version : Cleaning up my OpenGL program



Slookeur
10-06-2016, 10:44 AM
Hello World,
and thanks for reading this, first I must confess that I am not sure that this forum is the best one
to post my question ... which is not really a question ...
I will not be surprise if it is moved somewhere else later on.
But since I am mostly write code on/for Linux (with GTK+3) I decided to post the message here.

I need some advise, I wrote/write a very nice piece of program, dedicated to the analysis/3D view/edition ...
of atomic systems, from few atoms to millions of atoms ... I whish to release my program sometime in 2017.
For more than 10 years now I exclusively worked on Linux, mostly with the nvidia 'nouveau' driver from MESA,
switching from time to time to VirtualBox image of Win32 to port the program.
Recently I tried my program on different "native" OS/Drivers/CG ... to my disappointment, but not surprise
it was somewhat of a failure, not getting the OpenGL version/Drivers/CG to produce the expected results.
I learned OpenGL by my-self, browsing the internet, when I needed to add a feature I search the net, found what
I was looking for, added it ... and so on ...
If you are not aware of it already let me tel you, from a beginner point of view at least, that concerning OpenGL
the web is a big mess, you find so many tutorials for so many different versions of OpenGL ...
... getting to the point ... roughly speaking my program is probably a mess of commands from all versions
of OpenGL from 1.0 to 3.* (even maybe 4.* who knows, but I do not think that I am that good) ...
yes it is a mess, a fine one I am happy to say, but still it is a mess ... I hope that I described the background properly ...

Here is a screen capture of my program, that might help you to realize what I am doing.
... sorry I tried but now way to upload or link an image file here ... sorry.
Please check it here: https://www.flickr.com/photos/slookeur/29525963043/in/dateposted-public/

Now if I want to release my program someday, not in 5 years from now, I would probably need to clean up that mess,
and I do not know where to start.

So OpenGL gurus, and others, what would be your advise to start cleaning my self-written mess and produce a nice
"OpenGL-portable" version of my program for the years to come ?

Thanks for your advise !

Vylsain
10-12-2016, 01:17 AM
One way to do this, once you have chosen the version you need/want to work with, is to create a core profile OpenGL context of that version.
You can then use the extension GL_KHR_debug that will report any call to a deprecated function.
It helped me a lot to clean my code and remove deprecated features from older OpenGL version.

Silence
10-12-2016, 03:30 AM
Be careful with Gtk 3 and OpenGL. From Gtk 3.0 up to Gtk 3.15, there is no widgets for doing GL renderings.
From Gtk 3.16 up to Gtk 3.19, only GL 3.1 (or superior) core-profile contexts can be created.
Since Gtk 3.20, if no GL 3 core-profile contexts can be created, then Gtk will automatically fallback to a compatibility profile context (this is not possible on below versions).

So the best thing is as the other poster said, to remove any deprecated features and to run with GL 3.x (or higher) only. Depending on the size (and complexity) of your project, this will certainly take a lot of time. And this will be the occasion to centralize some parts (VAO/VBO to store data for example).

cali9x
10-15-2016, 02:59 AM
Since Gtk 3:20, without GL 3 core- biographies of context can be created, then Gtk will automatically backup to a compatible profile context

congviec0123
11-09-2016, 07:51 PM
Hello World,
and thanks for reading this, first I must confess that I am not sure that this forum is the best one
to post my question ... which is not really a question ...
I will not be surprise if it is moved somewhere else later on.
But since I am mostly write code on/for Linux (with GTK+3) I decided to post the message here.

I need some advise, I wrote/write a very nice piece of program, dedicated to the analysis/3D view/edition ...
of atomic systems, from few atoms to millions of atoms ... I whish to release my program sometime in 2017.
For more than 10 years now I exclusively worked on Linux, mostly with the nvidia 'nouveau' driver from MESA,
switching from time to time to VirtualBox image of Win32 to port the program.
Recently I tried my program on different "native" OS/Drivers/CG ... to my disappointment, but not surprise
it was somewhat of a failure, not getting the OpenGL version/Drivers/CG to produce the expected results.
I learned OpenGL by my-self, browsing the internet, when I needed to add a feature I search the net, found what
I was looking for, added it ... and so on ...
If you are not aware of it already let me tel you, from a beginner point of view at least, that concerning OpenGL
the web is a big mess, you find so many tutorials for so many different versions of OpenGL ...
... getting to the point ... roughly speaking my program is probably a mess of commands from all versions
of OpenGL from 1.0 to 3.* (even maybe 4.* who knows, but I do not think that I am that good) ...
yes it is a mess, a fine one I am happy to say, but still it is a mess ... I hope that I described the background properly ...

Here is a screen capture of my program, that might help you to realize what I am doing.
... sorry I tried but now way to upload or link an image file here ... sorry.
Please check it here: https://www.flickr.com/photos/slookeur/29525963043/in/dateposted-public/

Now if I want to release my program someday, not in 5 years from now, I would probably need to clean up that mess,
and I do not know where to start.

So OpenGL gurus, and others, what would be your advise to start cleaning my self-written mess and produce a nice
"OpenGL-portable" version of my program for the years to come ?

Thanks for your advise !

It helped me a lot to clean my code and remove deprecated features from older OpenGL version.