virtual void clientMoveAndDisplay() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); float xOffset = 10.f; float yStart = 20.f; float yIncr = 20.f; char buf[124]; glColor3f(0, 0, 0); setOrthographicProjection(); glRasterPos3f(xOffset,yStart,0); sprintf(buf,"gNumAlignedAllocs= %d",gNumAlignedAllocs); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"gNumAlignedFree= %d",gNumAlignedFree); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"# alloc-free = %d",gNumAlignedAllocs-gNumAlignedFree); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; #ifdef BT_DEBUG_MEMORY_ALLOCATIONS glRasterPos3f(xOffset,yStart,0); sprintf(buf,"gTotalBytesAlignedAllocs = %d",gTotalBytesAlignedAllocs); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; #endif //BT_DEBUG_MEMORY_ALLOCATIONS glFlush(); glutSwapBuffers(); }
static void doPrint ( int x, int& y, int dy, const char * text ) { glRasterPos3f(x, y, 0); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10), text); y += dy; }
void initialize() { glClearColor(0.2f,0.3f,0.4f,1.0f); DemoShaders * cg = new DemoShaders(); cgshaders = static_cast<CgShaders*>(cg); int shader_profile = cgshaders->initialize(); fsquad = new unsigned int[1]; generate_screen_quad(fsquad); vboids.push_back(fsquad[0]); scene_fbo = new RenderTexture(win_w, win_h, GL_TEXTURE_RECTANGLE); scene_fbo->InitColor_Tex(); scene_fbo->InitDepth_Tex(); fbos.push_back(scene_fbo); if (fbo_samples > static_cast<int>(max_fbo_samples)) fbo_samples = static_cast<int>(max_fbo_samples); ms_fbo = new RenderTexture(win_w, win_h, GL_TEXTURE_RECTANGLE, fbo_samples, 0); ms_fbo->InitColor_RB(); ms_fbo->InitDepth_RB(); fbos.push_back(ms_fbo); glBindFramebuffer(GL_FRAMEBUFFER, GL_NONE); camera = new Camera(); camera->init_scale_and_bias_matrix(); camera->m_heading = 0.0f; camera->m_pitch = 0.0f; camera->set_position(0.0f,10.0f,0.0f); bmf_font = BMF_GetFont(BMF_kScreen15); bmf_texture = BMF_GetFontTexture(bmf_font); GLuint * bmf_vboid = BMF_GetVBO(bmf_font); textures.push_back(bmf_texture); if (bmf_vboid) { vboids.push_back(bmf_vboid[0]); vboids.push_back(bmf_vboid[1]); } }
LoggerWindow *loggerwindow_new(MultiTestApp *app) { GHOST_SystemHandle sys= multitestapp_get_system(app); GHOST_TUns32 screensize[2]; GHOST_WindowHandle win; GHOST_GetMainDisplayDimensions(sys, &screensize[0], &screensize[1]); win= GHOST_CreateWindow(sys, "MultiTest:Logger", 40, screensize[1]-432, 800, 300, GHOST_kWindowStateNormal, GHOST_kDrawingContextTypeOpenGL, FALSE, FALSE); if (win) { LoggerWindow *lw= MEM_callocN(sizeof(*lw), "loggerwindow_new"); int bbox[2][2]; lw->app= app; lw->win= win; #ifdef USE_BMF lw->font= BMF_GetFont(BMF_kScreen12); lw->fonttexid= BMF_GetFontTexture(lw->font); BMF_GetBoundingBox(lw->font, &bbox[0][0], &bbox[0][1], &bbox[1][0], &bbox[1][1]); lw->fontheight= rect_height(bbox); #else lw->font= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size); BLF_size(lw->font, 11, 72); lw->fontheight= BLF_height(lw->font, "A_"); #endif lw->nloglines= lw->logsize= 0; lw->loglines= MEM_mallocN(sizeof(*lw->loglines)*lw->nloglines, "loglines"); lw->scroll= scrollbar_new(2, 40); GHOST_SetWindowUserData(lw->win, windowdata_new(lw, loggerwindow_handle)); loggerwindow_do_reshape(lw); return lw; } else { return NULL; } }
void GLDebugDrawer::DrawContactPoint(const SimdVector3& pointOnB,const SimdVector3& normalOnB,float distance,int lifeTime,const SimdVector3& color) { if (m_debugMode & IDebugDraw::DBG_DrawContactPoints) { SimdVector3 to=pointOnB+normalOnB*distance; const SimdVector3&from = pointOnB; glBegin(GL_LINES); glColor3f(color.getX(), color.getY(), color.getZ()); glVertex3d(from.getX(), from.getY(), from.getZ()); glVertex3d(to.getX(), to.getY(), to.getZ()); glEnd(); glRasterPos3f(from.x(), from.y(), from.z()); char buf[12]; sprintf(buf," %d",lifeTime); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); } }
void DemoApplication::renderme() { myinit(); updateCamera(); if (m_dynamicsWorld) { if(m_enableshadows) { glClear(GL_STENCIL_BUFFER_BIT); glEnable(GL_CULL_FACE); renderscene(0); glDisable(GL_LIGHTING); glDepthMask(GL_FALSE); glDepthFunc(GL_LEQUAL); glEnable(GL_STENCIL_TEST); glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE); glStencilFunc(GL_ALWAYS,1,0xFFFFFFFFL); glFrontFace(GL_CCW); glStencilOp(GL_KEEP,GL_KEEP,GL_INCR); renderscene(1); glFrontFace(GL_CW); glStencilOp(GL_KEEP,GL_KEEP,GL_DECR); renderscene(1); glFrontFace(GL_CCW); glPolygonMode(GL_FRONT,GL_FILL); glPolygonMode(GL_BACK,GL_FILL); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glEnable(GL_LIGHTING); glDepthMask(GL_TRUE); glCullFace(GL_BACK); glFrontFace(GL_CCW); glEnable(GL_CULL_FACE); glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); glDepthFunc(GL_LEQUAL); glStencilFunc( GL_NOTEQUAL, 0, 0xFFFFFFFFL ); glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP ); glDisable(GL_LIGHTING); renderscene(2); glEnable(GL_LIGHTING); glDepthFunc(GL_LESS); glDisable(GL_STENCIL_TEST); glDisable(GL_CULL_FACE); } else { glDisable(GL_CULL_FACE); renderscene(0); } int xOffset = 10; int yStart = 20; int yIncr = 20; glDisable(GL_LIGHTING); glColor3f(0, 0, 0); if ((m_debugMode & btIDebugDraw::DBG_NoHelpText)==0) { setOrthographicProjection(); showProfileInfo(xOffset,yStart,yIncr); #ifdef USE_QUICKPROF if ( getDebugMode() & btIDebugDraw::DBG_ProfileTimings) { static int counter = 0; counter++; std::map<std::string, hidden::ProfileBlock*>::iterator iter; for (iter = btProfiler::mProfileBlocks.begin(); iter != btProfiler::mProfileBlocks.end(); ++iter) { char blockTime[128]; sprintf(blockTime, "%s: %lf",&((*iter).first[0]),btProfiler::getBlockTime((*iter).first, btProfiler::BLOCK_CYCLE_SECONDS));//BLOCK_TOTAL_PERCENT)); glRasterPos3f(xOffset,yStart,0); GLDebugDrawString(BMF_GetFont(BMF_kHelvetica10),blockTime); yStart += yIncr; } } #endif //USE_QUICKPROF resetPerspectiveProjection(); } glEnable(GL_LIGHTING); } updateCamera(); }
void ParticleRenderer::displayProfileString(int xOffset,int yStart,char* message) { glRasterPos3f(xOffset,yStart,0); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),message); }
//to be implemented by the demo void renderme() { debugDrawer.SetDebugMode(getDebugMode()); //render the hinge axis if (createConstraint) { SimdVector3 color(1,0,0); SimdVector3 dirLocal(0,1,0); SimdVector3 pivotInA(CUBE_HALF_EXTENTS,-CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS); SimdVector3 pivotInB(-CUBE_HALF_EXTENTS,-CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS); SimdVector3 from = physObjects[1]->GetRigidBody()->getCenterOfMassTransform()(pivotInA); SimdVector3 fromB = physObjects[2]->GetRigidBody()->getCenterOfMassTransform()(pivotInB); SimdVector3 dirWorldA = physObjects[1]->GetRigidBody()->getCenterOfMassTransform().getBasis() * dirLocal ; SimdVector3 dirWorldB = physObjects[2]->GetRigidBody()->getCenterOfMassTransform().getBasis() * dirLocal ; debugDrawer.DrawLine(from,from+dirWorldA,color); debugDrawer.DrawLine(fromB,fromB+dirWorldB,color); } float m[16]; int i; if (getDebugMode() & IDebugDraw::DBG_DisableBulletLCP) { //don't use Bullet, use quickstep physicsEnvironmentPtr->setSolverType(0); } else { //Bullet LCP solver physicsEnvironmentPtr->setSolverType(1); } if (getDebugMode() & IDebugDraw::DBG_EnableCCD) { physicsEnvironmentPtr->setCcdMode(3); } else { physicsEnvironmentPtr->setCcdMode(0); } bool isSatEnabled = (getDebugMode() & IDebugDraw::DBG_EnableSatComparison); physicsEnvironmentPtr->EnableSatCollisionDetection(isSatEnabled); #ifdef USE_HULL //some testing code for SAT if (isSatEnabled) { for (int s=0;s<numShapes;s++) { CollisionShape* shape = shapePtr[s]; if (shape->IsPolyhedral()) { PolyhedralConvexShape* polyhedron = static_cast<PolyhedralConvexShape*>(shape); if (!polyhedron->m_optionalHull) { //first convert vertices in 'Point3' format int numPoints = polyhedron->GetNumVertices(); Point3* points = new Point3[numPoints+1]; //first 4 points should not be co-planar, so add central point to satisfy MakeHull points[0] = Point3(0.f,0.f,0.f); SimdVector3 vertex; for (int p=0;p<numPoints;p++) { polyhedron->GetVertex(p,vertex); points[p+1] = Point3(vertex.getX(),vertex.getY(),vertex.getZ()); } Hull* hull = Hull::MakeHull(numPoints+1,points); polyhedron->m_optionalHull = hull; } } } } #endif //USE_HULL for (i=0;i<numObjects;i++) { SimdTransform transA; transA.setIdentity(); float pos[3]; float rot[4]; ms[i].getWorldPosition(pos[0],pos[1],pos[2]); ms[i].getWorldOrientation(rot[0],rot[1],rot[2],rot[3]); SimdQuaternion q(rot[0],rot[1],rot[2],rot[3]); transA.setRotation(q); SimdPoint3 dpos; dpos.setValue(pos[0],pos[1],pos[2]); transA.setOrigin( dpos ); transA.getOpenGLMatrix( m ); SimdVector3 wireColor(1.f,1.0f,0.5f); //wants deactivation if (i & 1) { wireColor = SimdVector3(0.f,0.0f,1.f); } ///color differently for active, sleeping, wantsdeactivation states if (physObjects[i]->GetRigidBody()->GetActivationState() == 1) //active { if (i & 1) { wireColor += SimdVector3 (1.f,0.f,0.f); } else { wireColor += SimdVector3 (.5f,0.f,0.f); } } if (physObjects[i]->GetRigidBody()->GetActivationState() == 2) //ISLAND_SLEEPING { if (i & 1) { wireColor += SimdVector3 (0.f,1.f, 0.f); } else { wireColor += SimdVector3 (0.f,0.5f,0.f); } } char extraDebug[125]; sprintf(extraDebug,"islId, Body=%i , %i",physObjects[i]->GetRigidBody()->m_islandTag1,physObjects[i]->GetRigidBody()->m_debugBodyId); physObjects[i]->GetRigidBody()->GetCollisionShape()->SetExtraDebugInfo(extraDebug); GL_ShapeDrawer::DrawOpenGL(m,physObjects[i]->GetRigidBody()->GetCollisionShape(),wireColor,getDebugMode()); ///this block is just experimental code to show some internal issues with replacing shapes on the fly. if (getDebugMode()!=0 && (i>0)) { if (physObjects[i]->GetRigidBody()->GetCollisionShape()->GetShapeType() == EMPTY_SHAPE_PROXYTYPE) { physObjects[i]->GetRigidBody()->SetCollisionShape(shapePtr[1]); //remove the persistent collision pairs that were created based on the previous shape BroadphaseProxy* bpproxy = physObjects[i]->GetRigidBody()->m_broadphaseHandle; physicsEnvironmentPtr->GetBroadphase()->CleanProxyFromPairs(bpproxy); SimdVector3 newinertia; SimdScalar newmass = 10.f; physObjects[i]->GetRigidBody()->GetCollisionShape()->CalculateLocalInertia(newmass,newinertia); physObjects[i]->GetRigidBody()->setMassProps(newmass,newinertia); physObjects[i]->GetRigidBody()->updateInertiaTensor(); } } } if (!(getDebugMode() & IDebugDraw::DBG_NoHelpText)) { float xOffset = 10.f; float yStart = 20.f; float yIncr = -2.f; char buf[124]; glColor3f(0, 0, 0); #ifdef USE_QUICKPROF if ( getDebugMode() & IDebugDraw::DBG_ProfileTimings) { static int counter = 0; counter++; std::map<std::string, hidden::ProfileBlock*>::iterator iter; for (iter = Profiler::mProfileBlocks.begin(); iter != Profiler::mProfileBlocks.end(); ++iter) { char blockTime[128]; sprintf(blockTime, "%s: %lf",&((*iter).first[0]),Profiler::getBlockTime((*iter).first, Profiler::BLOCK_CYCLE_SECONDS));//BLOCK_TOTAL_PERCENT)); glRasterPos3f(xOffset,yStart,0); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),blockTime); yStart += yIncr; } } #endif //USE_QUICKPROF //profiling << Profiler::createStatsString(Profiler::BLOCK_TOTAL_PERCENT); //<< std::endl; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"mouse to interact"); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"space to reset"); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"cursor keys and z,x to navigate"); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"i to toggle simulation, s single step"); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"q to quit"); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"d to toggle deactivation"); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"a to draw temporal AABBs"); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"h to toggle help text"); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; bool useBulletLCP = !(getDebugMode() & IDebugDraw::DBG_DisableBulletLCP); bool useCCD = (getDebugMode() & IDebugDraw::DBG_EnableCCD); glRasterPos3f(xOffset,yStart,0); sprintf(buf,"m Bullet GJK = %i",!isSatEnabled); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"n Bullet LCP = %i",useBulletLCP); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"1 CCD mode (adhoc) = %i",useCCD); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"+- shooting speed = %10.2f",bulletSpeed); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; } }
static void RenderCallback() { // Clear buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Setup camera glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0f, ((float)glutGet(GLUT_WINDOW_WIDTH))/((float)glutGet(GLUT_WINDOW_HEIGHT)), 1.0f, 10000.0f); gluLookAt(Eye.x(), Eye.y(), Eye.z(), Eye.x() + Dir.x(), Eye.y() + Dir.y(), Eye.z() + Dir.z(), 0.0f, 1.0f, 0.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glEnable(GL_LIGHTING); //clear previous frames result gNormal.setValue(10,0,0); gPoint.setValue(0,0,0); gDepth = 999.999; gLastUsedMethod = -1; gNumGjkIterations = -1; TestEPA(gConvex0, gConvex1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); btVector3 RefSep(btScalar(0.), btScalar(0.), btScalar(0.)); float RefDMin=0.f; bool RefResult = false; if(gRefMode) RefResult = ReferenceCode(gConvex0, gConvex1, RefDMin, RefSep); // DrawLine(gPoint, gPoint + gNormal*20.0f, btVector3(1,0,0), 2.0f); // printf("%f: %f %f %f\n", gDepth, gNormal.x(), gNormal.y(), gNormal.z()); #ifdef VERBOSE_TEXT_ONSCREEN glColor3f(255.f, 255.f, 255.f); setOrthographicProjection(); float xOffset = 10.f; float yStart = 20.f; float yIncr = 20.f; char buf[124]; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"gDepth=%f: gNormal=(%f %f %f)\n", gDepth, gNormal.x(), gNormal.y(), gNormal.z()); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"num GJK iterations =%d\n", gNumGjkIterations); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"gLastUsedMethod=%d\n", gLastUsedMethod); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; if (gLastUsedMethod >= 3) { switch ( gMethod) { case 0: sprintf(buf,"Bullet GjkEpa Penetration depth solver (zlib free\n" ); break; case 1: sprintf(buf,"Bullet Minkowski sampling Penetration depth solver\n" ); break; case 2: sprintf(buf,"Solid35 EPA Penetration depth solver\n" ); break; case 3: sprintf(buf,"EPA Penetration depth solver (Experimental/WorkInProgress, zlib free\n" ); break; default: sprintf(buf,"Unknown Penetration Depth\n" ); } glRasterPos3f(xOffset,yStart,0); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; } else { glRasterPos3f(xOffset,yStart,0); sprintf(buf,"Hybrid GJK method %d\n", gLastUsedMethod); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; } if (gLastDegenerateSimplex) { glRasterPos3f(xOffset,yStart,0); sprintf(buf,"DegenerateSimplex %d\n", gLastDegenerateSimplex); BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; } resetPerspectiveProjection(); #endif //VERBOSE_TEXT_ONSCREEN btVector3 color(0,0,0); gConvex0.Render(false, color); gConvex1.Render(false, color); if(gDepth<0.0f) { btTransform Saved = gConvex0.mTransform; gConvex0.mTransform.setOrigin(gConvex0.mTransform.getOrigin() - btVector3(gNormal*gDepth)); gConvex0.Render(true, btVector3(1.0f, 0.5f, 0.0f)); gConvex0.mTransform = Saved; } else { DrawLine(gPoint, gPoint + gNormal, btVector3(0,1,0), 2.0f); } if(RefResult & gRefMode) { btTransform Saved = gConvex0.mTransform; gConvex0.mTransform.setOrigin(gConvex0.mTransform.getOrigin() + btVector3(RefSep*RefDMin)); gConvex0.Render(true, btVector3(0.0f, 0.5f, 1.0f)); gConvex0.mTransform = Saved; } glutSwapBuffers(); }
void bulletBaseApp::renderme() { myinit(); updateCamera(); if (m_dynamicsWorld) { if(m_enableshadows) { glClear(GL_STENCIL_BUFFER_BIT); glEnable(GL_CULL_FACE); renderscene(0); glDisable(GL_LIGHTING); glDepthMask(GL_FALSE); glDepthFunc(GL_LEQUAL); glEnable(GL_STENCIL_TEST); glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE); glStencilFunc(GL_ALWAYS,1,0xFFFFFFFFL); glFrontFace(GL_CCW); glStencilOp(GL_KEEP,GL_KEEP,GL_INCR); renderscene(1); glFrontFace(GL_CW); glStencilOp(GL_KEEP,GL_KEEP,GL_DECR); renderscene(1); glFrontFace(GL_CCW); glPolygonMode(GL_FRONT,GL_FILL); glPolygonMode(GL_BACK,GL_FILL); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); glEnable(GL_LIGHTING); glDepthMask(GL_TRUE); glCullFace(GL_BACK); glFrontFace(GL_CCW); glEnable(GL_CULL_FACE); glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); glDepthFunc(GL_LEQUAL); glStencilFunc( GL_NOTEQUAL, 0, 0xFFFFFFFFL ); glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP ); glDisable(GL_LIGHTING); renderscene(2); glEnable(GL_LIGHTING); glDepthFunc(GL_LESS); glDisable(GL_STENCIL_TEST); glDisable(GL_CULL_FACE); } else { glDisable(GL_CULL_FACE); renderscene(0); } int xOffset = 10; int yStart = 20; int yIncr = 20; char buf[124]; glDisable(GL_LIGHTING); glColor3f(0, 0, 0); if ((m_debugMode & btIDebugDraw::DBG_NoHelpText)==0) { setOrthographicProjection(); showProfileInfo(xOffset,yStart,yIncr); #ifdef USE_QUICKPROF if ( getDebugMode() & btIDebugDraw::DBG_ProfileTimings) { static int counter = 0; counter++; std::map<std::string, hidden::ProfileBlock*>::iterator iter; for (iter = btProfiler::mProfileBlocks.begin(); iter != btProfiler::mProfileBlocks.end(); ++iter) { char blockTime[128]; sprintf(blockTime, "%s: %lf",&((*iter).first[0]),btProfiler::getBlockTime((*iter).first, btProfiler::BLOCK_CYCLE_SECONDS));//BLOCK_TOTAL_PERCENT)); glRasterPos3f(xOffset,yStart,0); GLDebugDrawString(BMF_GetFont(BMF_kHelvetica10),blockTime); yStart += yIncr; } } #endif //USE_QUICKPROF sprintf(buf,"mouse to interact"); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"ALT + mouse to move camera"); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"space to reset"); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"cursor keys and z,x to navigate"); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"i to toggle simulation, s single step"); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"q to quit"); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,". to shoot box"); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; // not yet hooked up again after refactoring... sprintf(buf,"d to toggle deactivation"); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"g to toggle mesh animation (ConcaveDemo)"); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"h to toggle help text"); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"o to toggle orthogonal/perspective view"); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; //bool useBulletLCP = !(getDebugMode() & btIDebugDraw::DBG_DisableBulletLCP); //bool useCCD = (getDebugMode() & btIDebugDraw::DBG_EnableCCD); //glRasterPos3f(xOffset,yStart,0); //sprintf(buf,"1 CCD mode (adhoc) = %i",useCCD); //GLDebugDrawString(BMF_GetFont(BMF_kHelvetica10),buf); //yStart += yIncr; sprintf(buf,"+- shooting speed = %10.2f",m_ShootBoxInitialSpeed); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; #ifdef SHOW_NUM_DEEP_PENETRATIONS sprintf(buf,"gNumDeepPenetrationChecks = %d",gNumDeepPenetrationChecks); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"gNumGjkChecks= %d",gNumGjkChecks); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"gNumClampedCcdMotions = %d",gNumClampedCcdMotions); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"gNumSplitImpulseRecoveries= %d",gNumSplitImpulseRecoveries); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"gNumAlignedAllocs = %d",gNumAlignedAllocs); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"gNumAlignedFree= %d",gNumAlignedFree); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"# alloc-free = %d",gNumAlignedAllocs-gNumAlignedFree); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; //enable BT_DEBUG_MEMORY_ALLOCATIONS define in Bullet/src/LinearMath/btAlignedAllocator.h for memory leak detection #ifdef BT_DEBUG_MEMORY_ALLOCATIONS glRasterPos3f(xOffset,yStart,0); sprintf(buf,"gTotalBytesAlignedAllocs = %d",gTotalBytesAlignedAllocs); GLDebugDrawString(BMF_GetFont(BMF_kHelvetica10),buf); yStart += yIncr; #endif //BT_DEBUG_MEMORY_ALLOCATIONS if (getDynamicsWorld()) { glRasterPos3f(xOffset,yStart,0); sprintf(buf,"# objects = %d",getDynamicsWorld()->getNumCollisionObjects()); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; glRasterPos3f(xOffset,yStart,0); sprintf(buf,"# pairs = %d",getDynamicsWorld()->getBroadphase()->getOverlappingPairCache()->getNumOverlappingPairs()); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; sprintf(buf,"# hitPos = %f,%f,%f",gHitPos.getX(),gHitPos.getY(),gHitPos.getZ()); GLDebugDrawString(xOffset,yStart,buf); yStart += yIncr; } #endif //SHOW_NUM_DEEP_PENETRATIONS resetPerspectiveProjection(); } glEnable(GL_LIGHTING); } updateCamera(); }