<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi,<br>
    <br>
    <div class="moz-cite-prefix">On 2014-04-07 13:00, Iosif Hamlatzis
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAD2f6zXQr0Q88GNJ=xESM5h5x0UV0gTAs4P3ozJRGx70C+Fu2Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">ok I have managed to rotate my display
          and convert the touch co-ordinates but I have a lot flashes on
          the screen. I presume it has to do with the call to glScissor</div>
        <div class="gmail_extra">
          <br>
        </div>
        <div class="gmail_extra">At some places in my code I
          call glScissor and glGetIntegerv modify and retrieve the
          scissor box. If I don't call these there is no problem I have
          no flashes but obviously my rendering is wrong as I render
          outside my rectangle. </div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">Does the rotation matrix (either in
          projection or model view mode) affect the glScissor
          and glGetIntegerv calls or do I have to manually calculate the
          rotation for the scissor box?</div>
      </div>
    </blockquote>
    <br>
    glScissor operates on "window coordinates" (just like, for example,
    glViewport):<br>
    <a class="moz-txt-link-freetext" href="https://www.khronos.org/opengles/sdk/docs/man/xhtml/glScissor.xml">https://www.khronos.org/opengles/sdk/docs/man/xhtml/glScissor.xml</a><br>
    <br>
    How to get from object coordinates to world coordinates is described
    here:<br>
    <a class="moz-txt-link-freetext" href="http://www.opengl.org/sdk/docs/man2/xhtml/gluProject.xml">http://www.opengl.org/sdk/docs/man2/xhtml/gluProject.xml</a><br>
    (you usually don't have gluProject available in GLES directly, as
    it's part of GLU)<br>
    <br>
    In some simple cases, you might be able to just swap the axes and
    subtract the axis value from the width/height to rotate it by 90
    degrees instead of going through the full matrix multiplication.<br>
    <br>
    So yes, you have to manually calculate the rotation for the scissor
    box; the easiest being to do the same that gluProject does.<br>
    <br>
    <br>
    HTH :)<br>
    Thomas<br>
    <br>
    <blockquote
cite="mid:CAD2f6zXQr0Q88GNJ=xESM5h5x0UV0gTAs4P3ozJRGx70C+Fu2Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">The code I use for scissoring is:</div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">
          <div class="gmail_extra">//---------------------------------------------------------------------------------------------------------</div>
          <div class="gmail_extra">RECT Presenter::ClippingRegion()
            const</div>
          <div class="gmail_extra">{</div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>RECT rc;</div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>SetRect( &rc, 0, 0,
            mnScreenWidth, mnScreenHeight);</div>
          <div class="gmail_extra"><br>
          </div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>if (
            glIsEnabled(GL_SCISSOR_TEST) )</div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>{</div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>GLint clip[4];</div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>glGetIntegerv(
            GL_SCISSOR_BOX, &(clip[0]) );</div>
          <div class="gmail_extra">
            <br>
          </div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>SetRect(<span class=""
              style="white-space:pre"> </span>&rc, clip[0],
            clip[1], (clip[0]+clip[2]), (clip[1]+clip[3] );</div>
          <div class="gmail_extra">
            <span class="" style="white-space:pre"> </span>}</div>
          <div class="gmail_extra"><br>
          </div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>return rc;</div>
          <div class="gmail_extra">}</div>
          <div class="gmail_extra">
//---------------------------------------------------------------------------------------------------------</div>
          <div class="gmail_extra">void Presenter::ClippingRegion(const
            RECT& rc)</div>
          <div class="gmail_extra">{</div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>glEnable( GL_SCISSOR_TEST
            );</div>
          <div class="gmail_extra"><br>
          </div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>GLsizei width = rc.right
            - rc.left;</div>
          <div class="gmail_extra"> <span class=""
              style="white-space:pre"> </span>GLsizei height =
            rc.bottom - rc.top;</div>
          <div class="gmail_extra"><br>
          </div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>GLint x = rc.left;</div>
          <div class="gmail_extra"> <span class=""
              style="white-space:pre"> </span>GLint y = rc.top;</div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>GLint y_modified =
            mnScreenHeight-(y+height);</div>
          <div class="gmail_extra">
            <br>
          </div>
          <div class="gmail_extra"><span class=""
              style="white-space:pre"> </span>glScissor(x, y_modified,
            width, height);</div>
          <div class="gmail_extra">}</div>
          <div class="gmail_extra"><br>
          </div>
          <div class="gmail_extra">
            Where in the above code RECT is a struct similar to
            Microsoft's RECT and SetRect(left, top, right, bottom) is a
            function similar to Microsoft's for setting left, top, right
            and bottom co-ordinates for a RECT.</div>
          <div class="gmail_extra"><br>
          </div>
          <div class="gmail_extra">So do I have to calculate the
            rotation for the parameters or is it automatically done by
            the rotation matrix?</div>
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SailfishOS.org Devel mailing list</pre>
    </blockquote>
    <br>
  </body>
</html>