theApp.m_pMainWnd->ReleaseDC(dc);
void OpenGLDisplay::render(){  int pitch = theApp.filterWidth * 4 + 4;  u8 *data = pix + (theApp.sizeX+1)*4;    if(theApp.filterFunction) {    data = filterData;    theApp.filterFunction(pix+pitch,                          pitch,                          (u8*)theApp.delta,                          (u8*)filterData,                          theApp.filterWidth*4*2,                          theApp.filterWidth,                          theApp.filterHeight);  }  if(theApp.videoOption > VIDEO_4X && theApp.showSpeed) {    char buffer[30];    if(theApp.showSpeed == 1)      sprintf(buffer, "%3d%%", systemSpeed);    else      sprintf(buffer, "%3d%%(%d, %d fps)", systemSpeed,              systemFrameSkip,              theApp.showRenderedFrames);    if(theApp.filterFunction) {      int p = theApp.filterWidth * 4;      if(systemColorDepth == 24)        p = theApp.filterWidth * 6;      else if(systemColorDepth == 32)        p = theApp.filterWidth * 8;      if(theApp.showSpeedTransparent)        drawTextTransp((u8*)filterData,                       p,                       10,                       theApp.filterHeight*2-10,                       buffer);      else        drawText((u8*)filterData,                 p,                 10,                 theApp.filterHeight*2-10,                 buffer);          } else {      if(theApp.showSpeedTransparent)        drawTextTransp((u8*)pix,                       pitch,                       10,                       theApp.filterHeight-10,                       buffer);      else        drawText((u8*)pix,                 pitch,                 10,                 theApp.filterHeight-10,                 buffer);    }  }    // Texturemap complete texture to surface so we have free scaling   // and antialiasing  int mult = 1;  if(theApp.filterFunction) {    glPixelStorei(GL_UNPACK_ROW_LENGTH, 2*theApp.sizeX);    mult = 2;  } else {    glPixelStorei(GL_UNPACK_ROW_LENGTH, theApp.sizeX+1);  }  glTexSubImage2D( GL_TEXTURE_2D,0,                   0,0, mult*theApp.sizeX,mult*theApp.sizeY,                   GL_RGBA,GL_UNSIGNED_BYTE,data);  if(theApp.glType == 0) {    glBegin(GL_TRIANGLE_STRIP);    glTexCoord2f(0.0, 0.0); glVertex3i(0, 0, 0);    glTexCoord2f(mult*theApp.sizeX/size, 0.0); glVertex3i(theApp.surfaceSizeX, 0, 0);    glTexCoord2f(0.0, mult*theApp.sizeY/size); glVertex3i(0, theApp.surfaceSizeY, 0);    glTexCoord2f(mult*theApp.sizeX/size, mult*theApp.sizeY/size); glVertex3i(theApp.surfaceSizeX, theApp.surfaceSizeY, 0);    glEnd();  } else {    glBegin(GL_QUADS);    glTexCoord2f(0.0, 0.0); glVertex3i(0, 0, 0);    glTexCoord2f(mult*theApp.sizeX/size, 0.0); glVertex3i(theApp.surfaceSizeX, 0, 0);    glTexCoord2f(mult*theApp.sizeX/size, mult*theApp.sizeY/size); glVertex3i(theApp.surfaceSizeX, theApp.surfaceSizeY, 0);    glTexCoord2f(0.0, mult*theApp.sizeY/size); glVertex3i(0, theApp.surfaceSizeY, 0);    glEnd();  }  CDC *dc = theApp.m_pMainWnd->GetDC();  if(theApp.screenMessage) {    if(((GetTickCount() - theApp.screenMessageTime) < 3000) &&       !theApp.disableStatusMessage) {      dc->SetTextColor(RGB(255,0,0));      dc->SetBkMode(TRANSPARENT);      dc->TextOut(10, theApp.surfaceSizeY - 20, theApp.screenMessageBuffer);    } else {      theApp.screenMessage = false;    }  }      SwapBuffers(dc->GetSafeHdc());}