我一直在用子彈擺弄一下,現在我想繪製調試。 我有一個工作子彈物理和一切的opengl世界。帶OpenGL的子彈調試抽屜
我曾嘗試是這樣的: 我創建了一個類GLDebugDrawer這樣的:
#include "LinearMath/btIDebugDraw.h"
class GLDebugDrawer : public btIDebugDraw
{
int m_debugMode;
public:
GLDebugDrawer();
virtual ~GLDebugDrawer();
virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& fromColor, const btVector3& toColor);
virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& color);
virtual void drawSphere(const btVector3& p, btScalar radius, const btVector3& color);
virtual void drawTriangle(const btVector3& a, const btVector3& b, const btVector3& c, const btVector3& color, btScalar alpha);
virtual void drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime, const btVector3& color);
virtual void reportErrorWarning(const char* warningString);
virtual void draw3dText(const btVector3& location, const char* textString);
virtual void setDebugMode(int debugMode);
virtual int getDebugMode() const { return m_debugMode; }
};
然後在比賽中我有這個頭,並創建它的一個實例。
我在哪裏初始化BT的世界裏,我設置調試抽獎類型是這樣的:
debugDraw->DBG_DrawWireframe; // this breaks when I run the app
debugDraw->setDebugMode(btIDebugDraw::DBG_DrawWireframe); // so does this
debugDraw->setDebugMode(1); // this doesn't
我則調試設置子彈的世界是這樣的:
bt_dynamicsWorld->setDebugDrawer(debugDraw);
最後,我使調試戰平後,我渲染子彈機構是這樣的:
bt_dynamicsWorld->debugDrawWorld();
必須有東西我錯過了,因爲我沒有得到任何線框或任何運行時。
我知道這是一條舊消息,但是當我搜索到它時,它彈出到頂部。是否碰巧在你的GLDebugDrawer類中實現了這些方法中的任何一個? – Jamie