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

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

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