Getting started with LWJGL

I finally want to start fooling around with LWJGL and OpenGL. However, I am having a hard time finding basic tutorials besides the first few on the LWJGL website.

I know of this website, but it is for C++. I understand that OpenGL is the same across both, but I ran into a few things that I couldn’t find in LWJGL, specifically this first example.

Are there certain things that are specific for each language? Some of those things I just couldn’t find.

Are there any good OpenGL/LWJGL full beginners tutorial sets out there for Java?

Thanks,
| Nathan

There are very few Java-based OpenGL tutorials out there, unfortunately. Fortunately, all of the C++ methods look identical in LWJGL, the only difference is that you will often prefix them with the version number.

GL11.glBindTexture(GL11.GL_TEXTURE_2D);

glClear, glClearColor, glBindTexture, etc were adopted “into core” in OpenGL 1.1 or earlier, and so you will find it in the GL11 class. Likewise, glUseProgram (shaders) was adopted into core in 2.0, so you look in GL20. When in doubt, search the method in google using “lwjgl” as a keyword. Static imports are also useful for readability.

You’re in luck, though, as that tutorial has been ported to Java:
https://github.com/rosickteam/OpenGL

Awesome, thank you!

| Nathan

Question:

In the source of the LWJGL port of those tutorials, I don’t quite understand how he does this:


	protected void display() {
		glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
		glClear(GL_COLOR_BUFFER_BIT);
	};

How can he access glClearColor and glClear without GL11 in front? When I try to do that, it doesn’t work.

| Nathan

import static org.lwjgl.opengl.GL11.*;

Oh.

Haha, thanks. I just now see davedes’ “Static imports are useful for readability”.

| Nathan