I am still relatively inexperienced to OpenGL but this is quite an advanced task…
What would be an effective and efficient way to create a dynamic shimmering/blurring effect caused by, say, a cloaked vessel (seen in a few games) passing over a textured backdrop? The blur should follow the boundaries of the ship so an observant player at close range will see the disturbance.
I think this is simplest, assuming you’re in fullscreen (so you don’t have to worry about overlap, where the framebuffer is undefined):
- render background
- glCopyTexSubImage() the background around where the ship is to a rectangular texture (with some margin)
- render the mesh using the copied texture, and OBJECT_LINEAR texgen set up such that it ALMOST matches the actual projection to frame buffer, and no lighting
The more “ALMOST” gets similar to the frame buffer, the less distortion will be noticed.
Is their a certain nack to it? Because i have tried glCopyTexImage2D and a glReadPixels + glTexImage2D combination, and all I get is a plain white texture map.
Although I know that glReadPixels returns the correct data because I saved the buffer to a file and examined it.
The only “knack” to it is to make sure all your state is correct; i e correct textures bound; correct TexEnv when applying the texture; etc.
Read the spec, and make sure everything matches up (which becomes complex, because all of the “fragment coloring” path needs to be correct in addition to vertex processing and texturing).
For example, if your texture target has MIP maps turned on, but you only CopyTexSubImage() the first MIP map level, then the others won’t be specified, and the result of texturing will be white. Unless you either turn off MIP mapping for that texture object, or turn on auto MIP map generation (if the extension is available).
Got it - I forgot to set the minifying function to GL_LINEAR.