Re: [PyOpenGL-Users] Using framebuffers
Brought to you by:
mcfletch
|
From: Uğur G. <ugu...@gm...> - 2016-05-29 14:16:41
|
Hi Ian, There are two basic ways to get functionality in GL. Either you load it > from an extension (which PyOpenGL handily does for you) or you use the core > API. The "Right Thing" is to use the core API if available, with a fallback > to the extension, with a fallback to a different algorithm. In practice, > people commonly pick one and go with it. I picked the extension, because > it's more widely compatible than core, but still not giving up on the > functionality entirely. > Thanks for sharing your wisdom with me! If I'll ever write a project for public I'll go with this "use the core if available and fallback to extensions if necessary" method. For now I'll stick with the core one for my study projects. PyGame is a very good software package, especially for low-perf 2D drawing. > It's how I got started in graphics programming and I recommend it still. It > is unfortunate that distributions haven't been made available, and this is > a source of active . . . consternation . . . on the PyGame list. Unofficial > pip wheels can be found here > <http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame>, or you can use the > (somewhat outdated) installers on the site > <http://www.pygame.org/download.shtml>. > Thanks for pointing out pip wheels for pygame. This way I'll be able to try it out. ^_^ Finally, I succeeded to do post-processing using an FBO! Here are screenshots of before and after the colored triange's pixels are inverted: http://imgur.com/a/P2wxt I removed all of the abstractions/classes in your code related to framebuffer and texture generation and pasted to my project and it worked! Then I compared your code with mine and found the source of the problem. When I generate the texture ID, if I use this expressions texture = GLuint() glGenTextures(1, texture) nothing is rendered on the texture. Generating texture ID this way works fine: texture = glGenTextures(1) I don't know whether this is a feature or a bug. :-) I was going with the former way (creating a GLuint object first, and manipulating it in the glGenX function by giving it as the second argument) because it looks more like the C/C++ OpenGL code I find on the Internet. And it works fine with glGenVertexArrays, glGenBuffers, glGenFramebuffers, and glGenRenderbuffers but not with glGenTextures. I updated the code to demonstrate this behavior: https://gist.github.com/vug/2c7953d5fdf750c727af249ded3e9018 Have a good day! u |