Hi,
I'm following the flag rush tutorials on the wiki. I'm trying to render the terrain but i get the following error:
INFO: Child (Terrain) attached to this node (Scene)
java.lang.NoSuchMethodError: org.lwjgl.opengl.GL11.glVertexPointer(IIII)V
at com.jme.renderer.lwjgl.LWJGLRenderer.predrawGeometry(Unknown Source)
at com.jme.renderer.lwjgl.LWJGLRenderer.draw(Unknown Source)
at com.jme.scene.TriMesh.draw(Unknown Source)
at com.jme.scene.lod.ClodMesh.draw(Unknown Source)
at com.jme.scene.Spatial.onDraw(Unknown Source)
at com.jme.scene.Node.draw(Unknown Source)
at com.jme.scene.Spatial.onDraw(Unknown Source)
at com.jme.renderer.lwjgl.LWJGLRenderer.draw(Unknown Source)
at com.lyraonline.client.Client.render(Client.java:51)
at com.jme.app.BaseGame.start(Unknown Source)
at com.lyraonline.client.Client.main(Client.java:37)
15-mrt-2007 16:05:38 com.jme.app.BaseGame start
INFO: Application ending.
Here is the source code:
package com.lyraonline.client;
import com.jme.app.*;
import com.jme.bounding.*;
import com.jme.image.*;
import com.jme.input.*;
import com.jme.math.*;
import com.jme.renderer.*;
import com.jme.scene.*;
import com.jme.scene.shape.*;
import com.jme.scene.state.*;
import com.jme.system.*;
import com.jme.util.*;
import com.jmex.terrain.util.MidPointHeightMap;
import com.jmex.terrain.TerrainBlock;
public class Client extends BaseGame {
SocketClient socketClient;
ClientProtocol worker;
GameClient game;
private int width, height, depth, freq;
private boolean fullscreen;
private Camera cam;
protected Timer timer;
private Node scene;
public static void main(String[] args) {
Client client = new Client();
client.setDialogBehaviour(BaseGame.ALWAYS_SHOW_PROPS_DIALOG);
client.start();
}
protected void update(float interpolation) {
timer.update();
interpolation = timer.getTimePerFrame();
if(KeyBindingManager.getKeyBindingManager().isValidCommand("exit")) {
finished = true;
}
}
protected void render(float interpolation) {
display.getRenderer().clearBuffers();
display.getRenderer().draw(scene); // <--- LINE 51
}
protected void initSystem() {
width = properties.getWidth();
height = properties.getHeight();
depth = properties.getDepth();
freq = properties.getFreq();
fullscreen = properties.getFullscreen();
try {
display = DisplaySystem.getDisplaySystem(properties.getRenderer());
display.createWindow(width, height, depth, freq, fullscreen);
cam = display.getRenderer().createCamera(width, height);
}catch(Exception ex) {
ex.printStackTrace();
System.exit(1);
}
display.getRenderer().setBackgroundColor(ColorRGBA.black);
cam.setFrustumPerspective(45.0f, (float)width / (float)height, 1, 1000);
Vector3f loc = new Vector3f(500.0f, 150.0f, 500.0f);
Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);
Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
Vector3f dir = new Vector3f(0.0f, 0.0f, -1.0f);
cam.setFrame(loc, left, up, dir);
cam.update();
timer = Timer.getTimer(properties.getRenderer());
display.getRenderer().setCamera(cam);
KeyBindingManager.getKeyBindingManager().set("exit", KeyInput.KEY_ESCAPE);
/*
try {
worker = new ClientProtocol();
socketClient = new SocketClient(worker, InetAddress.getByName(
"localhost"),
8000);
worker.setSocketClient(socketClient);
game = new GameClient(worker);
worker.setGameClient(game);
new Thread(worker).start();
new Thread(socketClient).start();
} catch (Exception e) {
e.printStackTrace();
}*/
}
protected void initGame() {
scene = new Node("Scene");
MidPointHeightMap heightMap = new MidPointHeightMap(64, 1f);
Vector3f terrainScale = new Vector3f(20, 0.5f, 20);
TerrainBlock tb = new TerrainBlock("Terrain", heightMap.getSize(),
terrainScale, heightMap.getHeightMap(),
new Vector3f(0, 0, 0), false);
tb.setModelBound(new BoundingBox());
tb.updateModelBound();
scene.attachChild(tb);
scene.updateGeometricState(0.0f, true);
scene.updateRenderState();
}
protected void reinit() {
}
protected void cleanup() {
}
}