FirstRanker Logo

FirstRanker.com - FirstRanker's Choice is a hub of Question Papers & Study Materials for B-Tech, B.E, M-Tech, MCA, M.Sc, MBBS, BDS, MBA, B.Sc, Degree, B.Sc Nursing, B-Pharmacy, D-Pharmacy, MD, Medical, Dental, Engineering students. All services of FirstRanker.com are FREE

📱

Get the MBBS Question Bank Android App

Access previous years' papers, solved question papers, notes, and more on the go!

Install From Play Store

Download OU BE (B-Tech) CSE Mini Projects Code Programs on Transformations

Download OU (Osmania University)BE (B-Tech) (Bachelor of Engineering) CSE Best Practicle Programs And Code Programs on Transformations

This post was last modified on 27 January 2020

AKTU B-Tech Last 10 Years 2010-2020 Previous Question Papers || Dr. A.P.J. Abdul Kalam Technical University


FirstRanker.com

Programs on Transformations

  /* Translation transformation to move an object along x-axis */ #include<GL/glut.h> void display() { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_QUADS); glVertex2f(1.0,1.0); glVertex2f(3.0,1.0); glVertex2f(3.0,4.0); glVertex2f(1.0,4.0); glEnd(); glFlush(); } void init() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0,12,0.0,7); } void timer(int n) { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(5.0,0.0,0.0); glutPostRedisplay(); glutTimerFunc(1000,timer,n); // to have some delay } int main(int argc, char** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE); glutInitWindowPosition(200,200); glutInitWindowSize(300,300); glutCreateWindow("Translation"); init(); glutDisplayFunc(display); glutTimerFunc(1000,timer,10); // callback to timer function glutMainLoop(); }  
  /* Rotation transformation to roatate an object about z-axis wrt to origin */ #include<GL/glut.h> void polygon() { glBegin(GL_POLYGON); glColor3f(0.0,0.0,0.0); glVertex2f(1.0,1.0); glVertex2f(4.0,1.0); glVertex2f(4.0,4.0); glVertex2f(1.0,4.0); glEnd(); } void display() { glClearColor(1.0f, 1.0f,1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); polygon(); glFlush(); } void timer(int n) { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //glTranslatef(2.0,2.0,0.0); glRotatef(45.0,0.0,0.0,1.0); //glTranslatef(-2.0,-2.0,0.0); polygon(); glutPostRedisplay(); glutTimerFunc(1000,timer,n); } void init() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(-6,6,-6,6); } int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE); glutInitWindowPosition(100,100); glutInitWindowSize(300,300); glutCreateWindow("Rotation"); init(); glutDisplayFunc(display); glutTimerFunc(1000,timer,10); glutMainLoop(); }  
  /* Scaling tranformation */ #include<GL/glut.h> void display() { glClearColor(1.0f,1.0f,1.0f,1.0f); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POLYGON); glColor3f(0.0,0.0,0.0); glVertex2f(1.0,1.0); glVertex2f(4.0,1.0); glVertex2f(4.0,4.0); glVertex2f(1.0,4.0); glEnd(); glFlush(); } void timer(int n) { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glScalef(0.5,0.5,0.5); glutPostRedisplay(); glutTimerFunc(1000,timer,n); } void init() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(-6,6,-6,6); } int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE); glutInitWindowPosition(100,100); glutInitWindowSize(300,300); glutCreateWindow("Scaling"); init(); glutDisplayFunc(display); glutTimerFunc(1000,timer,10); glutMainLoop(); }  

--- Content provided by‌ FirstRanker.com ---


This download link is referred from the post: AKTU B-Tech Last 10 Years 2010-2020 Previous Question Papers || Dr. A.P.J. Abdul Kalam Technical University