Atrus

TinyGL testing

Jun 17th, 2021
877
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 13.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6.  
  7. #define M_PI 3.14159265358979323846 /* pi */
  8.  
  9. // matrix.c
  10. void gl_print_matrix(const float *m);
  11.  
  12.  
  13. #define X _v[0]
  14. #define Y _v[1]
  15. #define Z _v[2]
  16. #define W _v[3]
  17.  
  18. // Matrix & Vertex
  19. class Vector3 {
  20. public:
  21.     Vector3() { }
  22.     Vector3(float x, float y, float z) {
  23.         X = x;
  24.         Y = y;
  25.         Z = z;
  26.     }
  27.  
  28.     void normalize();
  29.  
  30.     float getLength() const { return sqrt(X * X + Y * Y + Z * Z); }
  31.  
  32.     bool operator==(const Vector3 &other) const {
  33.         return X == other.X && Y == other.Y && Z == other.Z;
  34.     }
  35.  
  36.     bool operator!=(const Vector3 &other) const {
  37.         return X != other.X || Y != other.Y || Z != other.Z;
  38.     }
  39.  
  40.     Vector3 operator-() const {
  41.         return Vector3(-X, -Y, -Z);
  42.     }
  43.  
  44.     Vector3 operator*(float factor) const {
  45.         return Vector3(X * factor, Y * factor, Z * factor);
  46.     }
  47.  
  48.     Vector3 operator+(const Vector3 &other) const {
  49.         return Vector3(X + other.X, Y + other.Y, Z + other.Z);
  50.     }
  51.  
  52.     Vector3 operator-(const Vector3 &other) const {
  53.         return Vector3(X - other.X, Y - other.Y, Z - other.Z);
  54.     }
  55.  
  56.     Vector3 &operator*=(float factor) {
  57.         X *= factor;
  58.         Y *= factor;
  59.         Z *= factor;
  60.         return *this;
  61.     }
  62.  
  63.     Vector3 &operator+=(float value) {
  64.         X += value;
  65.         Y += value;
  66.         Z += value;
  67.         return *this;
  68.     }
  69.  
  70.     Vector3 &operator-=(float value) {
  71.         X -= value;
  72.         Y -= value;
  73.         Z -= value;
  74.         return *this;
  75.     }
  76.  
  77.     float _v[3];
  78. };
  79.  
  80. class Vector4 {
  81. public:
  82.     Vector4() { }
  83.     Vector4(const Vector3 &vec, float w);
  84.  
  85.     Vector4(float x, float y, float z, float w) {
  86.         X = x;
  87.         Y = y;
  88.         Z = z;
  89.         W = w;
  90.     }
  91.  
  92.     bool operator==(const Vector4 &other) const {
  93.         return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
  94.     }
  95.  
  96.     bool operator!=(const Vector4 &other) const {
  97.         return X != other.X || Y != other.Y || Z != other.Z || W != other.W;
  98.     }
  99.  
  100.     Vector4 operator-() const {
  101.         return Vector4(-X, -Y, -Z, -W);
  102.     }
  103.  
  104.     Vector4 operator*(float factor) const {
  105.         return Vector4(X * factor, Y * factor, Z * factor,W * factor);
  106.     }
  107.  
  108.     Vector4 operator+(const Vector4 &other) const {
  109.         return Vector4(X + other.X, Y + other.Y, Z + other.Z, W + other.W);
  110.     }
  111.  
  112.     Vector4 operator-(const Vector4 &other) const {
  113.         return Vector4(X - other.X, Y - other.Y, Z - other.Z, W - other.W);
  114.     }
  115.  
  116.     Vector4 &operator*=(float factor) {
  117.         X *= factor;
  118.         Y *= factor;
  119.         Z *= factor;
  120.         W *= factor;
  121.         return *this;
  122.     }
  123.  
  124.     Vector4 &operator+=(float value) {
  125.         X += value;
  126.         Y += value;
  127.         Z += value;
  128.         W += value;
  129.         return *this;
  130.     }
  131.  
  132.     Vector4 &operator-=(float value) {
  133.         X -= value;
  134.         Y -= value;
  135.         Z -= value;
  136.         W -= value;
  137.         return *this;
  138.     }
  139.  
  140.     float _v[4];
  141. };
  142.  
  143. class Matrix4 {
  144. public:
  145.     Matrix4() { }
  146.  
  147.     bool isIdentity() const;
  148.  
  149.     inline Matrix4 operator+(const Matrix4 &b) const {
  150.         Matrix4 result;
  151.         for (int i = 0; i < 4; i++) {
  152.             for (int j = 0; j < 4; j++) {
  153.                 result._m[i][j] = _m[i][j] + b._m[i][j];
  154.             }
  155.         }
  156.         return result;
  157.     }
  158.  
  159.     inline Matrix4 operator-(const Matrix4 &b) const {
  160.         Matrix4 result;
  161.         for (int i = 0; i < 4; i++) {
  162.             for (int j = 0; j < 4; j++) {
  163.                 result._m[i][j] = _m[i][j] - b._m[i][j];
  164.             }
  165.         }
  166.         return result;
  167.     }
  168.  
  169.     inline Matrix4 operator*(const Matrix4 &b) const {
  170.         Matrix4 result;
  171.         for (int i = 0; i < 4; i++) {
  172.             for (int j = 0; j < 4; j++) {
  173.                 float s = 0.0;
  174.                 for (int k = 0; k < 4; k++)
  175.                     s += _m[i][k] * b._m[k][j];
  176.                 result._m[i][j] = s;
  177.             }
  178.         }
  179.         return result;
  180.     }
  181.  
  182.     inline Matrix4 &operator*=(const Matrix4 &b) {
  183.         Matrix4 a = *this;
  184.         float s;
  185.         for (int i = 0; i < 4; i++) {
  186.             for (int j = 0; j < 4; j++) {
  187.                 s = 0.0;
  188.                 for (int k = 0; k < 4; k++)
  189.                     s += a._m[i][k] * b._m[k][j];
  190.                 this->_m[i][j] = s;
  191.             }
  192.         }
  193.         return *this;
  194.     }
  195.  
  196.     void scale(float x, float y, float z);
  197.     void translate(float x, float y, float z);
  198.     void identity();
  199.     void rotation(float t, int);
  200.  
  201.     void invert();
  202.     void transpose();
  203.  
  204.     Matrix4 inverseOrtho() const;
  205.    
  206.     Matrix4 getCopy();
  207.     Matrix4 transpose() const;
  208.     Matrix4 inverse() const;
  209.    
  210.     static Matrix4 frustum(float left, float right, float bottom, float top, float nearp, float farp);
  211.  
  212.     float _m[4][4];
  213. };
  214.    
  215.  
  216. Matrix4 Matrix4::getCopy() {
  217.     return *this;
  218. }
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. int MatrixInverse(float *m) {
  227.     double inv[16];
  228.  
  229.     inv[0] = m[5]  * m[10] * m[15] -
  230.         m[5]  * m[11] * m[14] -
  231.         m[9]  * m[6]  * m[15] +
  232.         m[9]  * m[7]  * m[14] +
  233.         m[13] * m[6]  * m[11] -
  234.         m[13] * m[7]  * m[10];
  235.  
  236.     inv[4] = -m[4]  * m[10] * m[15] +
  237.         m[4]  * m[11] * m[14] +
  238.         m[8]  * m[6]  * m[15] -
  239.         m[8]  * m[7]  * m[14] -
  240.         m[12] * m[6]  * m[11] +
  241.         m[12] * m[7]  * m[10];
  242.  
  243.     inv[8] = m[4]  * m[9] * m[15] -
  244.         m[4]  * m[11] * m[13] -
  245.         m[8]  * m[5] * m[15] +
  246.         m[8]  * m[7] * m[13] +
  247.         m[12] * m[5] * m[11] -
  248.         m[12] * m[7] * m[9];
  249.  
  250.     inv[12] = -m[4]  * m[9] * m[14] +
  251.         m[4]  * m[10] * m[13] +
  252.         m[8]  * m[5] * m[14] -
  253.         m[8]  * m[6] * m[13] -
  254.         m[12] * m[5] * m[10] +
  255.         m[12] * m[6] * m[9];
  256.  
  257.     inv[1] = -m[1]  * m[10] * m[15] +
  258.         m[1]  * m[11] * m[14] +
  259.         m[9]  * m[2] * m[15] -
  260.         m[9]  * m[3] * m[14] -
  261.         m[13] * m[2] * m[11] +
  262.         m[13] * m[3] * m[10];
  263.  
  264.     inv[5] = m[0]  * m[10] * m[15] -
  265.         m[0]  * m[11] * m[14] -
  266.         m[8]  * m[2] * m[15] +
  267.         m[8]  * m[3] * m[14] +
  268.         m[12] * m[2] * m[11] -
  269.         m[12] * m[3] * m[10];
  270.  
  271.     inv[9] = -m[0]  * m[9] * m[15] +
  272.         m[0]  * m[11] * m[13] +
  273.         m[8]  * m[1] * m[15] -
  274.         m[8]  * m[3] * m[13] -
  275.         m[12] * m[1] * m[11] +
  276.         m[12] * m[3] * m[9];
  277.  
  278.     inv[13] = m[0]  * m[9] * m[14] -
  279.         m[0]  * m[10] * m[13] -
  280.         m[8]  * m[1] * m[14] +
  281.         m[8]  * m[2] * m[13] +
  282.         m[12] * m[1] * m[10] -
  283.         m[12] * m[2] * m[9];
  284.  
  285.     inv[2] = m[1]  * m[6] * m[15] -
  286.         m[1]  * m[7] * m[14] -
  287.         m[5]  * m[2] * m[15] +
  288.         m[5]  * m[3] * m[14] +
  289.         m[13] * m[2] * m[7] -
  290.         m[13] * m[3] * m[6];
  291.  
  292.     inv[6] = -m[0]  * m[6] * m[15] +
  293.         m[0]  * m[7] * m[14] +
  294.         m[4]  * m[2] * m[15] -
  295.         m[4]  * m[3] * m[14] -
  296.         m[12] * m[2] * m[7] +
  297.         m[12] * m[3] * m[6];
  298.  
  299.     inv[10] = m[0]  * m[5] * m[15] -
  300.         m[0]  * m[7] * m[13] -
  301.         m[4]  * m[1] * m[15] +
  302.         m[4]  * m[3] * m[13] +
  303.         m[12] * m[1] * m[7] -
  304.         m[12] * m[3] * m[5];
  305.  
  306.     inv[14] = -m[0]  * m[5] * m[14] +
  307.         m[0]  * m[6] * m[13] +
  308.         m[4]  * m[1] * m[14] -
  309.         m[4]  * m[2] * m[13] -
  310.         m[12] * m[1] * m[6] +
  311.         m[12] * m[2] * m[5];
  312.  
  313.     inv[3] = -m[1] * m[6] * m[11] +
  314.         m[1] * m[7] * m[10] +
  315.         m[5] * m[2] * m[11] -
  316.         m[5] * m[3] * m[10] -
  317.         m[9] * m[2] * m[7] +
  318.         m[9] * m[3] * m[6];
  319.  
  320.     inv[7] = m[0] * m[6] * m[11] -
  321.         m[0] * m[7] * m[10] -
  322.         m[4] * m[2] * m[11] +
  323.         m[4] * m[3] * m[10] +
  324.         m[8] * m[2] * m[7] -
  325.         m[8] * m[3] * m[6];
  326.  
  327.     inv[11] = -m[0] * m[5] * m[11] +
  328.         m[0] * m[7] * m[9] +
  329.         m[4] * m[1] * m[11] -
  330.         m[4] * m[3] * m[9] -
  331.         m[8] * m[1] * m[7] +
  332.         m[8] * m[3] * m[5];
  333.  
  334.     inv[15] = m[0] * m[5] * m[10] -
  335.         m[0] * m[6] * m[9] -
  336.         m[4] * m[1] * m[10] +
  337.         m[4] * m[2] * m[9] +
  338.         m[8] * m[1] * m[6] -
  339.         m[8] * m[2] * m[5];
  340.  
  341.     double det = m[0] * inv[0] + m[1] * inv[4] + m[2] * inv[8] + m[3] * inv[12];
  342.  
  343.     if (det == 0)
  344.         return false;
  345.  
  346.     det = 1.0 / det;
  347.  
  348.     for (int i = 0; i < 16; i++) {
  349.         m[i] = inv[i] * det;
  350.     }
  351.     return true;
  352. }
  353.  
  354. void Vector3::normalize() {
  355.     float n = sqrt(X * X + Y * Y + Z * Z);
  356.     if (n != 0) {
  357.         X /= n;
  358.         Y /= n;
  359.         Z /= n;
  360.     }
  361. }
  362.  
  363. Vector4::Vector4(const Vector3 &vec, float w) {
  364.     X = vec.X;
  365.     Y = vec.Y;
  366.     Z = vec.Z;
  367.     W = w;
  368. }
  369.  
  370. void Matrix4::identity() {
  371.     memset(_m, 0, sizeof(_m));
  372.     _m[0][0] = 1.0f;
  373.     _m[1][1] = 1.0f;
  374.     _m[2][2] = 1.0f;
  375.     _m[3][3] = 1.0f;
  376. }
  377.  
  378. Matrix4 Matrix4::transpose() const {
  379.     Matrix4 a;
  380.  
  381.     a._m[0][0] = this->_m[0][0];
  382.     a._m[0][1] = this->_m[1][0];
  383.     a._m[0][2] = this->_m[2][0];
  384.     a._m[0][3] = this->_m[3][0];
  385.  
  386.     a._m[1][0] = this->_m[0][1];
  387.     a._m[1][1] = this->_m[1][1];
  388.     a._m[1][2] = this->_m[2][1];
  389.     a._m[1][3] = this->_m[3][1];
  390.  
  391.     a._m[2][0] = this->_m[0][2];
  392.     a._m[2][1] = this->_m[1][2];
  393.     a._m[2][2] = this->_m[2][2];
  394.     a._m[2][3] = this->_m[3][2];
  395.  
  396.     a._m[3][0] = this->_m[0][3];
  397.     a._m[3][1] = this->_m[1][3];
  398.     a._m[3][2] = this->_m[2][3];
  399.     a._m[3][3] = this->_m[3][3];
  400.  
  401.     return a;
  402. }
  403.  
  404. void Matrix4::transpose() {
  405.     Matrix4 tmp = *this;
  406.     this->_m[0][0] = tmp._m[0][0];
  407.     this->_m[0][1] = tmp._m[1][0];
  408.     this->_m[0][2] = tmp._m[2][0];
  409.     this->_m[0][3] = tmp._m[3][0];
  410.  
  411.     this->_m[1][0] = tmp._m[0][1];
  412.     this->_m[1][1] = tmp._m[1][1];
  413.     this->_m[1][2] = tmp._m[2][1];
  414.     this->_m[1][3] = tmp._m[3][1];
  415.  
  416.     this->_m[2][0] = tmp._m[0][2];
  417.     this->_m[2][1] = tmp._m[1][2];
  418.     this->_m[2][2] = tmp._m[2][2];
  419.     this->_m[2][3] = tmp._m[3][2];
  420.  
  421.     this->_m[3][0] = tmp._m[0][3];
  422.     this->_m[3][1] = tmp._m[1][3];
  423.     this->_m[3][2] = tmp._m[2][3];
  424.     this->_m[3][3] = tmp._m[3][3];
  425. }
  426.  
  427. Matrix4 Matrix4::inverseOrtho() const {
  428.     Matrix4 a;
  429.  
  430.     for (int i = 0; i < 3; i++) {
  431.         for (int j = 0; j < 3; j++) {
  432.             a._m[i][j] = this->_m[j][i];
  433.         }
  434.     }
  435.     a._m[3][0] = 0.0f;
  436.     a._m[3][1] = 0.0f;
  437.     a._m[3][2] = 0.0f;
  438.     a._m[3][3] = 1.0f;
  439.  
  440.     for (int i = 0; i < 3; i++) {
  441.         float s = 0;
  442.         for (int j = 0; j < 3; j++) {
  443.             s -= this->_m[j][i] * this->_m[j][3];
  444.         }
  445.         a._m[i][3] = s;
  446.     }
  447.  
  448.     return a;
  449. }
  450.  
  451. Matrix4 Matrix4::inverse() const {
  452.     Matrix4 result = *this;
  453.     MatrixInverse((float *)result._m);
  454.  
  455.     return result;
  456. }
  457.  
  458. void Matrix4::rotation(float t, int u) {
  459.     float s, c;
  460.     int v, w;
  461.  
  462.     identity();
  463.  
  464.     if ((v = u + 1) > 2)
  465.         v = 0;
  466.     if ((w = v + 1) > 2)
  467.         w = 0;
  468.     s = sin(t);
  469.     c = cos(t);
  470.     _m[v][v] = c;
  471.     _m[v][w] = -s;
  472.     _m[w][v] = s;
  473.     _m[w][w] = c;
  474. }
  475.  
  476. bool Matrix4::isIdentity() const {
  477.     //NOTE: This might need to be implemented in a fault-tolerant way.
  478.     for (int i = 0; i < 4; i++) {
  479.         for (int j = 0; j < 4; j++) {
  480.             if (i == j) {
  481.                 if (_m[i][j] != 1.0) {
  482.                     return false;
  483.                 }
  484.             } else if (_m[i][j] != 0.0) {
  485.                 return false;
  486.             }
  487.         }
  488.     }
  489.     return true;
  490. }
  491.  
  492. void Matrix4::invert() {
  493.     MatrixInverse((float *)this->_m);
  494. }
  495.  
  496. Matrix4 Matrix4::frustum(float left, float right, float bottom, float top, float nearp, float farp) {
  497.     float x, y, A, B, C, D;
  498.  
  499.     x = (float)((2.0 * nearp) / (right - left));
  500.     y = (float)((2.0 * nearp) / (top - bottom));
  501.     A = (right + left) / (right - left);
  502.     B = (top + bottom) / (top - bottom);
  503.     C = -(farp + nearp) / (farp - nearp);
  504.     D = (float)(-(2.0 * farp * nearp) / (farp - nearp));
  505.  
  506.     Matrix4 m;
  507.  
  508.     m._m[0][0] = x; m._m[0][1] = 0; m._m[0][2] = A; m._m[0][3] = 0;
  509.     m._m[1][0] = 0; m._m[1][1] = y; m._m[1][2] = B; m._m[1][3] = 0;
  510.     m._m[2][0] = 0; m._m[2][1] = 0; m._m[2][2] = C; m._m[2][3] = D;
  511.     m._m[3][0] = 0; m._m[3][1] = 0; m._m[3][2] = -1; m._m[3][3] = 0;
  512.  
  513.     return m;
  514. }
  515.  
  516. void Matrix4::translate(float x, float y, float z) {
  517.     _m[0][3] += _m[0][0] * x + _m[0][1] * y + _m[0][2] * z;
  518.     _m[1][3] += _m[1][0] * x + _m[1][1] * y + _m[1][2] * z;
  519.     _m[2][3] += _m[2][0] * x + _m[2][1] * y + _m[2][2] * z;
  520.     _m[3][3] += _m[3][0] * x + _m[3][1] * y + _m[3][2] * z;
  521. }
  522.  
  523. void Matrix4::scale(float x, float y, float z) {
  524.     _m[0][0] *= x; _m[0][1] *= y; _m[0][2] *= z;
  525.     _m[1][0] *= x; _m[1][1] *= y; _m[1][2] *= z;
  526.     _m[2][0] *= x; _m[2][1] *= y; _m[2][2] *= z;
  527.     _m[3][0] *= x; _m[3][1] *= y; _m[3][2] *= z;
  528. }
  529.  
  530.  
  531.  
  532.  
  533. /*void gl_print_matrix(const float *m) {
  534.     for (int i = 0; i < 4; i++) {
  535.         fprintf(stderr, "%f\t%f\t%f\t%f\n", m[12+i], m[8+i], m[4+i], m[i]);
  536.     }
  537.     fprintf(stderr, "\n");
  538. }*/
  539. void gl_print_matrix(const float *m) {
  540.     for (int i = 0; i < 16; i+=4) {
  541.         fprintf(stderr, "%f\t%f\t%f\t%f\n", m[i], m[1+i], m[2+i], m[3+i]);
  542.     }
  543.     fprintf(stderr, "\n");
  544. }
  545.  
  546. void glopLoadMatrix(float *q, Matrix4 *m) {
  547.  
  548.     for (int i = 0; i < 4; i++) {
  549.         m->_m[0][i] = q[0];
  550.         m->_m[1][i] = q[1];
  551.         m->_m[2][i] = q[2];
  552.         m->_m[3][i] = q[3];
  553.         q += 4;
  554.     }
  555. }
  556.  
  557. void glopRotate(float *u, Matrix4 *w, float angle) {
  558.     Matrix4 m;
  559.     int dir_code;
  560.  
  561.     angle = (float)(angle * (float)M_PI / 180.0);
  562.  
  563.     // simple case detection
  564.     dir_code = ((u[0] != 0) << 2) | ((u[1] != 0) << 1) | (u[2] != 0);
  565.  
  566.     switch (dir_code) {
  567.     case 0:
  568.         m.identity();
  569.         break;
  570.     case 4:
  571.         if (u[0] < 0) angle = -angle;
  572.         m.rotation(angle, 0);
  573.         break;
  574.     case 2:
  575.         if (u[1] < 0) angle = -angle;
  576.         m.rotation(angle, 1);
  577.         break;
  578.     case 1:
  579.         if (u[2] < 0) angle = -angle;
  580.         m.rotation(angle, 2);
  581.         break;
  582.     default: {
  583.         float cost, sint;
  584.  
  585.         // normalize vector
  586.         float len = u[0] * u[0] + u[1] * u[1] + u[2] * u[2];
  587.         if (len == 0.0f)
  588.             return;
  589.         len = 1.0f / sqrt(len);
  590.         u[0] *= len;
  591.         u[1] *= len;
  592.         u[2] *= len;
  593.  
  594.         // store cos and sin values
  595.         cost = cos(angle);
  596.         sint = sin(angle);
  597.  
  598.         // fill in the values
  599.         m._m[3][0] = 0.0f;
  600.         m._m[3][2] = 0.0f;
  601.         m._m[0][3] = 0.0f;
  602.         m._m[1][3] = 0.0f;
  603.         m._m[2][3] = 0.0f;
  604.         m._m[3][3] = 1.0f;
  605.  
  606.         // do the math
  607.         m._m[0][0] = u[0] * u[0] * (1 - cost) + cost;
  608.         m._m[1][0] = u[1] * u[0] * (1 - cost) - u[2] * sint;
  609.         m._m[2][0] = u[2] * u[0] * (1 - cost) + u[1] * sint;
  610.         m._m[0][1] = u[0] * u[1] * (1 - cost) + u[2] * sint;
  611.         m._m[1][1] = u[1] * u[1] * (1 - cost) + cost;
  612.         m._m[2][1] = u[2] * u[1] * (1 - cost) - u[0] * sint;
  613.         m._m[0][2] = u[0] * u[2] * (1 - cost) - u[1] * sint;
  614.         m._m[1][2] = u[1] * u[2] * (1 - cost) + u[0] * sint;
  615.         m._m[2][2] = u[2] * u[2] * (1 - cost) + cost;
  616.     }
  617.     }
  618.    
  619.     //gl_print_matrix(*m._m);
  620.     *w *= m;
  621. }
  622.  
  623. int main() {
  624.     float f[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
  625.     Matrix4 mtx;
  626.     glopLoadMatrix(f, &mtx);
  627.     gl_print_matrix(*mtx._m);
  628.    
  629.     Matrix4 mtx2 = mtx.getCopy();
  630.     mtx2.translate(10,20,30);
  631.     gl_print_matrix(*mtx2._m);
  632.    
  633.     Matrix4 mtx3 = mtx.getCopy();
  634.     mtx3.scale(10,20,30);
  635.     gl_print_matrix(*mtx3._m);
  636.    
  637.     /*Matrix4 mtx4 = mtx.getCopy();
  638.     int derp = MatrixInverse(*mtx4._m);
  639.     fprintf(stderr, "%i\n", derp);
  640.     if (derp !=0.f) gl_print_matrix(*mtx4._m);*/
  641.    
  642.     Matrix4 mtx5 = mtx.getCopy();
  643.     float vec[3] = {0.5,0.8,1};
  644.     glopRotate(vec, &mtx5, 30);
  645.     gl_print_matrix(*mtx5._m);
  646.    
  647.     Matrix4 mtx6 = mtx.getCopy();
  648.     float vec2[3] = {0,0,1};
  649.     glopRotate(vec2, &mtx6, 30);
  650.     gl_print_matrix(*mtx6._m);
  651.    
  652.    
  653.     return 0;
  654.    
  655. }
Advertisement
Add Comment
Please, Sign In to add comment