I don't like cross forum posting, but I tried over at bullet forums with no reply a couple of days ago. So I'm going to see if anyone here has a response

Hi, i'm having some troubles with the IDebugDraw.
here is the initialization code
1 2 3
| iDebugDraw = new JPCTDebugDraw(world, buffer); iDebugDraw.setDebugMode(DebugDrawModes.DRAW_WIREFRAME); dynamicWorld.setDebugDrawer(iDebugDraw); |
called in the draw loop
1
| dynamicWorld.debugDrawWorld(); |
the implemented IDebugDraw
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| package jpctbullet;
import java.awt.Color; import java.awt.Graphics; import javax.vecmath.Vector3f;
import com.threed.jpct.*;
import com.bulletphysics.linearmath.IDebugDraw; import com.bulletphysics.linearmath.VectorUtil;
public class JPCTDebugDraw extends IDebugDraw{ private int _debugMode; private World _world; private FrameBuffer _buffer; private SimpleVector Vec3fToSVec(Vector3f vector) { return new SimpleVector(vector.x, -vector.y, -vector.z); } public JPCTDebugDraw(World w, FrameBuffer b) { _world = w; _buffer = b; } public void setDebugMode(int debugMode) { _debugMode = debugMode; } public int getDebugMode() { return _debugMode; } public void drawLine(Vector3f from, Vector3f to, Vector3f color) { if(_debugMode > 0) { Camera cam = _world.getCamera(); Graphics g = _buffer.getGraphics(); Color lastColour = g.getColor();
SimpleVector pointA = Interact2D.project3D2D(cam, _buffer, Vec3fToSVec(from)); SimpleVector pointB = Interact2D.project3D2D(cam, _buffer, Vec3fToSVec(to)); g.setColor(new Color(color.x, color.y, color.z)); if(pointA != null && pointB != null){ g.drawLine((int)pointA.x, (int)pointA.y, (int)pointB.x, (int)pointB.y); } g.setColor(lastColour); } } public void draw3dText(Vector3f location, String textString) { Camera cam = _world.getCamera(); Graphics g = _buffer.getGraphics(); SimpleVector loc = Interact2D.project3D2D(cam, _buffer, Vec3fToSVec(location)); g.drawString(textString, (int)loc.x, (int)loc.y); } public void drawContactPoint(Vector3f pointOnB, Vector3f normalOnB, float distance, int lifeTime, Vector3f color) { } public void reportErrorWarning(String warningString) { System.out.println(warningString); }
} |
It's not like the code doesn't do anything. I does. It draws RGB axis lines regardless of what I set it too. I would like to get it to work so I can see the wireframe rigid bodies. The fact that it does draw the RGB axis line means that at least my drawLine() method is working. Any ideas how I messed it up?