MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / dumpNextFrameToPng

Method dumpNextFrameToPng

examples/OpenGLWindow/SimpleOpenGL3App.cpp:1137–1168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1135 }
1136}
1137void SimpleOpenGL3App::dumpNextFrameToPng(const char* filename)
1138{
1139 // open pipe to ffmpeg's stdin in binary write mode
1140
1141 m_data->m_frameDumpPngFileName = filename;
1142
1143 //you could use m_renderTexture to allow to render at higher resolutions, such as 4k or so
1144 if (!m_data->m_renderTexture)
1145 {
1146 m_data->m_renderTexture = new GLRenderToTexture();
1147 GLuint renderTextureId;
1148 glGenTextures(1, &renderTextureId);
1149
1150 // "Bind" the newly created texture : all future texture functions will modify this texture
1151 glBindTexture(GL_TEXTURE_2D, renderTextureId);
1152
1153 // Give an empty image to OpenGL ( the last "0" )
1154 //glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, g_OpenGLWidth,g_OpenGLHeight, 0,GL_RGBA, GL_UNSIGNED_BYTE, 0);
1155 //glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA32F, g_OpenGLWidth,g_OpenGLHeight, 0,GL_RGBA, GL_FLOAT, 0);
1156 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F,
1157 m_instancingRenderer->getScreenWidth() * m_window->getRetinaScale(), m_instancingRenderer->getScreenHeight() * m_window->getRetinaScale(), 0, GL_RGBA, GL_FLOAT, 0);
1158
1159 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1160 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
1161 //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
1162 //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
1163
1164 m_data->m_renderTexture->init(m_instancingRenderer->getScreenWidth() * m_window->getRetinaScale(), this->m_instancingRenderer->getScreenHeight() * m_window->getRetinaScale(), renderTextureId, RENDERTEXTURE_COLOR);
1165 }
1166
1167 m_data->m_renderTexture->enable();
1168}
1169
1170void SimpleOpenGL3App::setUpAxis(int axis)
1171{

Callers 5

updateMethod · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
stepSimulationMethod · 0.45

Calls 5

enableMethod · 0.80
getScreenWidthMethod · 0.45
getRetinaScaleMethod · 0.45
getScreenHeightMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected