Hi
On my landscape engine i made some water reflections with the use of a clip plane and inverting the landscape, something like this:
push matrix
Enable clip plane;
scale(1,-1,1);
draw landscape;
disable clip plane;
pop matrix
push matrix
enable clip plane
draw landscape;
disable clip plane
pop matrix
I have seen that drawing the landscape 2 times without the clip plane is faster than rendering them with a clip plane.,
my performance was this:
rendering 2 landscapes : 90 fps
rendering 2 landscape/with a 2 clip planes : 44 fps
A friend of mine told me that we loose hardware clip planes when using more than 2 texture stages, and as i’am rendering with multitexture…, maybe the clipplane is working in software mode…, any ideia on this ?
So, now i wanna try to render the reflection to a texture(using the clip plane only once), and i have tried it, but i have some problems…
what i do is this:
push matrix
glViewPort(256,256);
Enable clip plane;
scale(1,-1,1);
draw landscape;
glBindTexture(GL_TEXTURE_2D,land.water_texture);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
disable clip plane;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glViewPort(800,600);
pop matrix
Now my problem is mapping the texture correctly to the water…,
How do i do it ?
My water has several strips, and my coordinates are generated in a way that i can map an 256x256 texture to entire water, but when i map the texture i get, she is strange, streched along the water…,
I was told that i must use automatic texture generation with GL_TEXTURE_GEN_S and GL_TEXTURE_GEN_T…, but not working, and honestly it doens’t make much sense to me.
What’s the trick? if any
thanks,
Bruno