Enabling OpenGL GL2 compatible profile on a certain machine - problem!

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

Enabling OpenGL GL2 compatible profile on a certain machine - problem!

Mabula Haverkamp
This post was updated on .
Dear support,

I am developing an advanced image processing application (astrophotography) which works identical on Windows, Linux & MacOS.

Recently I have built in suport for OpenGL for the image viewer window using JOGL.

I am using only GL2 instructions.

I am initializing OpenGL with the following command to verify if a suitable OpenGL profile is available:

------------------------------------------------

glProfile = GLProfile.getMaxFixedFunc(true);
                               
if (glProfile != null) {
               
        // check compatible profile for FIXED Function GL2 interface
        if (glProfile.isGL2()) {
                               
                //System.out.println("GLG2 compatible");
                //System.out.println("Fixed Function glProfile " + glProfile.getName());
               
                openGL2Enabled = true;
                createGLImageViewer();
               
        } else {
                       
                openGL2Enabled = false;
                createNonGLImageViewer();
                               
        }
                       
} else {
                       
        openGL2Enabled = false;
        createNonGLImageViewer();
                       
}

----------------------------------------

Previously, I simply used GLProfile.getDefault(). I switched to GLProfile.getMaxFixedFunc(true) to be sure to select a Fixed Function Pipeline profile using a GPU if available on the system.

On most systems this works. But not on all. One of my customers has a windows 10 Pro machine with a Nvidia gtx 780 graphics card. For some odd reason, OpenGL won't be enabled on this machine and we have tried both

- GLProfile.getDefault()
- GLProfile.getMaxFixedFunc(true)

To be sure that there is no problem with the nvidia control panel software, I asked the customer to set the right funtions, like using by default the advanced 3D-screen configuration and we also tried to force OpenGL rendering GPU for the specific application. Unfortunately, for some reason, OpenGL won't be enabled on his machine in my application.

To further investigate, I send the customer a test version, which will output details on the OpenGL initialization, this is the output from his machine:

https://www.astropixelprocessor.com/wp-content/uploads/2018/09/OpenGL-NvidiaGTX780-profiles.jpg

Based on this, I have no clue why OpenGL is not enabled with a OpenGL2 compatible profile.

I suspect, a possible reason might be that there is other GPU/APU enabled hardware in the machine, perhaps on the motherboard. Is that suspicion valid?

EDIT: i just got confirmation of my customer that his motherboard is a ASUS Z87-EXPERT, which has iGPU capabilities, so that strenghtens my suspicion that this might have to do with my problem.

Can you tell me how I can change the OpenGL initialization so OpenGL will be used properly on this particular machine?

Kind regards,
Mabula

Reply | Threaded
Open this post in threaded view
|

Re: Enabling OpenGL GL2 compatible profile on a certain machine - problem!

gouessej
Administrator
Hello

Does this machine use Optimus? Is it a laptop? What makes you think that OpenGL is disabled on this machine? Do you get a GLException when calling GLProfile.getMaxFixedFunc(true)? Maybe it returns GLES1. If it's the case, either try to use GL2ES1 instead of GL2 or disable OpenGLES (this is what I do in my game).
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Enabling OpenGL GL2 compatible profile on a certain machine - problem!

Mabula Haverkamp
This post was updated on .
Thank you for the quick response.

It's a regular modular built pc, so I guess optimus isn't installed, but I'll ask.

Please check out the screenshot:
https://www.astropixelprocessor.com/wp-content/uploads/2018/09/OpenGL-NvidiaGTX780-profiles.jpg

It shows you at the bottom what is reported by calling GLProfile.getMaxFixedFunc(true)

All GLProfile queries

GLProfile.getDefault();
GLProfile.getMaxFixedFunc(true);
GLProfile.getMaxProgrammable(true);
GLProfile.getMaximum(true);

return the GL4bc profile, which as I understand is Backwards compatible to GL2.

So no exceptions are thrown.

Any clue, perhaps it chooses GL4bc but then it still fails at

if (glProfile.isGL2()) {

}

which wouldn't make sense I think ?

Thanks,
Mabula
Reply | Threaded
Open this post in threaded view
|

Re: Enabling OpenGL GL2 compatible profile on a certain machine - problem!

Mabula Haverkamp
Got confirmation that Optimus IS NOT used by the way.
Reply | Threaded
Open this post in threaded view
|

Re: Enabling OpenGL GL2 compatible profile on a certain machine - problem!

