annotate src/win32/OpenGL.cpp @ 8:08a8e09ca414

add files required by automake
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:54:39 -0600
parents f9f4f1b99eed
children
rev   line source
rlm@1 1 #include "stdafx.h"
rlm@1 2 #include <gl/GL.h>
rlm@1 3
rlm@1 4 #include "resource.h"
rlm@1 5 #include "MainWnd.h"
rlm@1 6 #include "Reg.h"
rlm@1 7 #include "VBA.h"
rlm@1 8
rlm@1 9 #include "../gba/GBAGlobals.h"
rlm@1 10 #include "../gb/gbGlobals.h"
rlm@1 11 #include "../common/Text.h"
rlm@1 12 #include "../version.h"
rlm@1 13
rlm@1 14 #ifdef MMX
rlm@1 15 extern "C" bool cpu_mmx;
rlm@1 16
rlm@1 17 extern bool detectMMX();
rlm@1 18 #endif
rlm@1 19
rlm@1 20 extern int systemSpeed;
rlm@1 21 extern int Init_2xSaI(u32);
rlm@1 22 extern void winlog(const char *, ...);
rlm@1 23
rlm@1 24 class OpenGLDisplay : public IDisplay
rlm@1 25 {
rlm@1 26 private:
rlm@1 27 HDC hDC;
rlm@1 28 HGLRC hglrc;
rlm@1 29 GLuint texture;
rlm@1 30 int width;
rlm@1 31 int height;
rlm@1 32 float size;
rlm@1 33 u8 * filterData;
rlm@1 34 bool failed;
rlm@1 35
rlm@1 36 bool initializeTexture(int w, int h);
rlm@1 37 void updateFiltering(int);
rlm@1 38 public:
rlm@1 39 OpenGLDisplay();
rlm@1 40 virtual ~OpenGLDisplay();
rlm@1 41
rlm@1 42 virtual bool initialize();
rlm@1 43 virtual void cleanup();
rlm@1 44 virtual void render();
rlm@1 45 virtual void checkFullScreen();
rlm@1 46 virtual void renderMenu();
rlm@1 47 virtual void clear();
rlm@1 48 virtual bool changeRenderSize(int w, int h);
rlm@1 49 virtual void resize(int w, int h);
rlm@1 50 virtual DISPLAY_TYPE getType() { return OPENGL; };
rlm@1 51 virtual void setOption(const char *, int);
rlm@1 52 virtual int selectFullScreenMode(GUID * *);
rlm@1 53 };
rlm@1 54
rlm@1 55 OpenGLDisplay::OpenGLDisplay()
rlm@1 56 {
rlm@1 57 hDC = NULL;
rlm@1 58 hglrc = NULL;
rlm@1 59 texture = 0;
rlm@1 60 width = 0;
rlm@1 61 height = 0;
rlm@1 62 size = 0.0f;
rlm@1 63 filterData = (u8 *)malloc(4*16*256*256); // sufficient for 4x filters @ 32bit color depth
rlm@1 64 failed = false;
rlm@1 65 }
rlm@1 66
rlm@1 67 OpenGLDisplay::~OpenGLDisplay()
rlm@1 68 {
rlm@1 69 cleanup();
rlm@1 70 }
rlm@1 71
rlm@1 72 void OpenGLDisplay::cleanup()
rlm@1 73 {
rlm@1 74 if (texture != 0)
rlm@1 75 {
rlm@1 76 glDeleteTextures(1, &texture);
rlm@1 77 texture = 0;
rlm@1 78 }
rlm@1 79 if (hglrc != NULL)
rlm@1 80 {
rlm@1 81 wglDeleteContext(hglrc);
rlm@1 82 wglMakeCurrent(NULL, NULL);
rlm@1 83 hglrc = NULL;
rlm@1 84 }
rlm@1 85 if (hDC != NULL)
rlm@1 86 {
rlm@1 87 ReleaseDC(*theApp.m_pMainWnd, hDC);
rlm@1 88 hDC = NULL;
rlm@1 89 }
rlm@1 90 if (filterData)
rlm@1 91 {
rlm@1 92 free(filterData);
rlm@1 93 filterData = NULL;
rlm@1 94 }
rlm@1 95 width = 0;
rlm@1 96 height = 0;
rlm@1 97 size = 0.0f;
rlm@1 98 }
rlm@1 99
rlm@1 100 bool OpenGLDisplay::initialize()
rlm@1 101 {
rlm@1 102 CWnd *pWnd = theApp.m_pMainWnd;
rlm@1 103
rlm@1 104 theApp.mode320Available = false;
rlm@1 105 theApp.mode640Available = false;
rlm@1 106 theApp.mode800Available = false;
rlm@1 107
rlm@1 108 CDC *dc = pWnd->GetDC();
rlm@1 109 HDC hDC = dc->GetSafeHdc();
rlm@1 110
rlm@1 111 PIXELFORMATDESCRIPTOR pfd = {
rlm@1 112 sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
rlm@1 113 1, // version number
rlm@1 114 PFD_DRAW_TO_WINDOW | // support window
rlm@1 115 PFD_SUPPORT_OPENGL | // support OpenGL
rlm@1 116 PFD_DOUBLEBUFFER, // double buffered
rlm@1 117 PFD_TYPE_RGBA, // RGBA type
rlm@1 118 16, // 16-bit color depth
rlm@1 119 0, 0, 0, 0, 0, 0, // color bits ignored
rlm@1 120 0, // no alpha buffer
rlm@1 121 0, // shift bit ignored
rlm@1 122 0, // no accumulation buffer
rlm@1 123 0, 0, 0, 0, // accum bits ignored
rlm@1 124 32, // 32-bit z-buffer
rlm@1 125 0, // no stencil buffer
rlm@1 126 0, // no auxiliary buffer
rlm@1 127 PFD_MAIN_PLANE, // main layer
rlm@1 128 0, // reserved
rlm@1 129 0, 0, 0 // layer masks ignored
rlm@1 130 };
rlm@1 131 int iPixelFormat;
rlm@1 132
rlm@1 133 if (!(iPixelFormat = ChoosePixelFormat(hDC, &pfd)))
rlm@1 134 {
rlm@1 135 winlog("Failed ChoosePixelFormat\n");
rlm@1 136 return false;
rlm@1 137 }
rlm@1 138
rlm@1 139 // obtain detailed information about
rlm@1 140 // the device context's first pixel format
rlm@1 141 if (!(DescribePixelFormat(hDC, iPixelFormat,
rlm@1 142 sizeof(PIXELFORMATDESCRIPTOR), &pfd)))
rlm@1 143 {
rlm@1 144 winlog("Failed DescribePixelFormat\n");
rlm@1 145 return false;
rlm@1 146 }
rlm@1 147
rlm@1 148 if (!SetPixelFormat(hDC, iPixelFormat, &pfd))
rlm@1 149 {
rlm@1 150 winlog("Failed SetPixelFormat\n");
rlm@1 151 return false;
rlm@1 152 }
rlm@1 153
rlm@1 154 if (!(hglrc = wglCreateContext(hDC)))
rlm@1 155 {
rlm@1 156 winlog("Failed wglCreateContext\n");
rlm@1 157 return false;
rlm@1 158 }
rlm@1 159
rlm@1 160 if (!wglMakeCurrent(hDC, hglrc))
rlm@1 161 {
rlm@1 162 winlog("Failed wglMakeCurrent\n");
rlm@1 163 return false;
rlm@1 164 }
rlm@1 165 pWnd->ReleaseDC(dc);
rlm@1 166
rlm@1 167 // setup 2D gl environment
rlm@1 168 glPushAttrib(GL_ENABLE_BIT);
rlm@1 169 glDisable(GL_DEPTH_TEST);
rlm@1 170 glDisable(GL_CULL_FACE);
rlm@1 171 glEnable(GL_TEXTURE_2D);
rlm@1 172
rlm@1 173 glViewport(0, 0, theApp.surfaceSizeX, theApp.surfaceSizeY);
rlm@1 174
rlm@1 175 glMatrixMode(GL_PROJECTION);
rlm@1 176 glLoadIdentity();
rlm@1 177
rlm@1 178 glOrtho(0.0, (GLdouble)(theApp.surfaceSizeX), (GLdouble)(theApp.surfaceSizeY),
rlm@1 179 0.0, 0.0, 1.0);
rlm@1 180 glMatrixMode(GL_MODELVIEW);
rlm@1 181 glLoadIdentity();
rlm@1 182
rlm@1 183 systemRedShift = 3;
rlm@1 184 systemGreenShift = 11;
rlm@1 185 systemBlueShift = 19;
rlm@1 186 systemColorDepth = 32;
rlm@1 187 theApp.fsColorDepth = 32;
rlm@1 188
rlm@1 189 Init_2xSaI(32);
rlm@1 190 #ifdef MMX
rlm@1 191 if (!theApp.disableMMX)
rlm@1 192 cpu_mmx = theApp.detectMMX();
rlm@1 193 else
rlm@1 194 cpu_mmx = 0;
rlm@1 195 #endif
rlm@1 196
rlm@1 197 if (theApp.ddrawDebug)
rlm@1 198 {
rlm@1 199 winlog("R shift: %d\n", systemRedShift);
rlm@1 200 winlog("G shift: %d\n", systemGreenShift);
rlm@1 201 winlog("B shift: %d\n", systemBlueShift);
rlm@1 202 }
rlm@1 203
rlm@1 204 switch (systemColorDepth)
rlm@1 205 {
rlm@1 206 case 16:
rlm@1 207 {
rlm@1 208 for (int i = 0; i < 0x10000; i++)
rlm@1 209 {
rlm@1 210 systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
rlm@1 211 (((i & 0x3e0) >> 5) << systemGreenShift) |
rlm@1 212 (((i & 0x7c00) >> 10) << systemBlueShift);
rlm@1 213 }
rlm@1 214 break;
rlm@1 215 }
rlm@1 216 case 24:
rlm@1 217 case 32:
rlm@1 218 {
rlm@1 219 for (int i = 0; i < 0x10000; i++)
rlm@1 220 {
rlm@1 221 systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
rlm@1 222 (((i & 0x3e0) >> 5) << systemGreenShift) |
rlm@1 223 (((i & 0x7c00) >> 10) << systemBlueShift);
rlm@1 224 }
rlm@1 225 break;
rlm@1 226 }
rlm@1 227 }
rlm@1 228 theApp.updateFilter();
rlm@1 229 theApp.updateIFB();
rlm@1 230
rlm@1 231 if (failed)
rlm@1 232 return false;
rlm@1 233
rlm@1 234 pWnd->DragAcceptFiles(TRUE);
rlm@1 235
rlm@1 236 return TRUE;
rlm@1 237 }
rlm@1 238
rlm@1 239 void OpenGLDisplay::clear()
rlm@1 240 {}
rlm@1 241
rlm@1 242 void OpenGLDisplay::renderMenu()
rlm@1 243 {
rlm@1 244 checkFullScreen();
rlm@1 245 if (theApp.m_pMainWnd)
rlm@1 246 theApp.m_pMainWnd->DrawMenuBar();
rlm@1 247 }
rlm@1 248
rlm@1 249 void OpenGLDisplay::checkFullScreen()
rlm@1 250 {
rlm@1 251 // if(tripleBuffering)
rlm@1 252 // pOpenGL->FlipToGDISurface();
rlm@1 253 }
rlm@1 254
rlm@1 255 void OpenGLDisplay::render()
rlm@1 256 {
rlm@1 257 void (*filterFunction)(u8 *, u32, u8 *, u8 *, u32, int, int) = theApp.filterFunction;
rlm@1 258 int filterWidth = theApp.filterWidth, filterHeight = theApp.filterHeight;
rlm@1 259 /*
rlm@1 260 if(textMethod == 1)
rlm@1 261 {
rlm@1 262 int copyX = 240, copyY = 160;
rlm@1 263 if(systemCartridgeType == 1)
rlm@1 264 if(gbBorderOn) copyX = 256, copyY = 224;
rlm@1 265 else copyX = 160, copyY = 144;
rlm@1 266
rlm@1 267 extern void Simple1x(u8*,u32,u8*,u8*,u32,int,int);
rlm@1 268 filterFunction = Simple1x;
rlm@1 269 filterWidth = copyX;
rlm@1 270 filterHeight = copyY;
rlm@1 271 }
rlm@1 272 */
rlm@1 273 int pitch = filterWidth * 4 + 4;
rlm@1 274 u8 *data = pix + (theApp.sizeX+1)*4;
rlm@1 275
rlm@1 276 int filterPitch = theApp.rect.right*4;
rlm@1 277
rlm@1 278 /*
rlm@1 279 // HACK: see below
rlm@1 280 if (textMethod == 1 && !filterFunction)
rlm@1 281 {
rlm@1 282 textMethod = 0; // must not be after systemMessage!
rlm@1 283 systemMessage(
rlm@1 284 0,
rlm@1 285 "The \"On Game\" text display mode does not work with this combination of renderers and filters.\nThe display mode is automatically being changed to \"In Game\" instead,\nbut this may cause message text to go into AVI recordings and screenshots.\nThis can be reconfigured by choosing \"Options->Video->Text Display Options...\"");
rlm@1 286 }
rlm@1 287 */
rlm@1 288
rlm@1 289 if (filterFunction)
rlm@1 290 {
rlm@1 291 data = filterData;
rlm@1 292 filterFunction(pix + pitch,
rlm@1 293 pitch,
rlm@1 294 (u8 *)theApp.delta,
rlm@1 295 (u8 *)filterData,
rlm@1 296 filterPitch,
rlm@1 297 filterWidth,
rlm@1 298 filterHeight);
rlm@1 299 }
rlm@1 300
rlm@1 301 if (theApp.showSpeed && theApp.videoOption > VIDEO_4X)
rlm@1 302 {
rlm@1 303 char buffer[30];
rlm@1 304 if (theApp.showSpeed == 1)
rlm@1 305 sprintf(buffer, "%3d%%", systemSpeed);
rlm@1 306 else
rlm@1 307 sprintf(buffer, "%3d%%(%d, %d fps)", systemSpeed,
rlm@1 308 systemFrameSkip,
rlm@1 309 theApp.showRenderedFrames);
rlm@1 310
rlm@1 311 if (filterFunction)
rlm@1 312 {
rlm@1 313 if (theApp.showSpeedTransparent)
rlm@1 314 drawTextTransp((u8 *)filterData,
rlm@1 315 filterPitch,
rlm@1 316 theApp.rect.left+10,
rlm@1 317 theApp.rect.bottom-10,
rlm@1 318 buffer);
rlm@1 319 else
rlm@1 320 drawText((u8 *)filterData,
rlm@1 321 filterPitch,
rlm@1 322 theApp.rect.left+10,
rlm@1 323 theApp.rect.bottom-10,
rlm@1 324 buffer);
rlm@1 325 }
rlm@1 326 else
rlm@1 327 {
rlm@1 328 if (theApp.showSpeedTransparent)
rlm@1 329 drawTextTransp((u8 *)pix,
rlm@1 330 pitch,
rlm@1 331 theApp.rect.left+10,
rlm@1 332 theApp.rect.bottom-10,
rlm@1 333 buffer);
rlm@1 334 else
rlm@1 335 drawText((u8 *)pix,
rlm@1 336 pitch,
rlm@1 337 theApp.rect.left+10,
rlm@1 338 theApp.rect.bottom-10,
rlm@1 339 buffer);
rlm@1 340 }
rlm@1 341 }
rlm@1 342
rlm@1 343 if (textMethod == 1 && filterFunction)
rlm@1 344 {
rlm@1 345 DrawTextMessages((u8 *)filterData, filterPitch, theApp.rect.left, theApp.rect.bottom);
rlm@1 346 }
rlm@1 347
rlm@1 348 // Texturemap complete texture to surface so we have free scaling
rlm@1 349 // and antialiasing
rlm@1 350 if (filterFunction)
rlm@1 351 {
rlm@1 352 glPixelStorei(GL_UNPACK_ROW_LENGTH, theApp.rect.right);
rlm@1 353 }
rlm@1 354 else
rlm@1 355 {
rlm@1 356 glPixelStorei(GL_UNPACK_ROW_LENGTH, theApp.sizeX+1);
rlm@1 357 }
rlm@1 358
rlm@1 359 glTexSubImage2D(GL_TEXTURE_2D, 0,
rlm@1 360 0, 0, theApp.rect.right, theApp.rect.bottom,
rlm@1 361 GL_RGBA, GL_UNSIGNED_BYTE, data);
rlm@1 362
rlm@1 363 if (theApp.glType == 0)
rlm@1 364 {
rlm@1 365 glBegin(GL_TRIANGLE_STRIP);
rlm@1 366 glTexCoord2f(0.0, 0.0); glVertex3i(0, 0, 0);
rlm@1 367 glTexCoord2f(theApp.rect.right/size, 0.0); glVertex3i(theApp.surfaceSizeX, 0, 0);
rlm@1 368 glTexCoord2f(0.0, theApp.rect.bottom/size); glVertex3i(0, theApp.surfaceSizeY, 0);
rlm@1 369 glTexCoord2f(theApp.rect.right/size, theApp.rect.bottom/size); glVertex3i(theApp.surfaceSizeX, theApp.surfaceSizeY, 0);
rlm@1 370 glEnd();
rlm@1 371 }
rlm@1 372 else
rlm@1 373 {
rlm@1 374 glBegin(GL_QUADS);
rlm@1 375 glTexCoord2f(0.0, 0.0); glVertex3i(0, 0, 0);
rlm@1 376 glTexCoord2f(theApp.rect.right/size, 0.0); glVertex3i(theApp.surfaceSizeX, 0, 0);
rlm@1 377 glTexCoord2f(theApp.rect.right/size, theApp.rect.bottom/size); glVertex3i(theApp.surfaceSizeX, theApp.surfaceSizeY, 0);
rlm@1 378 glTexCoord2f(0.0, theApp.rect.bottom/size); glVertex3i(0, theApp.surfaceSizeY, 0);
rlm@1 379 glEnd();
rlm@1 380 }
rlm@1 381
rlm@1 382 CDC *dc = theApp.m_pMainWnd->GetDC();
rlm@1 383
rlm@1 384 if (textMethod == 2 || (textMethod == 1 && !filterFunction)) // HACK: so that textMethod isn't changed
rlm@1 385 {
rlm@1 386 for (int slot = 0; slot < SCREEN_MESSAGE_SLOTS; slot++)
rlm@1 387 {
rlm@1 388 if (theApp.screenMessage[slot])
rlm@1 389 {
rlm@1 390 if ((theApp.screenMessageDuration[slot] < 0 ||
rlm@1 391 (int)(GetTickCount() - theApp.screenMessageTime[slot]) < theApp.screenMessageDuration[slot]) &&
rlm@1 392 (!theApp.disableStatusMessage || slot == 1 || slot == 2))
rlm@1 393 {
rlm@1 394 dc->SetBkMode(TRANSPARENT);
rlm@1 395
rlm@1 396 if (outlinedText)
rlm@1 397 {
rlm@1 398 dc->SetTextColor(textColor != 7 ? RGB(0, 0, 0) : RGB(255, 255, 255));
rlm@1 399 // draw black outline
rlm@1 400 const static int xd [8] = {-1, 0, 1, 1, 1, 0, -1, -1};
rlm@1 401 const static int yd [8] = {-1, -1, -1, 0, 1, 1, 1, 0};
rlm@1 402 for (int i = 0; i < 8; i++)
rlm@1 403 {
rlm@1 404 dc->TextOut(10+xd[i], theApp.surfaceSizeY - 20*(slot+1)+yd[i], theApp.screenMessageBuffer[slot]);
rlm@1 405 }
rlm@1 406 }
rlm@1 407
rlm@1 408 COLORREF color;
rlm@1 409 switch (textColor)
rlm@1 410 {
rlm@1 411 case 0:
rlm@1 412 color = RGB(255, 255, 255); break;
rlm@1 413 case 1:
rlm@1 414 color = RGB(255, 0, 0); break;
rlm@1 415 case 2:
rlm@1 416 color = RGB(255, 255, 0); break;
rlm@1 417 case 3:
rlm@1 418 color = RGB(0, 255, 0); break;
rlm@1 419 case 4:
rlm@1 420 color = RGB(0, 255, 255); break;
rlm@1 421 case 5:
rlm@1 422 color = RGB(0, 0, 255); break;
rlm@1 423 case 6:
rlm@1 424 color = RGB(255, 0, 255); break;
rlm@1 425 case 7:
rlm@1 426 color = RGB(0, 0, 0); break;
rlm@1 427 }
rlm@1 428 dc->SetTextColor(color);
rlm@1 429
rlm@1 430 // draw center text
rlm@1 431 dc->TextOut(10, theApp.surfaceSizeY - 20*(slot+1), theApp.screenMessageBuffer[slot]);
rlm@1 432 }
rlm@1 433 else
rlm@1 434 {
rlm@1 435 theApp.screenMessage[slot] = false;
rlm@1 436 }
rlm@1 437 }
rlm@1 438 }
rlm@1 439 }
rlm@1 440
rlm@1 441 SwapBuffers(dc->GetSafeHdc());
rlm@1 442
rlm@1 443 theApp.m_pMainWnd->ReleaseDC(dc);
rlm@1 444 }
rlm@1 445
rlm@1 446 void OpenGLDisplay::resize(int w, int h)
rlm@1 447 {
rlm@1 448 glViewport(0, 0, w, h);
rlm@1 449 glMatrixMode(GL_PROJECTION);
rlm@1 450 glLoadIdentity();
rlm@1 451
rlm@1 452 glOrtho(0.0, (GLdouble)(w), (GLdouble)(h), 0.0, 0.0, 1.0);
rlm@1 453 glMatrixMode(GL_MODELVIEW);
rlm@1 454 glLoadIdentity();
rlm@1 455 }
rlm@1 456
rlm@1 457 void OpenGLDisplay::updateFiltering(int value)
rlm@1 458 {
rlm@1 459 switch (value)
rlm@1 460 {
rlm@1 461 case 0:
rlm@1 462 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
rlm@1 463 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
rlm@1 464 break;
rlm@1 465 case 1:
rlm@1 466 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
rlm@1 467 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
rlm@1 468 break;
rlm@1 469 }
rlm@1 470 }
rlm@1 471
rlm@1 472 bool OpenGLDisplay::initializeTexture(int w, int h)
rlm@1 473 {
rlm@1 474 int mySize = 256;
rlm@1 475 size = 256.0f;
rlm@1 476 if (w > 511 || h > 511)
rlm@1 477 {
rlm@1 478 size = 1024.0f;
rlm@1 479 mySize = 1024;
rlm@1 480 }
rlm@1 481 else if (w > 255 || h > 255)
rlm@1 482 {
rlm@1 483 size = 512.0f;
rlm@1 484 mySize = 512;
rlm@1 485 }
rlm@1 486 glGenTextures(1, &texture);
rlm@1 487 glBindTexture(GL_TEXTURE_2D, texture);
rlm@1 488
rlm@1 489 int filter = regQueryDwordValue("glFilter", 0);
rlm@1 490 if (filter < 0 || filter > 1)
rlm@1 491 filter = 0;
rlm@1 492 updateFiltering(filter);
rlm@1 493
rlm@1 494 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, mySize, mySize, 0, GL_RGBA,
rlm@1 495 GL_UNSIGNED_BYTE, NULL);
rlm@1 496 width = w;
rlm@1 497 height = h;
rlm@1 498
rlm@1 499 return true;
rlm@1 500 }
rlm@1 501
rlm@1 502 bool OpenGLDisplay::changeRenderSize(int w, int h)
rlm@1 503 {
rlm@1 504 if (width != w || height != h)
rlm@1 505 {
rlm@1 506 if (texture != 0)
rlm@1 507 {
rlm@1 508 glDeleteTextures(1, &texture);
rlm@1 509 texture = 0;
rlm@1 510 }
rlm@1 511 if (!initializeTexture(w, h))
rlm@1 512 {
rlm@1 513 failed = true;
rlm@1 514 return false;
rlm@1 515 }
rlm@1 516 }
rlm@1 517 return true;
rlm@1 518 }
rlm@1 519
rlm@1 520 void OpenGLDisplay::setOption(const char *option, int value)
rlm@1 521 {
rlm@1 522 if (!strcmp(option, "glFilter"))
rlm@1 523 updateFiltering(value);
rlm@1 524 }
rlm@1 525
rlm@1 526 int OpenGLDisplay::selectFullScreenMode(GUID * *)
rlm@1 527 {
rlm@1 528 HWND wnd = GetDesktopWindow();
rlm@1 529 RECT r;
rlm@1 530 GetWindowRect(wnd, &r);
rlm@1 531 int w = (r.right - r.left) & 4095;
rlm@1 532 int h = (r.bottom - r.top) & 4095;
rlm@1 533 HDC dc = GetDC(wnd);
rlm@1 534 int c = GetDeviceCaps(dc, BITSPIXEL);
rlm@1 535 ReleaseDC(wnd, dc);
rlm@1 536
rlm@1 537 return (c << 24) | (w << 12) | h;
rlm@1 538 }
rlm@1 539
rlm@1 540 IDisplay *newOpenGLDisplay()
rlm@1 541 {
rlm@1 542 return new OpenGLDisplay();
rlm@1 543 }
rlm@1 544