Ok, so i've read a ton of posts on using LWJGL directly and they didn't give me much to go on, so here I am on the raggedy edge… (sorry firefly line)
I wanted to port my jogl code over to LWJGL to use in JME. There are some things that I find are easier with openGl since that's where I got my start.
First, I took my code and put it into a class that extends Geometry… that was one thing that I found helpful from all of the posts, but it came about due to trial and error.
I am calling my code from this:
public class DradisGameState extends BasicGameStateNode {
StandardGame game;
public DradisGameState(StandardGame _game) {
super("dradisGameStateNode");
game = _game;
}
public void init() {
rootNode.setRenderQueueMode(Renderer.QUEUE_ORTHO);
rootNode.setCullMode(SceneElement.CULL_NEVER);
GameTaskQueueManager.getManager().getQueue(GameTaskQueue.UPDATE).setExecuteAll(true);
GameTaskQueueManager.getManager().update(new Callable<Object>() {
public Object call() throws Exception {
rootNode.attachChild(new Arc());
return null;
}
});
rootNode.setLightCombineMode(LightState.OFF);
rootNode.updateRenderState();
}
which then calls this:
private class Arc extends Geometry {
public void findCollisions(Spatial spatial, CollisionResults collisionResults) {
}
public boolean hasCollision(Spatial spatial, boolean _active) {
return false;
}
public void draw(Renderer renderer) {
super.draw(renderer);
GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping
GL11.glShadeModel(GL11.GL_SMOOTH); // Enable Smooth Shading
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
GL11.glClearDepth(1.0); // Depth Buffer Setup
GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do
GL11.glMatrixMode(GL11.GL_PROJECTION); // Select The Projection Matrix
GL11.glLoadIdentity(); // Reset The Projection Matrix
// Calculate The Aspect Ratio Of The Window
GLU.gluPerspective(
45.0f,
100 / (float) 100,
0.1f,
100.0f);
GL11.glMatrixMode(GL11.GL_MODELVIEW); // Select The Modelview Matrix
// Really Nice Perspective Calculations
GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
GL11.glLoadIdentity(); // Reset The Current Modelview Matrix
GL11.glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0
GL11.glBegin(GL11.GL_TRIANGLES); // Drawing Using Triangles
GL11.glVertex3f( 0.0f, 1.0f, 0.0f); // Top
GL11.glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
GL11.glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
GL11.glEnd(); // Finished Drawing The Triangle
GL11.glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units
GL11.glBegin(GL11.GL_QUADS); // Draw A Quad
GL11.glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
GL11.glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
GL11.glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
GL11.glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
GL11.glEnd(); // Done Drawing The Quad
}
}
now there are some lines like the GLU, etc that I've been trying out to see if they improve what's going on. So far, I've tried to set a viewport and put the display in that, I've tried the perspective, and a few other things.
These things do work with my jogl implementation and my LWJGL implementation.
When I use them with JME it never just shows my display, it always moves the display somewhere else (with or without the gluPerspective or the viewport)
Is there anything that I haven't thought of that might help me just get my OGL started in JME so that the objects display correctly. This code in the Arc class is not my own, I pulled an LWJGL jar down from nehe's site to see if that helped my cause... it gives me the same results.
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=02 is what it should look like.
what I get is my scene intermeshed with the polygons.
This could be something else I've done with the game state as well, or I may have used the GameTaskManagerQueue incorrectly.
I'll get a screenshot posted here in the next half hour or so.
any help would be appreciated,
thx,
timo