// // Benny's note: I trimmed the original message. // From: "Markus Uttenweiler" Newsgroups: 3dfx.opengl Subject: Re: Will there be a window-using OpenGl-Driver for Monster3D or similar Voodoo? Date: Mon, 15 Sep 1997 20:38:42 +0200 NNTP-Posting-Host: p40ae97.m.dip.t-online.de It's possible to copy the 3dfx backbuffer to a direct draw window in windowed mode. Code Example : /* 1. Init Glide and Switch bach to 2D Video Card */ // // Init Glide // grGlideInit(); if (!grSstQueryHardware(&hw)) return NULL; grSstSelect(0); grSstWinOpen(NULL, GR_RESOLUTION_640x480, GR_REFRESH_60Hz, GR_COLORFORMAT_RGBA, GR_ORIGIN_LOWER_LEFT, 2, 0); grSstControl(GR_CONTROL_DEACTIVATE); /* 2. Render to 3DFX and copy 3DFX Backbuffer to the Direct Draw BackBuffer */ LPDIRECTDRAWSURFACE lpBackBuffer = DDGetBackBuffer(); HDC hdc; // // Shouldn't be here if no buffers, but avoid GPFs anyway // if (lpBackBuffer == NULL) return; Render3D(); GrLfbInfo_t info; info.size = sizeof(GrLfbInfo_t); DDSURFACEDESC ddsd; ddsd.dwSize = sizeof(ddsd); lpBackBuffer->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL); grLfbLock(GR_LFB_READ_ONLY | GR_LFB_IDLE, GR_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_ANY, GR_ORIGIN_ANY, FXFALSE, &info ); char *s = (char *) ddsd.lpSurface; char *d = (char *) info.lfbPtr; for (int i = 0; i < 480; i++) { memcpy(s, d, info.strideInBytes); s += ddsd.lPitch; d += info.strideInBytes; } grLfbUnlock(GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER); lpBackBuffer->Unlock(ddsd.lpSurface); /* 3. Blit Backbuffer to Display */ DDBLTFX ddbltfx; HRESULT hr; ddbltfx.dwSize = sizeof(ddbltfx); ddbltfx.dwFillColor = DDColorMatch(lpSurface, color); hr = lpSurface->Blt(lprect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); return hr == DD_OK; //------------------------------------------------------------------//