Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#ActualBlind1992

Posted 11 October 2013 - 02:25 PM

.

#4Blind1992

Posted 11 October 2013 - 08:30 AM

Hello, I've been working on a simple program in OpenGL in which I attempt to impliment rotation using a rotation matrix, rather than 'glRotatef'. I've come into an issue where I've applied a transformation to my transform matrix (created using my matrix class) however rather than doing any form of rotation it simply seems to scale the objects on screen along the Y axis. Can anyone suggest what I've been doing wrong?/

P.S I've made rotation work using arrays and GLrotatef, I simply want to impliment a more complex form of rotation, using my matrix class.
 
//The matrix I apply my transformations too (a lot of floats). (Sorry for the silly variable names, my matrix //class is old.

Matrix CameraMatrix1(1,0,0,0,           //X,XX,XXX,XXXX
                                 0,1,0,0, //Y,YY,YYY,YYYY             
                                0,0,1,0,   //Z,ZZ,ZZZ,ZZZZ           
                                 0,0,-20,1); //W,WW,WWW,WWWW


//Where 'y' is the Angle (transformed into radians) that I wish to rotate by on the Y axis.
CameraMatrix1.x = CameraMatrix1.x * cos(y);
CameraMatrix1.xx = CameraMatrix1.xx * 0;
CameraMatrix1.xxx = CameraMatrix1.xxx * -sin(y);

CameraMatrix1.y = CameraMatrix1.y * 0;
CameraMatrix1.yy = CameraMatrix1.yy * 1;
CameraMatrix1.yyy = CameraMatrix1.yyy * 0;

CameraMatrix1.z = CameraMatrix1.z * sin(y);
CameraMatrix1.zz = CameraMatrix1.zz * 0;
CameraMatrix1.zzz = CameraMatrix1.zzz * cos(y);

//This is the code I call when I'm trying to apply my transformation. Its simply Multiplying the current //transformation matrix by the values stated on most guides regarding rotation matrices.

If this dosen't make sence I can upload more of my code but I hope this is enough to show people where I'm going wrong.

#3Blind1992

Posted 11 October 2013 - 05:58 AM

Hello, I've been working on a simple program in OpenGL in which I attempt to impliment rotation using a rotation matrix, rather than 'glRotatef'. I've come into an issue where I've applied a transformation to my transform matrix (created using my matrix class) however rather than doing any form of rotation it simply seems to scale the objects on screen along the Y axis. Can anyone suggest what I've been doing wrong?/

P.S I've made rotation work using arrays and GLrotatef, I simply want to impliment a more complex form of rotation, using my matrix class.
 
//The matrix I apply my transformations too (a lot of floats). (Sorry for the silly variable names, my matrix //class is old.

Matrix CameraMatrix1(1,0,0,0,           //X,XX,XXX,XXXX
                                 0,1,0,0, //Y,YY,YYY,YYYY             
                                0,0,1,0,   //Z,ZZ,ZZZ,ZZZZ           
                                 0,0,-20,1); //W,WW,WWW,WWWW


//Where 'y' is the Angle (transformed into radians) that I wish to rotate by on the Y axis.
CameraMatrix1.x = CameraMatrix1.x * cos(y);
CameraMatrix1.xx = CameraMatrix1.xx * 0;
CameraMatrix1.xxx = CameraMatrix1.xxx * -sin(y);

CameraMatrix1.y = CameraMatrix1.y * 0;
CameraMatrix1.yy = CameraMatrix1.yy * 1;
CameraMatrix1.yyy = CameraMatrix1.yyy * 0;

CameraMatrix1.z = CameraMatrix1.z * sin(y);
CameraMatrix1.zz = CameraMatrix1.zz * 0;
CameraMatrix1.zzz = CameraMatrix1.zzz * cos(y);

//This is the code I call when I'm trying to apply my transformation. Its simply Multiplying the current //transformation matrix by the values stated on most guides regarding rotation matrices.

If this dosen't make sence I can upload more of my code but I hope this is enough to show people where I'm going wrong.

NOTE: http://pastebin.com/VZ03aeKN, pastebin to my complete camera class, partly based off of http://www.flipcode.com/archives/OpenGL_Camera.shtml.

#2Blind1992

Posted 11 October 2013 - 05:55 AM

