Alex9090

Untitled

Apr 10th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. glEnable(GL_TEXTURE_2D);
  2.     glBindTexture(GL_TEXTURE_2D, texture.getIndex()); //bind textura la acel ID
  3.     glLoadIdentity();
  4.     //Translate - rotate - scale
  5.  
  6.     glTranslatef(pos.x, pos.y, 0);
  7.     glRotatef(rotatie, 0, 0, 1);
  8.     glScalef(scale.x, scale.y, 1);
  9.  
  10.  
  11. glColor4f(1, 1, 1, 1); //pentru ca avem si alpha
  12.     glBegin(GL_QUADS);
  13.  
  14.     glTexCoord2f(0, 0);
  15.     glVertex2i(-texture.getLatime() / 2, -texture.getInaltime() / 2); //colt stanga jos 0, 0 coord
  16.  
  17.     glTexCoord2f(1, 0);
  18.     glVertex2i(texture.getLatime() / 2, -texture.getInaltime() / 2); //colt stanga jos 0, 0 coord
  19.  
  20.     glTexCoord2f(1, 1);
  21.     glVertex2i(texture.getLatime() / 2, texture.getInaltime() / 2); //colt stanga jos 0, 0 coord
  22.  
  23.     glTexCoord2f(0, 1);
  24.     glVertex2i(-texture.getLatime()/ 2 , texture.getInaltime() / 2);
  25.  
  26.     glBegin(GL_LINES); //desenam limitele pt corpul fizic care vor delimita fizic de alt gen de obiecte din scena
  27.  
  28.         glVertex2i((int)-(size->x) / 2, (int)-(size->y) / 2); //colt stanga jos 0, 0 coord
  29.         glVertex2i((int)size->x / 2, (int)-size->y / 2);
  30.    
  31.         glVertex2i((int)size->x / 2, (int)-size->y / 2);
  32.         glVertex2i((int)size->x / 2, (int)size->y / 2);
  33.  
  34.         glVertex2i((int)size->x / 2, (int)size->y / 2);
  35.         glVertex2i((int)-size->x / 2, (int)size->y / 2);
  36.  
  37.         glVertex2i((int)-size->x / 2, (int)size->y / 2);
  38.         glVertex2i((int)-(size->x) / 2, (int)-(size->y) / 2);
  39.  
  40.  
  41.         glEnd();
Add Comment
Please, Sign In to add comment