I have implemented a mirror by rendering the reflected scene and copying to a texture. Unfortunately, copying to a texture is very slow and I can’t use the render-to-texture extension. I can speed it up somewhat by using a smaller reflection texture, but the quality of the reflection image is already low and that only makes it worse.
All the examples I’ve looked at use this technique: render the reflected scene, then clear the depth buffer, then render the mirror, then render the scene normally. This technique is much faster because it doesn’t involve copying to a texture.
However, I don’t want to use this technique because I see two important limitations:
You can only have one mirror plane.
You can’t perturb the reflection.
Are these limitations real? How would I get around them?
[This message has been edited by Jambolo (edited 05-07-2002).]
to get greatest speed with copying to a texture use glTexSubImage2D(…) + chosse the correct format eg in 32 bit colour for my gf2mx this method is the quickest
BGRA – UNSIGNED_INT_8_8_8_8_REV 130.056 Mpixels/sec
if your reflected scene is rather simple, a technik consist in replacing your textured polygon (your mirror) with a blended one and draw the same scene in both side of the mirror. It’s not a joke ! in many case it’s faster than using render-to-texture technik.
Originally posted by zed: to get greatest speed with copying to a texture use glTexSubImage2D(…) + chosse the correct format eg in 32 bit colour for my gf2mx this method is the quickest
BGRA – UNSIGNED_INT_8_8_8_8_REV 130.056 Mpixels/sec
I think that you mean 24 bits color + 8 bits alpha in pixelformat by saying 32 bits. Because if you use 32 bits color and 0 bit alpha in pixelformat, glcopytexsubimage2d to a gl_rgba is not accelerated. So isnt using
format: gl_rgba
internalformat: gl_rgba8
type: gl_unsigned_byte
gives the same performance as BGRA – UNSIGNED_INT_8_8_8_8_REV ?
[This message has been edited by Cem UZUNLAR (edited 04-27-2002).]
Why can you have only one mirror plane ?
I use the stencil buffer to give each mirror plane an id. Then I render the mirrored scene for each mirror with stencil test.
–Alex
Originally posted by daveperman: what gpu do you use? and what drivers for it?
I have a Savage 4 and the latest drivers I can find. I suppose I could get a new video card.
Originally posted by irionar: Why can you have only one mirror plane ?
Good question…I’m not using a stencil buffer, so the number or mirrors is definitely limited to one. However, with a stencil buffer, I can have more than one mirror if they don’t intersect and I draw back to front. Cool.