0
\$\begingroup\$

I'm working Opengles2 and I have a just a texture ID and a quad from an SDK and its shader, and I can not access their code, just the vertex and pixel shader.

The quad from the SDK is rotated and flipped. Is it possible to rotate the quad and flip its sides in shader ?

I don't have also the MVP matrix.

\$\endgroup\$
0
\$\begingroup\$

multiply the quad's vertex positions by a rotation matrix that will give you the orientation you want

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ This answer would be better if it included an example of how to construct such a rotation matrix to achieve a particular rotation. \$\endgroup\$ – DMGregory Oct 2 '18 at 21:39
0
\$\begingroup\$

For flipping and rotating the sides I would only change the texture coordinates.

Let's say that (s, t) are the texture coordinates, then assuming the texture covers the whole quad:

  • change it to (t, s) for flipping the quad over its diagonal.
  • change it to (1 - t, s) for flipping the quad over the s axis.
  • change it to (t, 1 - s) for flipping the quad over the t axis.
  • compse these for other results.

Read about symmetry group for a more philosophical view.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ can you show a simple pseudo code shader ? \$\endgroup\$ – andre ahmed Oct 3 '18 at 4:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.