2013-11-14 5 views
1

글 머리 기호로 약간 돌아 다니며 디버그를 그려보고 싶습니다. 나는 총알 물리학 및 모든 것을 다루는 OpenGL 세계를 가지고 있습니다. 나는이 같은 클래스 GLDebugDrawer을 만든 :OpenGL을 사용한 글 머리 기호 디버그 서랍

은 내가 시도하는 것은 이것이다

#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); 

그리고 마지막으로, I 다음과 같이 글 머리 기호 본문을 렌더링 한 후에 디버그 드로우를 렌더링합니다.

bt_dynamicsWorld->debugDrawWorld(); 

나는 달리기를 할 때 와이어 프레임이나 아무것도 얻지 못해서 실종되었다.

+0

나는 이것이 오래된 메시지라는 것을 알았지 만, 검색 할 때 맨 위로 튀어 나왔다. 실제로 GLDebugDrawer 클래스에서 그러한 메소드 중 하나를 구현 한 적이 있습니까? – Jamie

답변

1

당신 같은 당신이 당신의 프레임 워크를이 방법을 모르는 bt_dynamicsWorld->setDebugDrawer(&debugDraw); (하지만 확실하지에 bt_dynamicsWorld->setDebugDrawer(debugDraw);을 변경해야 할 수도 있습니다처럼 코드를 수정하는 데 사용하는 비교적 간단합니다 http://sio2interactive.forumotion.net/t599-enabling-bullet-debug-draw-code-included에서 사용 가능한 코드의 간단한 세트, 외모가

+1

안녕하세요. 답장을 보내 주셔서 감사합니다. "get get this :' 'GLDebugDrawer **'에서 'btIDebugDraw *'로 인수 1을 변환 할 수 없습니다. '. – b0Gd4N

관련 문제