| 1167 | } |
| 1168 | |
| 1169 | void OpenGLExampleBrowser::update(float deltaTime) |
| 1170 | { |
| 1171 | |
| 1172 | b3ChromeUtilsEnableProfiling(); |
| 1173 | |
| 1174 | if (!gEnableRenderLoop && !singleStepSimulation) |
| 1175 | { |
| 1176 | B3_PROFILE("updateGraphics"); |
| 1177 | sCurrentDemo->updateGraphics(); |
| 1178 | return; |
| 1179 | } |
| 1180 | |
| 1181 | B3_PROFILE("OpenGLExampleBrowser::update"); |
| 1182 | //assert(glGetError() == GL_NO_ERROR); |
| 1183 | { |
| 1184 | B3_PROFILE("s_instancingRenderer"); |
| 1185 | s_instancingRenderer->init(); |
| 1186 | } |
| 1187 | DrawGridData dg; |
| 1188 | dg.upAxis = s_app->getUpAxis(); |
| 1189 | |
| 1190 | { |
| 1191 | BT_PROFILE("Update Camera and Light"); |
| 1192 | |
| 1193 | s_instancingRenderer->updateCamera(dg.upAxis); |
| 1194 | } |
| 1195 | |
| 1196 | static int frameCount = 0; |
| 1197 | frameCount++; |
| 1198 | |
| 1199 | if (0) |
| 1200 | { |
| 1201 | BT_PROFILE("Draw frame counter"); |
| 1202 | char bla[1024]; |
| 1203 | sprintf(bla, "Frame %d", frameCount); |
| 1204 | s_app->drawText(bla, 10, 10); |
| 1205 | } |
| 1206 | |
| 1207 | if (gPngFileName) |
| 1208 | { |
| 1209 | static int skip = 0; |
| 1210 | skip--; |
| 1211 | if (skip < 0) |
| 1212 | { |
| 1213 | skip = gPngSkipFrames; |
| 1214 | //printf("gPngFileName=%s\n",gPngFileName); |
| 1215 | static int s_frameCount = 0; |
| 1216 | |
| 1217 | sprintf(staticPngFileName, "%s%d.png", gPngFileName, s_frameCount++); |
| 1218 | //b3Printf("Made screenshot %s",staticPngFileName); |
| 1219 | s_app->dumpNextFrameToPng(staticPngFileName); |
| 1220 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| 1221 | } |
| 1222 | } |
| 1223 | |
| 1224 | if (sCurrentDemo) |
| 1225 | { |
| 1226 | if (!pauseSimulation || singleStepSimulation) |
no test coverage detected