c++ - Reverse vertex winding order using matrices -


i'm implementing reflections (using render-to-texture method), , far works, problem objects in reflected version rendered inside out.

i'd avoid changing internal opengl vertex winding order make sure don't interfere other rendering operations much.

instead, i'd transform reflection matrix reversing. (which should reflection?)

this reflection matrix (which transforms view matrix of camera):

glm::mat4 matreflection(     1.f -2.f *n.x *n.x,-2.f *n.x *n.y,-2.f *n.x *n.z,-2.f *n.x *d,     -2.f *n.x *n.y,1.f -2.f *n.y *n.y,-2.f *n.y *n.z,-2.f *n.y *d,     -2.f *n.x *n.z,-2.f *n.y *n.z,1.f -2.f *n.z *n.z,-2.f *n.z *d,     0.f,0.f,0.f,1.f ); 

n = normal of plane of reflection; d = distance of plane

is possible reverse vertex order through matrix transformation? if so, how exactly?

if apply matrix scale y-axis -1 after other transformations (including projection), end upside-down image (which can use including uv.y = 1-uv.y somewhere in pipeline).


Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -