Sign in to follow this  
monstro281

OpenGL OpenGLES

Recommended Posts

I am trying to build a debugdraw class for bullet specifically targeting the android OS. class GLDebugDrawer : public btIDebugDraw { int m_debugMode; public: 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 drawBox (const btVector3& boxMin, const btVector3& boxMax, const btVector3& color, btScalar alpha); 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;} }; The first function I have implemented is the drawLine function. I just want to know if this looks correct. void GLDebugDrawer::drawLine(const btVector3& from,const btVector3& to,const btVector3& fromColor, const btVector3& toColor) { GLfloat vertices[3][3]={0}; glColor4f(fromColor.getX(), fromColor.getY(), fromColor.getZ(),1.0); vertices[0][0] = from.getX(); vertices[0][1] = from.getY(); vertices[0][2] = from.getZ(); vertices[1][0] = to.getX(); vertices[1][1] = to.getY(); vertices[1][2] = to.getZ(); glColor4f(toColor.getX(), toColor.getY(), toColor.getZ(),1.0); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, vertices); glDrawArrays(GL_LINES, 0, 2); glDisableClientState(GL_VERTEX_ARRAY); glFinish(); } My goal is to completely implement all member functions of this class...so I will be back, I am sure.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this