Jump to content
  • Advertisement
Sign in to follow this  
monstro281

OpenGL OpenGLES

This topic is 3001 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!