The_Typholorian

stack overflow post support code

Apr 27th, 2024
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1.     glClearColor(1, 0, 0, 1);
  2.  
  3.     glClear(GL_COLOR_BUFFER_BIT);
  4.  
  5.     SwapBuffers(hdc);
  6.  
  7.     long width = drawArea.right - drawArea.left, height = drawArea.bottom - drawArea.top;
  8.  
  9.     PAINTSTRUCT ps;
  10.     HDC hdc = BeginPaint(hwnd, &ps);
  11.  
  12.     HDC memDC = CreateCompatibleDC(hdc);
  13.  
  14.     BITMAPINFO bmi = { 0 };
  15.     bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
  16.     bmi.bmiHeader.biWidth = width;
  17.     bmi.bmiHeader.biHeight = -height;
  18.     bmi.bmiHeader.biPlanes = 1;
  19.     bmi.bmiHeader.biBitCount = 32; // ARGB
  20.     bmi.bmiHeader.biCompression = BI_RGB;
  21.  
  22.     HBITMAP hbitmap = CreateDIBitmap(hdc, &bmi.bmiHeader, CBM_INIT, content, &bmi, DIB_RGB_COLORS);
  23.  
  24.     HBITMAP oldBitmap = (HBITMAP)SelectObject(memDC, hbitmap);
  25.  
  26.     BitBlt(hdc, drawArea.left, drawArea.top, width, height, memDC, 0, 0, SRCCOPY);
  27.  
  28.     //TransparentBlt(hdc, drawArea.left, drawArea.top, width, height, memDC, 0, 0, width, height, RGB(0, 0, 0));
  29.  
  30.     SelectObject(memDC, oldBitmap);
  31.  
  32.     DeleteDC(memDC);
  33.  
  34.     EndPaint(hwnd, &ps);
Advertisement
Add Comment
Please, Sign In to add comment