Начинающий
Начинающий
- Статус
- Оффлайн
- Регистрация
- 15 Дек 2024
- Сообщения
- 77
- Реакции
- 0
рендерю текст-прямоугольники и тд через wglswapBuffers и они не отображаются
renderOverlay:
void RenderOverlay(HDC hdc) {
static int frameCount = 0;
frameCount++;
if (!hdc) return;
int savedDC = SaveDC(hdc);
SetBkMode(hdc, TRANSPARENT);
SetROP2(hdc, R2_COPYPEN);
int x = 20;
int y = 20;
int width = 200;
int height = 100;
int radius = 15;
HBRUSH redBrush = CreateSolidBrush(RGB(255, 0, 0));
HPEN redPen = CreatePen(PS_SOLID, 2, RGB(255, 0, 0));
HBRUSH oldBrush = (HBRUSH)SelectObject(hdc, redBrush);
HPEN oldPen = (HPEN)SelectObject(hdc, redPen);
RoundRect(hdc, x, y, x + width, y + height, radius * 2, radius * 2);
SelectObject(hdc, oldPen);
SelectObject(hdc, oldBrush);
DeleteObject(redPen);
DeleteObject(redBrush);
RestoreDC(hdc, savedDC);
}
wglSwapBuffers:
BOOL WINAPI hkwglSwapBuffers(HDC hdc) {
static int hookCallCount = 0;
hookCallCount++;
BOOL result = FALSE;
__try {
result = owglSwapBuffers(hdc);
}
__try {
if (hdc) {
HWND currentHwnd = WindowFromDC(hdc);
RenderOverlay(hdc);
}
return result;
}