gouessej
Administrator
In reply to this post by Mabula Haverkamp
Somehow GL4bc isn't considered as an hardware rasterizer on this specific GPU. Then, when you call getMaxFixedFunc(true), it returns GLES1 instead of GL2 or GL4bc. If you call getMaxFixedFunc(false) on this machine, it will return GL4bc.

See https://github.com/sgothel/jogl/blob/master/src/jogl/classes/com/jogamp/opengl/GLProfile.java#L1025
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Enabling OpenGL GL2 compatible profile on a certain machine - problem!

Mabula Haverkamp
Thank you Julien,


Okay, so then I need to assume this can happen on other graphic cards as well, right? Or is this very odd?

Accordign to the screenshot with output, the call

getMaxFixedFunc(true)

does return GL4bc so that is what confuses me the most...

Regarding implementation for all machines of all my customers, would i be best of to simple check each profile that is compatible for my commands from best to worst profile and stop with the profile that complies with:

glProfile.isGL2()

?
Or should I simply remove that call ?

I am sure that other developers would have this issue as well so isn't there some general OpenGL initialization code for JOGL beside these

getMaxFixedFunc(true) calls ?

It does bring up the question how to deal with different GPUs in a single machine as well. But I will open a separate topic for that.

Mabula


Reply | Threaded
Open this post in threaded view
|

Re: Enabling OpenGL GL2 compatible profile on a certain machine - problem!

gouessej
Administrator
It's a bit weird, GL4bc shouldn't be detected as a software rasterizer. You could simply call getMaxFixedFunc(true) first and if it doesn't return a GL2 implementation, call getMaxFixedFunc(false).

If you used GL2ES1 (ie. the common subset of GL2 and GLES1), you could use the returned profile as is. If I were you, I would stick to GL2 only if I needed some features not in GL2ES1.

There is no way of dealing with different GPUs in a single machine in JOGL. It's advised to force the machine to avoid switching to another GPU at runtime by choosing a particular setting.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Enabling OpenGL GL2 compatible profile on a certain machine - problem!

Mabula Haverkamp
Hi Julien,

Thank you again, I will try all the suggestions that you made:

- You could simply call getMaxFixedFunc(true) first and if it doesn't return a GL2 implementation, call getMaxFixedFunc(false).
- If i were you, I would stick to GL2 only if I needed some features not in GL2ES1. (probably can use GL2ES1, so I'll verify that first)

And I will report back if I am able to solve this with my customer.

Mabula
Reply | Threaded
Open this post in threaded view
|

Re: Enabling OpenGL GL2 compatible profile on a certain machine - problem!

Mabula Haverkamp
Hi Julien,

Okay, I just read this (should probably have read this sooner... ;-( )

" Today, desktop and embedded GPU's implement the programmatic shader (PSP) based rendering.

Still the fixed function subset is provided by most drivers. However, since the hardware itself does not implement such functionality anymore, it is completely implemented in software by the OpenGL driver.

This leads to the conclusion it is best advised for OpenGL applications to avoid the FFP, but using the PSP. This allows the implementor to utilize application level optimization which usually cannot be reached by the very generic implemented FFP in the OpenGL drivers."

So if I can make my application work with the GL2ES2 profile, OpenGL would use hardware OpenGL PSP instead of software OpenGL FFP normally ?

I understand now that by choosing only GL2, I do limit the options on the hardware and drivers of the user, since not all drivers will have the software FFP parts..

Mabula
Reply | Threaded
Open this post in threaded view
|

Re: Enabling OpenGL GL2 compatible profile on a certain machine - problem!

gouessej
Administrator
Hello

It depends on your target. I advise you to modify your source code step by step. You see that ES1 is implemented in hardware in this driver, why not trying to support GL2ES1 as a first step before evaluating the need of supporting a fully shader based pipeline?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Enabling OpenGL GL2 compatible profile on a certain machine - problem!

Mabula Haverkamp
Hi Julien,

Yes, you're right.

For now, the problem is solved ;-). The solution on the machine of my customer was indeed calling

glProfile = GLProfile.getMaxFixedFunc(false);

after failure of

glProfile = GLProfile.getMaxFixedFunc(true);

to provide a GL2 compatible profile.

Now OpenGL is enabled and all works fine.

Thank you very much for your assitance.
Mabula
Reply | Threaded
Open this post in threaded view
|

Re: Enabling OpenGL GL2 compatible profile on a certain machine - problem!

gouessej
Administrator
You're welcome.
Julien Gouesse | Personal blog | Website