I've added underwater warps to the RMQ engine using code derived from DirectQ, and the funny thing is that the OpenGL code for doing this is immensely superior to the D3D code. It's not using an FBO or a pbuffer, just good old glCopyTexSubImage2D, but it does also add in the blend colour for free. The end result is an underwater warp that's able to run at the full screen resolution (although for now I've clamped it at 1024x1024 to prevent excessive texture memory usage) without the slowdown problems I had to deal with in DirectQ.
Of course D3D's CreateRenderTarget/SetRenderTarget/etc are more flexible as a general solution, but for something like this glCopyTexSubImage2D is more than amply good enough and there's no need to complicate things like I had to do with DirectQ.
One sticking point with the OpenGL code is the whole "bottom-left is the origin" thing. This obviously goes back to OpenGL's CAD beginnings, but when you're working in screen space it's awkward, unintuitive and involves an amount of mental juggling.
It's while working on things like this that sometimes it comes home how much I really missed the elegant simplicity of OpenGL, whereas other times I just want to curse at it and punch the person responsible for that design decision, and - occasionally - both things happen at once.
Sunday, July 25, 2010
Underwater Warps
Posted by
mhquake
at
12:49 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment