| Summary: | glFinish() required to share SDL_RENDERER_TARGETTEXTURE across contexts | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Jay Dolan <jay> |
| Component: | render | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | amaranth72, icculus |
| Version: | 2.0.4 | ||
| Hardware: | x86_64 | ||
| OS: | Mac OS X 10.11 | ||
| Attachments: | Brief example showing placement of necessary glFinish call | ||
(In reply to Jay Dolan from comment #0) > Is this a known issue? Is it documented anywhere? Yes, it's how OpenGL works (you should probably use glFlush instead of glFinish though): https://developer.apple.com/library/content/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_designstrategies/opengl_designstrategies.html#//apple_ref/doc/uid/TP40001987-CH2-SW15 (In reply to Alex Szpakowski from comment #1) > Yes, it's how OpenGL works (you should probably use glFlush instead of > glFinish though): So we should close this bug, right? --ryan. That's fine with me. I've moved away from this approach, in any case. I had just never encountered a real world scenario where glFinish() was actually useful / necessary. Seemed like a bug to me. But that's on me, I guess. (In reply to Jay Dolan from comment #3) > That's fine with me. I've moved away from this approach, in any case. I had > just never encountered a real world scenario where glFinish() was actually > useful / necessary. Seemed like a bug to me. But that's on me, I guess. Yeah, this always confused me. :/ Closing the bug! --ryan. |
Created attachment 2531 [details] Brief example showing placement of necessary glFinish call My application uses two OpenGL 2.1 contexts: one for 3D drawing, and a second for 2D drawing which uses the SDL_Renderer API. I'm using 2 contexts, because the SDL_Renderer API makes many GL state changes which are difficult to follow and reset -- so I thought it best to just give it its own context. Therefore, my 2D rendering context uses a SDL_RENDERER_TARGETTEXTURE texture (ARB_GL_framebuffer_object_EXT). It draws its contents to the texture, and then I make the primary context active again, and blit that texture to the screen. This all works wonderfully. However, there was a snag that cost me quite a few hours. See attachment. Apparently, before unlocking the texture and FBO, a call to glFinish is absolutely necessary (at least on OS X) to force the SDL_Renderer to completely render to the texture. Without calling glFinish, I was often left with a half-baked texture, a stale texture, or sometimes no texture at all! Is this a known issue? Is it documented anywhere?