glOrthod problem LWJGL

Yes, again, another LWJGL problem. Here’s the problem.

I’m following a tutorial for LWJGL and have a problem with my basic code.
Where the glOrtho(float, float, float, foat, float) is, It gives an error.

Error:

the method glOrtho(double, double, double, double, double) in the type GL11 is applicable for the arguments (int, int, int, int, int) 

The code is:


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


public class MAin {
	
	public MAin() {
		try {
			Display.setDisplayMode(new DisplayMode(500, 500));
			Display.setTitle("GAME");
			Display.create();
		} catch (LWJGLException e) {
			
			e.printStackTrace();
		}
		
		//Initialization
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		//ERROR IN glOrtho: 
		glOrtho(0, 640, 480,-1, 1);
		glMatrixMode(GL_MODELVIEW);
		
		//Game Loop
		while (!Display.isCloseRequested()) {
			Display.update();
			Display.sync(60);//60 fps
		}
	}



	public static void main(String []args) {
		new MAin();
	}
}

You are passing only 4 arguments, while it requires 5. Changing that call to


glOrtho(0, 640, 480, 0, 1, -1);

will fix your problem. Looks like you need to have more experience with Java.

What ever tutorial you are using is horrible.

IF you learn to debug, and start reading java docs, you will relise where you failed.

LWJGL javadoc for glOrtho

That didn’t work, It was about the same line of code as I typed and I have some import problems so I’ll just leave LWJGL alone for now.

The function [icode]glOrtho()[/icode] is from [icode]GL11[/icode] class. So add this to the imports section.


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

This will import all the functions that were introduced in OpenGL 1.1.

That’s one of my imports in the code