Hello just wanted to know the simplest and most efficient way to normalize
a value of screen width in this case
GLfloat WIN_W = 640.0f;
and screen height in this case
GLfloat WIN_H = 480.0f
to a range of [-1.0,1.0].
I want or would like this GLfloat value between the range of [-1.0,1.0] please
for use in OpenGL modelveiw matrix translation column
as the centering value for my 2D Shapes modelview matrix like so:
1 2 3 4 5 6
|
std::vector<GLfloat> modelviewmatrix[] ={
xx,yx,zx,centerx //<- centering x with normalized [-1.0,1.0] GLfloat
xy,yy,zy,centery //<- centering y with normalized [-1.0,1.0] GLfloat
xz,yz,zz,tz,
xw,yw,zw,tw
};
|
If you could tell me where you learn this if you know how
Id greatly appreciate that too so I can study the hell out of it thanks.
I should also note that I tried
1 2
|
GLfloat centerx = WIN_H/WIN_H;
GLfloat centery = WIN_W/WIN_W;
|
However that did not center the 2D shape it instead
moved it about -5 units too the top right how flustering.