MCPcopy Create free account
hub / github.com/DavidColson/Polybox / _sg_gl_query_image_pixels

Function _sg_gl_query_image_pixels

source/graphics_platform_d3d11.cpp:260–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258#if 0
259
260static void _sg_gl_query_image_pixels(_sg_image_t* img, void* pixels) {
261 SOKOL_ASSERT(img->gl.target == GL_TEXTURE_2D);
262 SOKOL_ASSERT(0 != img->gl.tex[img->cmn.active_slot]);
263#if defined(SOKOL_GLCORE33)
264 _sg_gl_cache_store_texture_binding(0);
265 _sg_gl_cache_bind_texture(0, img->gl.target, img->gl.tex[img->cmn.active_slot]);
266 glGetTexImage(img->gl.target, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
267 _SG_GL_CHECK_ERROR();
268 _sg_gl_cache_restore_texture_binding(0);
269#else
270 static GLuint newFbo = 0;
271 GLuint oldFbo = 0;
272 if(newFbo == 0) {
273 glGenFramebuffers(1, &newFbo);
274 }
275 glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*)&oldFbo);
276 glBindFramebuffer(GL_FRAMEBUFFER, newFbo);
277 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, img->gl.tex[img->cmn.active_slot], 0);
278 glReadPixels(0, 0, img->cmn.width, img->cmn.height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
279 glBindFramebuffer(GL_FRAMEBUFFER, oldFbo);
280 //glDeleteFramebuffers(1, &newFbo);
281 _SG_GL_CHECK_ERROR();
282#endif
283}
284
285static void _sg_gl_query_pixels(int x, int y, int w, int h, void *pixels) {
286 SOKOL_ASSERT(pixels);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected