OpenGL: Can you use a mixture of old and new OpenGL functions?

Like this, for example:

	public void initialize() {
		try {
			Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
			Display.setTitle("Test");
			Display.create();
		}
		catch (LWJGLException e) {
			e.printStackTrace();
		}
	}
	
	public void start() {
		Random random = new Random();
		while (!Display.isCloseRequested()) {
			GL11.glViewport(0, 0, WIDTH, HEIGHT);
			GL11.glClearColor(random.nextFloat(), random.nextFloat(), random.nextFloat(), 1.0f);
			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
			
			//...
			//Some other codes irrelevant to this in-between these commented periods.
			//...
			
			int vertexShader = GL20.glCreateShader(GL20.GL_VERTEX_SHADER);
			GL20.glShaderSource(vertexShader, vertexShaderCode);
			GL20.glCompileShader(vertexShader);
			//...etc.
			
			
			//...
			
			Display.update();
			Display.sync(60);
		}
	}

And possible go from GL20 to GL30 and back to GL20, etc.? I know some functions were deprecated, but what if you can reuse old specifications and put them together in the new specifications of a program?

You can use whatever functions you want as long as they work together. Nothing is going to stop you from using shaders with display lists, or buffer objects mixed with immediate mode etc… OpenGL is just a graphics library with a bunch of functions for the programmer to use. It’s up to you to choose which ones will fit your needs, or the standards you employ.

I would like to note that some programmers do like to only use certain versions of OpenGL, for instance only using 4.x or above, which deprecates a lot of old code. Some people don’t care what version number they use, and that’s fine too.

New versions build (or deprecate) on older versions. LWJGL simply has the functions and enums grouped into the version they were introduced in. You can use all that’s appropriate and necessary.

For that case, I have come across an annoyance.

For deprecated OpenGL functions that were deprecated in the newer OpenGL specifications, but not in the older specifications, how do I disable the deprecated strikethrough and to limit the deprecation detection by specific classes only? As in, I’m only limiting myself to use OpenGL 2.0 and less, so please don’t tell me that they are deprecated, as I know they are in the newer versions of OpenGL.

No, they are not included in the new versions of OpenGL. Some functions are deprecated, some are outright removed, but when you use old deprecated functions, you are actually using the old OpenGL packages, not the new ones.

I do not know strikethroughs you’re getting though, what IDE are you using?

Eclipse Java, Kelper.

That OpenGL function is not deprecated. That LWJGL method is deprecated. It is now called glGetShaderi(int, int) :slight_smile:

See here for more details about this change: http://lwjgl.org/forum/index.php?;topic=4721.0

Ah, thanks.