Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Figured it out... here is the correct code in case it helps someone else</p> <p>Note that I removed the references to vid.xratio and vid.yratio... what I do instead, is after calling Matrix::Ortho on the projection matrix, I do:</p> <p>Matrix::Scale(projMatrix, vid.xratio, vid.yratio, 1.0f);</p> <pre><code>const byte picVerts[] = {0, 0, 1, 0, 1, 1, 0, 1}; // // DrawPictureSize // // Draws a picture on the 2D screen, width and height specified. // // Note: 'Set2D' must be called before this! // void DrawPictureSize(float x, float y, float width, float height, float scalex, float scaley, Vector::vector_t *upVec, byte alpha, Texture::texture_t *texture, int halignment, int valignment) { if (!texture) return; float matrix[16]; Matrix::LoadIdentity(matrix); width *= scalex; height *= scaley; float angle = U_Rad2Deg(atan2(upVec-&gt;y, upVec-&gt;x)) - 90; float xalign = 0; float yalign = 0; // Move into position if (halignment == Font::HALIGN_CENTER) xalign = width/2; else if (halignment == Font::HALIGN_RIGHT) xalign = width; if (valignment == Font::VALIGN_CENTER) yalign = height/2; else if (valignment == Font::VALIGN_TOP) yalign = height; // Move into position Matrix::Translate(matrix, x - xalign, y - yalign, 0.0f); // Translate to the origin before doing rotation if (angle != 0.0f) { Matrix::Translate(matrix, xalign, yalign, 0); Matrix::Rotate(matrix, angle, 0, 0, 1); Matrix::Translate(matrix, -xalign, -yalign, 0); } // Expand square to image size Matrix::Scale(matrix, width, height, 1.0f); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload