Guest User

Untitled

a guest
Oct 22nd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. void OpenGLManager::RenderScene()
  2. {
  3. // Testing testing
  4. ALLEGRO_BITMAP *rBitmap = GlobalVariable::SharedGlobalVariable()->mBitmapLibrary->GetBitmap("WoodCorner");
  5. if(!rBitmap)
  6. {
  7. fprintf(stderr, "Rendering failed, couldn't find Grass\n");
  8. return;
  9. }
  10.  
  11. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  12. glBindTexture(GL_TEXTURE_2D, al_get_opengl_texture(rBitmap));
  13. glEnable(GL_TEXTURE_2D);
  14.  
  15. //Set up perspective projection
  16. glMatrixMode(GL_PROJECTION);
  17. glPushMatrix();
  18. glLoadIdentity();
  19.  
  20.  
  21. SetPerspective(45.0f, (GLfloat)800.0 / (GLfloat)600.0, 0.1f, 100.0f);
  22.  
  23. // Do your 3D stuff
  24. glMatrixMode(GL_MODELVIEW);
  25. glLoadIdentity();
  26.  
  27. glTranslatef(0, 0, 0);
  28. //glRotatef(mCounter*36, 1, 1, 1);
  29. glBegin(GL_QUADS);
  30. glTexCoord2f(0, 0); glVertex3f(-10, -10, 0);
  31. glTexCoord2f(1, 0); glVertex3f(+10, -10, 0);
  32. glTexCoord2f(1, 1); glVertex3f(+10, +10, 0);
  33. glTexCoord2f(0, 1); glVertex3f(-10, +10, 0);
  34. glEnd();
  35.  
  36. glMatrixMode(GL_PROJECTION);
  37. glPopMatrix();
  38. glMatrixMode(GL_MODELVIEW);
  39. glLoadIdentity();
  40.  
  41. }
Add Comment
Please, Sign In to add comment