Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, texture.getIndex()); //bind textura la acel ID
- glLoadIdentity();
- //Translate - rotate - scale
- glTranslatef(pos.x, pos.y, 0);
- glRotatef(rotatie, 0, 0, 1);
- glScalef(scale.x, scale.y, 1);
- glColor4f(1, 1, 1, 1); //pentru ca avem si alpha
- glBegin(GL_QUADS);
- glTexCoord2f(0, 0);
- glVertex2i(-texture.getLatime() / 2, -texture.getInaltime() / 2); //colt stanga jos 0, 0 coord
- glTexCoord2f(1, 0);
- glVertex2i(texture.getLatime() / 2, -texture.getInaltime() / 2); //colt stanga jos 0, 0 coord
- glTexCoord2f(1, 1);
- glVertex2i(texture.getLatime() / 2, texture.getInaltime() / 2); //colt stanga jos 0, 0 coord
- glTexCoord2f(0, 1);
- glVertex2i(-texture.getLatime()/ 2 , texture.getInaltime() / 2);
- glBegin(GL_LINES); //desenam limitele pt corpul fizic care vor delimita fizic de alt gen de obiecte din scena
- glVertex2i((int)-(size->x) / 2, (int)-(size->y) / 2); //colt stanga jos 0, 0 coord
- glVertex2i((int)size->x / 2, (int)-size->y / 2);
- glVertex2i((int)size->x / 2, (int)-size->y / 2);
- glVertex2i((int)size->x / 2, (int)size->y / 2);
- glVertex2i((int)size->x / 2, (int)size->y / 2);
- glVertex2i((int)-size->x / 2, (int)size->y / 2);
- glVertex2i((int)-size->x / 2, (int)size->y / 2);
- glVertex2i((int)-(size->x) / 2, (int)-(size->y) / 2);
- glEnd();
Add Comment
Please, Sign In to add comment