SHARE
TWEET

Untitled

a guest Jun 19th, 2017 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     void BasicWindow::flip()
  2.     {
  3.         HDC oldDC = wglGetCurrentDC();
  4.         HGLRC oldRC = wglGetCurrentContext();
  5.  
  6.         wglMakeCurrent(hDC, hRC);
  7.  
  8.         glLoadIdentity();
  9.  
  10.         glBindTexture(GL_TEXTURE_2D, texture);
  11.  
  12.         glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
  13.         glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
  14.  
  15.         glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getWidth(), getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, getData());
  16.  
  17.         glBegin(GL_QUADS);
  18.             glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 0.0f);
  19.             glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 0.0f);
  20.             glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,-1.0f, 0.0f);
  21.             glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f, 0.0f);
  22.         glEnd();
  23.  
  24.         SwapBuffers(hDC);
  25.  
  26.         wglMakeCurrent(oldDC, oldRC);
  27.     }
RAW Paste Data
Top