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.
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.
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();
}
}
to your shader code.
Our engine already give a solution for “One code all GLSL”
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
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:
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)
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
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.