void Handlers::profile2() { Serial.println(F("Profile 2 Handler")); Profiles* showProfile = Memory::getProfileContainerStart()->getNextProfile(); showProfileInfo(showProfile); }
void WorldEditor::render( int skip ) { viewportScreen.Render( camView.Object() , TRUE , TRUE ); float fps = updateFPS(); TMessageShow msgShow( m_world ); msgShow.start(); msgShow.push( "Fps: %6.2f", fps ); { Vec3D pos = camControl.getPosition(); Vec3D dir = camControl.getViewDir(); msgShow.push( "Cam pos = ( %.1f %.1f %.1f ) viewDir = ( %.2f %.2f %.2f )" , pos.x() , pos.y() , pos.z() , dir.x() , dir.y() , dir.z() ); } g_devLog.show( msgShow ); //if ( EditData* data = m_objEdit.getSelectEditData()) //{ // if ( TActor* actor = TActor::upCast( data->entity ) ) // { // Vec3D pos = actor->getPosition(); // msgShow.push( "Hit pos = ( %.1f %.1f %.1f ) " , // pos.x() , pos.y() ,pos.z() ); // actor->getFlyActor().GetWorldPosition( pos ); // msgShow.push( "Hit pos = ( %.1f %.1f %.1f ) " , // pos.x() , pos.y() ,pos.z() ); // } //} if ( m_player ) { Vec3D dir = m_player->getFaceDir(); msgShow.push( "viewDir = ( %.2f %.2f %.2f )" , dir.x() , dir.y() , dir.z() ); m_player->getFlyActor().GetDirection( dir , NULL ); msgShow.push( "viewDir = ( %.2f %.2f %.2f )" , dir.x() , dir.y() , dir.z() ); FnObject obj; obj.Object( m_player->getFlyActor().GetBaseObject() ); msgShow.push( "viewDir = ( %.2f %.2f %.2f )" , dir.x() , dir.y() , dir.z() ); } if ( m_Mode == MODE_RUN ) { TProfileIterator* profIter = TProfileManager::createIterator(); profIter->getCurNode()->showAllChild( true ); showProfileInfo( profIter , msgShow , NULL ); TProfileManager::releaseIterator( profIter ); } msgShow.finish(); m_world.SwapBuffers(); }
void BasicDemo::renderme() { renderscene(0); if(gbDrawBatches) { ((btGpuDemoDynamicsWorld*)m_dynamicsWorld)->debugDrawConstraints(gSelectedBatch, cBatchColorTab); } // if (0) if ((m_debugMode & btIDebugDraw::DBG_NoHelpText)==0) { setOrthographicProjection(); int xOffset = 10.f; int yStart = 20.f; int yIncr = 20.f; showProfileInfo(xOffset, yStart, yIncr); DrawConstraintInfo(); outputDebugInfo(xOffset, yStart, yIncr); resetPerspectiveProjection(); } }
void BasicDemo3D::renderme() { updateCamera(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if(gDrawWire) { glColor3f(1.f, 1.f, 1.f); glDisable(GL_LIGHTING); setTexturing(false); } else { myinit(); setTexturing(true); } renderscene(0); if(gbDrawBatches) { ((btCudaDemoDynamicsWorld3D*)m_dynamicsWorld)->debugDrawConstraints(gSelectedBatch, cBatchColorTab); } glColor3f(0, 0, 0); if ((m_debugMode & btIDebugDraw::DBG_NoHelpText)==0) { setOrthographicProjection(); int xOffset = 10.f; int yStart = 20.f; int yIncr = 20.f; showProfileInfo(xOffset, yStart, yIncr); DrawConstraintInfo(); outputDebugInfo(xOffset, yStart, yIncr); resetPerspectiveProjection(); } }
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 ParticlesDemo::renderme() { glColor3f(1.0, 1.0, 1.0); glutWireCube(2*WORLD_SIZE); glPointSize(5.0f); glEnable(GL_POINT_SPRITE_ARB); glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE); #ifndef __APPLE__ // glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_NV); glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); #endif //__APPLE__ glDepthMask(GL_TRUE); glEnable(GL_DEPTH_TEST); glUseProgram(m_shaderProgram); btScalar dist = (m_glutScreenWidth > m_glutScreenHeight) ? m_glutScreenHeight : m_glutScreenWidth; glUniform1f( glGetUniformLocation(m_shaderProgram, "pointScale"), dist ); // glUniform1f( glGetUniformLocation(m_shaderProgram, "pointRadius"), 0.5f ); int numParticles = m_pWorld->getNumParticles(); int col_vbo = m_pWorld->m_colVbo; int curr_vbo = m_pWorld->m_vbo; float sphere_rad = m_pWorld->m_particleRad; glUniform1f( glGetUniformLocation(m_shaderProgram, "pointRadius"), sphere_rad ); glColor3f(1, 1, 1); // render from the vbo glBindBuffer(GL_ARRAY_BUFFER, curr_vbo); glVertexPointer(4, GL_FLOAT, 0, 0); glEnableClientState(GL_VERTEX_ARRAY); if(col_vbo) { glBindBufferARB(GL_ARRAY_BUFFER_ARB, col_vbo); glColorPointer(4, GL_FLOAT, 0, 0); glEnableClientState(GL_COLOR_ARRAY); } glDrawArrays(GL_POINTS, 0, numParticles); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glUseProgram(0); glDisable(GL_POINT_SPRITE_ARB); glBindBufferARB(GL_ARRAY_BUFFER,0); if(m_drawGridMode) { btVector3& wmin = m_pWorld->m_worldMin; btVector3& wmax = m_pWorld->m_worldMax; glBegin(GL_LINE_LOOP); glVertex3f(wmin[0], wmin[1], wmin[2]); glVertex3f(wmin[0], wmax[1], wmin[2]); glVertex3f(wmax[0], wmax[1], wmin[2]); glVertex3f(wmax[0], wmin[1], wmin[2]); glVertex3f(wmax[0], wmin[1], wmax[2]); glVertex3f(wmax[0], wmax[1], wmax[2]); glVertex3f(wmin[0], wmax[1], wmax[2]); glVertex3f(wmin[0], wmin[1], wmax[2]); glEnd(); glBegin(GL_LINES); glVertex3f(wmin[0], wmin[1], wmin[2]); glVertex3f(wmax[0], wmin[1], wmin[2]); glVertex3f(wmin[0], wmin[1], wmax[2]); glVertex3f(wmax[0], wmin[1], wmax[2]); glVertex3f(wmin[0], wmax[1], wmin[2]); glVertex3f(wmin[0], wmax[1], wmax[2]); glVertex3f(wmax[0], wmax[1], wmin[2]); glVertex3f(wmax[0], wmax[1], wmax[2]); glEnd(); if(m_drawGridMode == 2) { int szx = m_pWorld->m_simParams.m_gridSize[0]; int szy = m_pWorld->m_simParams.m_gridSize[1]; glBegin(GL_LINES); for(int i = 1; i < (szx-1); i++) { float wgt = (float)i / (float)(szx-1); btVector3 vtx = wmax * wgt + wmin * (1.0f - wgt); glVertex3f(vtx[0], wmin[1], wmin[2]); glVertex3f(vtx[0], wmax[1], wmin[2]); } for(int i = 1; i < (szy-1); i++) { float wgt = (float)i / (float)(szy-1); btVector3 vtx = wmax * wgt + wmin * (1.0f - wgt); glVertex3f(wmin[0], vtx[1], wmin[2]); glVertex3f(wmax[0], vtx[1], wmin[2]); } glEnd(); } } if ((m_debugMode & btIDebugDraw::DBG_NoHelpText)==0) { setOrthographicProjection(); int xOffset = 10.f; int yStart = 20.f; int yIncr = 20.f; showProfileInfo(xOffset, yStart, yIncr); outputDebugInfo(xOffset, yStart, yIncr); resetPerspectiveProjection(); } }
void SpheresGridDemo::renderme() { glPointSize(5.0f); glEnable(GL_POINT_SPRITE_ARB); glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE); #ifndef __APPLE__ glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_NV); #endif //__APPLE__ glDepthMask(GL_TRUE); glEnable(GL_DEPTH_TEST); glUseProgram(m_shaderProgram); btScalar dist = (m_glutScreenWidth > m_glutScreenHeight) ? m_glutScreenHeight : m_glutScreenWidth; glUniform1f( glGetUniformLocation(m_shaderProgram, "pointScale"), dist ); // glUniform1f( glGetUniformLocation(m_shaderProgram, "pointRadius"), 0.5f ); #ifdef SPHERES_DEMO #ifdef INTEGRATION_DEMO int numSpheres = (m_demoType == DEMO_INTEGRATION) ? m_pWorldI->getNumSpheres() : m_pWorldS->getNumSpheres(); int col_vbo = (m_demoType == DEMO_INTEGRATION) ? m_pWorldI->m_colVbo : m_pWorldS->m_colVbo; int curr_vbo = (m_demoType == DEMO_INTEGRATION) ? m_pWorldI->m_vbo : m_pWorldS->m_vbo; float sphere_rad = (m_demoType == DEMO_INTEGRATION) ? m_pWorldI->m_sphereRad : m_pWorldS->m_sphereRad; #else int numSpheres = m_pWorldS->getNumSpheres(); int col_vbo = m_pWorldS->m_colVbo; int curr_vbo = m_pWorldS->m_vbo; float sphere_rad = m_pWorldS->m_sphereRad; #endif #else int numSpheres = m_pWorldI->getNumSpheres(); int col_vbo = m_pWorldI->m_colVbo; int curr_vbo = m_pWorldI->m_vbo; float sphere_rad = m_pWorldI->m_sphereRad; #endif glUniform1f( glGetUniformLocation(m_shaderProgram, "pointRadius"), sphere_rad ); glColor3f(1, 1, 1); // render from the vbo glBindBuffer(GL_ARRAY_BUFFER, curr_vbo); glVertexPointer(4, GL_FLOAT, 0, 0); glEnableClientState(GL_VERTEX_ARRAY); if(col_vbo) { glBindBufferARB(GL_ARRAY_BUFFER_ARB, col_vbo); glColorPointer(4, GL_FLOAT, 0, 0); glEnableClientState(GL_COLOR_ARRAY); } glDrawArrays(GL_POINTS, 0, numSpheres); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glUseProgram(0); glDisable(GL_POINT_SPRITE_ARB); glBindBufferARB(GL_ARRAY_BUFFER,0); #ifdef SPHERES_DEMO if((m_demoType != DEMO_INTEGRATION) && m_drawGridMode) { btVector3& wmin = m_pWorldS->m_worldMin; btVector3& wmax = m_pWorldS->m_worldMax; glBegin(GL_LINE_LOOP); glVertex3f(wmin[0], wmin[1], wmin[2]); glVertex3f(wmin[0], wmax[1], wmin[2]); glVertex3f(wmax[0], wmax[1], wmin[2]); glVertex3f(wmax[0], wmin[1], wmin[2]); glVertex3f(wmax[0], wmin[1], wmax[2]); glVertex3f(wmax[0], wmax[1], wmax[2]); glVertex3f(wmin[0], wmax[1], wmax[2]); glVertex3f(wmin[0], wmin[1], wmax[2]); glEnd(); glBegin(GL_LINES); glVertex3f(wmin[0], wmin[1], wmin[2]); glVertex3f(wmax[0], wmin[1], wmin[2]); glVertex3f(wmin[0], wmin[1], wmax[2]); glVertex3f(wmax[0], wmin[1], wmax[2]); glVertex3f(wmin[0], wmax[1], wmin[2]); glVertex3f(wmin[0], wmax[1], wmax[2]); glVertex3f(wmax[0], wmax[1], wmin[2]); glVertex3f(wmax[0], wmax[1], wmax[2]); glEnd(); if(m_drawGridMode == 2) { int szx = m_pWorldS->m_simParams.m_gridSize[0]; int szy = m_pWorldS->m_simParams.m_gridSize[1]; glBegin(GL_LINES); for(int i = 1; i < (szx-1); i++) { float wgt = (float)i / (float)(szx-1); btVector3 vtx = wmax * wgt + wmin * (1.0f - wgt); glVertex3f(vtx[0], wmin[1], wmin[2]); glVertex3f(vtx[0], wmax[1], wmin[2]); } for(int i = 1; i < (szy-1); i++) { float wgt = (float)i / (float)(szy-1); btVector3 vtx = wmax * wgt + wmin * (1.0f - wgt); glVertex3f(wmin[0], vtx[1], wmin[2]); glVertex3f(wmax[0], vtx[1], wmin[2]); } glEnd(); } } #endif if ((m_debugMode & btIDebugDraw::DBG_NoHelpText)==0) { setOrthographicProjection(); int xOffset = 10.f; int yStart = 20.f; int yIncr = 20.f; if(m_demoType == DEMO_INTEGRATION) { #ifdef INTEGRATION_DEMO switch(m_pWorldI->m_usedDevice) { case 0: GLDebugDrawString(xOffset,yStart,"CPU"); break; case 1: GLDebugDrawString(xOffset,yStart,"OpenCL"); break; case 2: GLDebugDrawString(xOffset,yStart,"CUDA"); break; } yStart += 30.f; #endif } showProfileInfo(xOffset, yStart, yIncr); outputDebugInfo(xOffset, yStart, yIncr); resetPerspectiveProjection(); } }
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(); }