Alright so I'm confusing myself with Matrices at the moment and I'm not to sure if what I'm doing is right.
Anyway what I want to do is fill a 3x3 Matrix with data the holds the position of a texture its rotation
and it's scale.
So lets say I want to rotate my Texture 45 degrees and scale it 0.5 on both the x and y.
So i do all the matrix function I made to my matrix which starts off as
1 2 3
|
1, 0, 0 //11, 21, 32 Representing the matrices positions
0, 1, 0 //12, 22, 32
0, 0, 1 //13, 32, 33
| |
Now I use my functions:
Give a position of 10x, 15y
Output:
1 2 3
|
1, 0, 0
0, 1, 0
10, 15, 1
| |
Scale(0.5)
Output:
1 2 3
|
0.5, 0.0, 0.0
0.0, 0.5, 0.0
10, 15, 1
| |
Rotate(45)
Output: [Fully Transformed]
1 2 3
|
0.353, 0.353, 0.0
-0.353, 0.353, 0.0
10.0, 15.0 1.0
| |
Now this isn't my actual function but this is the output I'm getting. So now my problem is:
This matrix is meant to be for displaying a 2d texture to the screen with openGL.
So somehow I gather I'm meant to pull out the co-ords for each vertex / position(?) in the quad in openGL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
glBindTexture(GL_TEXTURE_2D, image);
glBegin(GL_QUADS);
glTexCoord2f(0,0);
glVertex2i();
glTexCoord2f(1,0);
glVertex2i();
glTexCoord2f(1,1);
glVertex2i();
glTexCoord2f(0,1);
glVertex2i();
glEnd();
| |
I know how to just display a normal texture like this in openGL but I don't know how I put the values from my Matrix into the glVertex2i(,).
Reason I'm doing this is so I can scale / rotate the texture and it's also for some work I'm doing. I'm just struggling to understand how to insert my matrix into something like this.
Thanks Guys.