Hi,
for some reasons ( I use some rendering code which I could not change and even look at ( as the project separated on several stages and I could access only limited parts of code othe goes for me only as libs )) ) I have problems using way to implement mirror using glScale with -1 as one of param or using transform matrix ( which reflects scene on plane but almost the same way - scaling world by - 1 ) approaches ( I cannot use this as there is a bug somewhere in the code ( I could not change) and this bug leads that calls to glCullFace give no expected result ( the objects on scene are not properly culled).
a bit complicated situation…
but I could use shaders.
what I think of as possible approaches ( though did not tried some)
scaling not in main Gl/C code but in a vertex shader
but here as face culling happens in rendering pipeling after vertex shader is applied actually seems this would not give me advantage if I scale -1 in vertex shader…( maybe there is somehow a way to change winding order in shader ?)
also possibly I could use pbuffers and then flip texcoords to achive ‘mirror’ effect ( or apply pixel shader when using pbuffer content in such way as ( in pseudo code)
float2 texCoord = In.texCoord;
texCoord.x = 1- texCoord.x;
float4 c = tex2D( texture0, texCoord);
return c;//return COLOR
but once again here there some problems with my mentioned code - preferably I should not use pbuffers…
finally I can do ( and it works) rendering to
framebuffer and then glCopyTexSubimage something like in a sample here http://www.geocities.com/dimi_christop/OGLDemos/ogldemos.html
I tried this and actually it is a bit too slow ( also I did not use glScale rather I used flipping of coords of the given texture like explainied here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnopen/html/msdn_gl7.asp
( Figure 9)
so what are other possible options to have mirrors ( maybe shader based) and are there some such examples
(which preferably do not use pbuffers or glCopyTexSubimage) and where I could avoid that bugs which affect culling after using glScale ( -1 ) in my code on the code I could not manage or fix ( which is not under my control…)
[This message has been edited by SergeVrt (edited 12-28-2003).]