LWJGL and GLSL Versions

Recently I’ve been working on a rendering engine in LWJGL and I’ve come across numerous issues with versions. So I am after advice on what would be the correct versions to use with this new project.

Firstly, LWJGL 2 or LWJGL 3? Version 2 is still current but version 3 is a complete rewrite and is still missing some utility classes; such as GLU.gluPerspective(…);

After using LWJGL 2 for the compatibility, I have then come across more issues;

As I want to stick with modern OpenGL, I am using VBOs to render my faces. However when using GLSL to do some basic lighting, I have had to use GLSL 140 to ensure compatibility with the functions like normalise() and transform(). Then i had to enable GL_ARB_compatibility to let me access gl_Normal, gl_Vertex and gl_Color, Like so:

#version 140
#extension GL_ARB_compatibility : require

Basically all I’m asking is for some current advice, all the tutorials on the internet are different and outdated.

So, to my questions:

  1. What LWJGL version would you recommend? is 3 complete enough to use in production?
  2. What GLSL version should I use?
  3. What are the replacements for the data I am using the compatibility layer to access?
  4. Are there any nice up to date resources or tutorials for Modern OpenGL?

Thanks in advance for clarifying this for me. It’s a steep learning curve

If you’re doing something in 2D and I recommend OpenGL 3+ someone’s going to shout at me, and if I recommend OpenGL 2+ and you’re doing 3D someone’s going to shout at me.

Need some context! What are you doing with it? In general I’d say learn OpenGL 2 and work yourself up. That way you learn the differences easier.

Just use OpenGL 3.3 and GLSL 330. EDIT: Steam Hardware Survey says DX10 support is at 97.87% right now which, disregarding the earlíest Intel GPUs (that are so weak they can barely glClear() the screen at 60 FPS) that never got OGL3 support, is the same as OGL3. Mac and Linux also supports OGL3.3 now.

LWJGL 3 has it’s perks and quirks. Windows are more powerful in some ways but limited in others. There are problems with window icons and you can’t switch between fullscreen and windowed mode without recreating the OpenGL context which unloads all your stuff. On the other hand you have working undecorated windows, more powerful V-sync settings and support for multiple windows.

Replace the built-in attributes with your own custom-defined attributes. Lighting parameters can be replaced with uniform shader variables and you have to do your own lighting calculations in the shader.

If you doing stuff in 2D you need a Giphoscope :wink:

Thanks for all the advice guys,

Basically Im making a voxel based engine for a game idea of mine. I know you’re all gonna thing “another one of those minecraft wannabes” but this game ideas been in my head for a long time and if anything it’ll be following closer in graphics to CubeWorld than Minecraft.

Anyway thats besides the point. I’m making a 3D voxel engine and I guess I would just like to learn the most current version whilst still keeping compatibility open.

So I guess I’ll use LWJGL3 and OpenGL 3.3 with GLSL 3.3 as well?

All your up to date tutorials are going to be in C++.

https://open.gl/

Has got fairly good tutorials to get you started.