jsgf
Joined: 12 Jul 2005 Posts: 254
|
Posted: Wed Jan 11, 2006 11:25 am Post subject: PSPGL news |
|
|
I've been adding more stuff to PSPGL. The big addition is render to texture:
This is implemented in terms of EGL Pbuffers, which turned out to be pretty simple and quick to do. The API is simple:
| Code: |
pbuffer = eglCreatePbufferSurface(dpy, pbuffer_config, texture_attrib);
...
// make pbuffer the render target
eglMakeCurrent(dpy, pbuffer, pbuffer, ctx);
// render into pbuffer
// make screen the render target again
eglMakeCurrent(dpy, screen, screen, ctx);
glBindTexture(GL_TEXTURE_2D, texid)
eglBindTexImage(dpy, pbuffer, EGL_BACK_BUFFER);
// render using pbuffer texture
|
See pspgl/tests/eglpbuffers.c for a full example.
This is pretty similar to the standard EGL pbuffer API, but it imposes fewer restrictions; for example, you can use a surface for rendering, even if it is bound to a texture (though obviously you get pretty undefined results if you render from a texture into itself - though it might be worth trying). Other GL features, such as automatic mipmap generation, work with pbuffer-derived textures.
I'm still planning on implementing Pixel Buffer Objects and Frame Buffer Objects. These extensions also allow render-to-texture, but in a more standard and flexible way (though perhaps more complex to use and implement). |
|