Questions about the shader version

I found this very strange indeed, I will check my graphics card driver settings after

GLSL100 is not a real GLSL version. It tells JME to “use whatever lowest version is appropriate”. Probably GLSL110 in this case… unless you are running on a phone then it will be some version of GL ES.

On a quick read, I can’t spot anything obvious that would behave different between those versions.

This is a simple demo if you’re interested

The Effect folder is GLSL150.
The Test folder is GLSL110.

I guess these are fragment shaders that you’ve posted and so that should be an “in” and not an “out”.

Things go “out” of the .vert and “in” to the .frag… except the things that will actually write to the frame buffer.

So my guess is that in the second version (which is actually different code and not just a different GLSL version) that there is no texture coordinate.

OK with your help I have got the basic concept :smiling_face_with_three_hearts:

I’ll go check my graphics card drivers. :thinking:

1 Like

I checked with the test software and found that it supports up to 4.6

BUT:

 * Vendor: NVIDIA Corporation
 * Renderer: NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2
 * OpenGL Version: 3.2.0 NVIDIA 531.79
 * GLSL Version: 1.50 NVIDIA via Cg compiler
 * Profile: Core

I tried to reinstall other versions of the driver does not seem to work.

It’s confusing.
My guess is that jme runs in some kind of compatibility mode.

Just in case, does it detect the same version with lwjgl2?

信息: LWJGL 2.9.5 context running on thread jME3 Main
 * Graphics Adapter: C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_e34a87a86b660c23\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_e34a87a86b660c23\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_e34a87a86b660c23\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_e34a87a86b660c23\nvldumdx.dll
 * Driver Version: null
 * Scaling Factor: 1
5月 24, 2023 3:20:52 上午 com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
信息: OpenGL Renderer Information
 * Vendor: NVIDIA Corporation
 * Renderer: NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2
 * OpenGL Version: 3.2.0 NVIDIA 531.79
 * GLSL Version: 1.50 NVIDIA via Cg compiler
 * Profile: Core

Yes it looks the same

1 Like

Just in case, set renderer to LWJGL_OPENGL33 and higher values and see if it makes any change.

appSettings.setRenderer(AppSettings.LWJGL_OPENGL33);
public class Testglsl extends SimpleApplication{

    @Override
    public void simpleInitApp() {
//    Box box= new Box(Vector3f.ZERO, 1f,1f,1f);
//   // Geometry cube = new Geometry("box", box);
//    Geometry cube = new Geometry("球体", new Sphere(10, 16, 2));
//    Material mat = new Material(assetManager,"Models/Syana/Syana.j3md");
//    cube.setMaterial(mat);
//    cube.setMaterial(assetManager.loadMaterial("Models/Syana/Syana.j3m"));Effect
AppSettings set = new AppSettings(true);
set.setRenderer(AppSettings.LWJGL_OPENGL33);

    Box box1= new Box(new Vector3f(2,2,2), 1f,1f,1f);
    Geometry cube1 = new Geometry("box", box1);
    Material mat1 = new Material(assetManager,"Shaders/Effect/EffectMatDef.j3md");
   // mat1.setFloat("Time", 0.1f);
    cube1.setMaterial(mat1);
    
   // rootNode.attachChild(cube);
    rootNode.attachChild(cube1);
    }
    
        public static void main(String[] arguments) {
        Testglsl application = new Testglsl();
        application.start();
        
        
    }
        
}
信息: LWJGL 3.3.1 build 7 context running on thread jME3 Main
 * Graphics Adapter: GLFW 3.4.0 Win32 WGL Null EGL OSMesa VisualC DLL
5月 24, 2023 3:29:00 上午 com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
信息: OpenGL Renderer Information
 * Vendor: NVIDIA Corporation
 * Renderer: NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2
 * OpenGL Version: 3.2.0 NVIDIA 531.79
 * GLSL Version: 1.50 NVIDIA via Cg compiler
 * Profile: Core

Nothing has changed

You have added it in the wrong place.

It should be in the main like this:

public static void main(String[] arguments) {

        Testglsl application = new Testglsl();

        AppSettings settings = new AppSettings(true);
        settings.setRenderer(AppSettings.LWJGL_OPENGL33);

        application.setSettings(settings);
        application.start();
}
信息: LWJGL 3.3.1 build 7 context running on thread jME3 Main
 * Graphics Adapter: GLFW 3.4.0 Win32 WGL Null EGL OSMesa VisualC DLL
5月 24, 2023 3:34:38 上午 com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
信息: OpenGL Renderer Information
 * Vendor: NVIDIA Corporation
 * Renderer: NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2
 * OpenGL Version: 3.3.0 NVIDIA 531.79
 * GLSL Version: 3.30 NVIDIA via Cg compiler
 * Profile: Core

There seems to be a change
can see GLSL Version 3.30

1 Like

I have a question, how do I get jme to use the latest version of OpenGL by default?

can see that ‘pspeed’ shows the highest OpenGL 4.6.0 by default.
Maybe there is a strange setting in my OS I will check it.

For Q1 Q3:
Please check if you add

#import "Common/ShaderLib/GLSLCompat.glsllib" 

to your shader code.
Our engine already give a solution for “One code all GLSL” :smiley:
and with it we shall use varying-attribute instead of out-in for compatibility with GL2.0.
Q2:
please check this thread , hope it may help.

BTW:
use App.getRenderer().getCaps() check GLSL versions supported

1 Like

Which package is this from JME? Core?(Well found it indeed from the core)

I don’t seem to find .getCaps() which class he is from?

I mean, he literally showed you almost the exact code…

Application.getRenderer(): Application (jMonkeyEngine3)
Renderer.getCaps(): Renderer (jMonkeyEngine3)

As pspeed said our Randerer class in charge of GL functions.
and you will get output like : GLSL430 GLSL420 … normarlly from GLSL460 to 100

There is yet another TRICKY way to see which one is actually used by the engine:

  1. Move to your shader code, in the middle of your code add a new line with something like “adfqer” and run the program. (the “adfqer” can be anything ,It just used to generate error)
  2. You will receive a openGL compile time ERROR message, the message will show you the exact “code string” send to the GLSL compiler, within this “code string” the first several lines are what you want.

jme by default settings.getRenderer() has the value LWJGL-OpenGL3(opengl 3.2).
I don’t understand how the OpenGL version of Lwjgl3 was acquired.
But it defaults to OpenGL3.2

I found that lwjgl3 is the core by default and cannot be modified.

Please visit the thread (post) I suggested .
and visit github Issue #2011 PR #2009, there is a bug and will be fixed in the next release.

Yes, but regarding this…

That information is coming directly from the driver without interpretation on JME’s part.

In any case, I wonder what the actual issue is at this point. It seems unlikely that features beyond GLSL150 would be needed by someone still struggling to understand how versions work… but maybe.

And even still, what problems are still occurring after:

The problem with this thread is we get bogged down in trouble-shooting the trouble-shooting and not actually fixing real problems.

Problems that aren’t real are not real problems.

2 Likes