Hello, I've been working on a simple program in OpenGL in which I attempt to impliment rotation using a rotation matrix, rather than 'glRotatef'. I've come into an issue where I've applied a transformation to my transform matrix (created using my matrix class) however rather than doing any form of rotation it simply seems to scale the objects on screen along the Y axis. Can anyone suggest what I've been doing wrong?/

P.S I've made rotation work using arrays and GLrotatef, I simply want to impliment a more complex form of rotation, using my matrix class.
 
//The matrix I apply my transformations too (a lot of floats). (Sorry for the silly variable names, my matrix //class is old.

Matrix CameraMatrix1(1,0,0,0,           //X,XX,XXX,XXXX
                                 0,1,0,0, //Y,YY,YYY,YYYY             
                                0,0,1,0,   //Z,ZZ,ZZZ,ZZZZ           
                                 0,0,-20,1); //W,WW,WWW,WWWW


//Where 'y' is the Angle, transformed into radians I wish to rotate by on the Y axis.
CameraMatrix1.x = CameraMatrix1.x * cos(y);
CameraMatrix1.xx = CameraMatrix1.xx * 0;
CameraMatrix1.xxx = CameraMatrix1.xxx * -sin(y);

CameraMatrix1.y = CameraMatrix1.y * 0;
CameraMatrix1.yy = CameraMatrix1.yy * 1;
CameraMatrix1.yyy = CameraMatrix1.yyy * 0;

CameraMatrix1.z = CameraMatrix1.z * sin(y);
CameraMatrix1.zz = CameraMatrix1.zz * 0;
CameraMatrix1.zzz = CameraMatrix1.zzz * cos(y);

//This is the code I call when I'm trying to apply my transformation. Its simply Multiplying the current //transformation matrix by the values stated on most guides regarding rotation matrices.

If this dosen't make sence I can upload more of my code but I hope this is enough to show people where I'm going wrong.

NOTE: http://pastebin.com/VZ03aeKN, pastebin to my complete camera class, partly based off of http://www.flipcode.com/archives/OpenGL_Camera.shtml.

#1Blind1992

Posted 11 October 2013 - 05:55 AM

Hello, I've been working on a simple program in OpenGL in which I attempt to impliment rotation using a rotation matrix, rather than 'glRotatef'. I've come into an issue where I've applied a transformation to my transform matrix (created using my matrix class) however rather than doing any form of rotation it simply seems to scale the objects on screen along the Y axis. Can anyone suggest what I've been doing wrong?/

P.S I've made rotation work using arrays and GLrotatef, I simply want to impliment a more complex form of rotation, using my matrix class.
 
//The matrix I apply my transformations too (a lot of floats). (Sorry for the silly variable names, my matrix //class is old.

Matrix CameraMatrix1(1,0,0,0,          //X,XX,XXX,XXXX
                                 0,1,0,0, //Y,YY,YYY,YYYY             
                                0,0,1,0,   //Z,ZZ,ZZZ,ZZZZ           
                                 0,0,-20,1); //W,WW,WWW,WWWW


//Where 'y' is the Angle, transformed into radians I wish to rotate by on the Y axis.
CameraMatrix1.x = CameraMatrix1.x * cos(y);
CameraMatrix1.xx = CameraMatrix1.xx * 0;
CameraMatrix1.xxx = CameraMatrix1.xxx * -sin(y);

CameraMatrix1.y = CameraMatrix1.y * 0;
CameraMatrix1.yy = CameraMatrix1.yy * 1;
CameraMatrix1.yyy = CameraMatrix1.yyy * 0;

CameraMatrix1.z = CameraMatrix1.z * sin(y);
CameraMatrix1.zz = CameraMatrix1.zz * 0;
CameraMatrix1.zzz = CameraMatrix1.zzz * cos(y);

//This is the code I call when I'm trying to apply my transformation. Its simply Multiplying the current //transformation matrix by the values stated on most guides regarding rotation matrices.

If this dosen't make sence I can upload more of my code but I hope this is enough to show people where I'm going wrong.

NOTE: http://pastebin.com/VZ03aeKN, pastebin to my complete camera class, partly based off of http://www.flipcode.com/archives/OpenGL_Camera.shtml.

PARTNERS