I just added in the TerrainMarker class into my code. I paint the terrain marker like this:
if(spellWaiting)
{
System.out.println("checkpoint1");
if(spellRing == null)
{
System.out.println("checkpoint2");
spellRing = new TerrainMarker("spellring", 30, 10, 2, ColorRGBA.green);
rootNode.attachChild(spellRing);
}
System.out.println("checkpoint3");
Vector2f screenPos = new Vector2f(MouseInput.get().getXAbsolute(), MouseInput.get().getYAbsolute());
System.out.println("checkpoint4");
Ray ray = new Ray();
DisplaySystem.getDisplaySystem().getPickRay(screenPos, false, ray);
System.out.println("checkpoint5");
results.clear();
rootNode.findPick(ray, results);
System.out.println("checkpoint6");
Vector3f loc = new Vector3f();
Vector3f[] vertex = new Vector3f[3];
boolean foundMeshHit = false;
System.out.println("checkpoint7");
for(int pickIndex = 0; pickIndex < results.getNumber(); pickIndex++)
{System.out.println("checkpoint8");
if(results.getPickData(pickIndex).getTargetMesh() instanceof TerrainBlock)
{
System.out.println("checkpoint9");
ArrayList<Integer> a = results.getPickData(pickIndex).getTargetTris();
TriMesh mesh = (TriMesh)results.getPickData(pickIndex).getTargetMesh();
System.out.println("checkpoint10");
for (Integer i : a)
{
System.out.println("checkpoint11");
mesh.getTriangle(i, vertex);
System.out.println("checkpoint12");
foundMeshHit = (ray.intersectWhere(vertex[0].addLocal(mesh.getWorldTranslation()),
vertex[1].addLocal(mesh.getWorldTranslation()),
vertex[2].addLocal(mesh.getWorldTranslation()), loc));System.out.println("checkpoint13");
if(foundMeshHit)
{
System.out.println("checkpoint14");
spellRing.update(loc, blockRef);
System.out.println("checkpoint15");
}
}
}
}
}
else
{
if(spellRing != null)
{
System.out.println("checkpoint16");
spellRing.removeFromParent();
System.out.println("checkpoint17");
spellRing = null;
System.out.println("checkpoint18");
}
}
}
Ignore the checkpoints, those were to see if I could track this error down. Anyway, my HUD (part of my GUI's gamestate) sets the variable "spellWaiting" to true in my in-game gamestate, and it's supposed to project a circle wherever the mouse goes (to let you pick the location of the spell).
I get the error during a SwapBuffer attempt which is coming from BaseGame. It's this line of code:
display.getRenderer().displayBackBuffer();
So, after I tell the InGameState to project the circle, it completes a full update and render, but then breaks down right after the render (the above code is the last line in the cycle, right after rendering).
I click again to see the "displayBackBuffer" method and am presented with LWJGLRenderer.java which, according to NetBeans, has a TON of errors in it. That doesn't make any sense, because JME still compiles and runs!
Very confused about what could cause this error and how to fix it. Thanks!