Hi,
I'm having problems getting a peice of code to run,
I'm using the textpad and the latest version of JDK,
I downloaded LWJGL and entered the .jar(s) into the classpath, the demo works fine,
I compiled the following code (taked from the Wiki and Hacked together in a newbie way) but it doesn't run - I'm getting "NoSuchMethodL main" exception at runtime at startup.
import org.lwjgl.opengl.*;
import org.lwjgl.*;
//import org.lwjql.util.*;
public class TestDisplay
{
public TestDisplay() {
}
public void main(String[] args) {
// in this case we only care about the dimensions of the screen, we're aiming
// for an 800x600 display.
int targetWidth = 800;
int targetHeight = 600;
DisplayMode chosenMode = null;
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
for (int i=0;i<modes.length;i++) {
if ((modes[i].getWidth() == targetWidth) && (modes[i].getHeight() == targetHeight)) {
chosenMode = modes[i];
break;
}
}
} catch (LWJGLException e) {
Sys.alert("Error", "Unable to determine display modes.");
System.exit(0);
}
// at this point if we have no mode there was no appropriate, let the user know
// and give up
if (chosenMode == null) {
Sys.alert("Error", "Unable to find appropriate display mode.");
System.exit(0);
}
boolean gameRunning = true;
float pos = 0;
while (gameRunning) {
// perform game logic updates here
pos += 0.01f;
// render using OpenGL
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex3f(0,0,pos);
GL11.glVertex3f(1,0,pos);
GL11.glVertex3f(1,1,pos);
GL11.glVertex3f(0,1,pos);
GL11.glEnd();
// now tell the screen to update
Display.update();
// finally check if the user has requested that the display be
// shutdown
if (Display.isCloseRequested()) {
gameRunning = false;
Display.destroy();
System.exit(0);
}
}
}
}
could anyone point out what i'm doing wrong?
i have search the boards and cannot find out if im using the correct packages or how to solve my problems, a basic peice of source code would help a lot.
thanks
public void main(String[] args) {
should be
public static void main(String[] args) {
clearly not enough sleep hehe
thank you very much :)