Speaking of Microsoft, does anyone know if they have made a comment on the
request for Open GL support petition published Monday?
Brian
b-ro...@ti.com
as i stated before, i have managed to get 640x480 full-screen OpenGL
on NT and Win95. i'll explain how in a bit. i haven't tried
resolutions above 640x480 (mainly because the video card i have has only
2meg ram), but i have gotten both 8 bits per pixel and 16 bpp. In fact,
i noticed that for some reason on my system, 16bpp actually runs faster
than 8 bpp. if someone could pls. explain that it would make me very
happy.
one thing to note is that id software's GL quake doesn't go below
640x480 resolution. the 320x240 mode in GL quake actually uses 640x480
resolution. what it does to simulate 320x240 is to to expand each
pixel's color out in two directions (providing the same look as
320x240. this is faster on some systems because expanding pixels is
faster than doing all the calculations to determine their final color to
begin with, but on a lot of systems, it may actually be *slower*
(meaning you are better off in true 640x480 mode!). check out:
http://www.planetquake.com/gldojo
which is a great site and has a FAQ that explains this. i still don't
know why it is hard to go below 640x480 on NT, but i've pretty much
given up trying. i'd love to be able to do full-screen 320x240 and i
don't know why id has been unable (or maybe didn't feel like it) either.
ok, so my way of getting full screen is by making use of DirectX's
DirectDraw. this comes with NT 4.0, so we're all set. if there is a
better way, then someone pls. educate me. here is a code example that
will put you in full-screen 640x480(tons of stuff is ommitted, email me
and i'll send a .cpp file that works):
...//#include other openGL stuff
#include <ddraw.h>
const int ddWidth = 640, ddHeight = 480, ddBPP = 8; //Screen Resolution
LPDIRECTDRAW dd; // DirectDraw object
...
//In WndProc:
...
case WM_CREATE:
/* initialize OpenGL rendering */
hDC = GetDC(hWnd);
setupPixelFormat(hDC); //Be sure to use ddBPP as color depth
setupPalette(hDC);
hGLRC = wglCreateContext(hDC);
wglMakeCurrent(hDC, hGLRC);
init(); //GLenable's, setup GL states, etc.
...
//In WinMain
...
HRESULT ddrval;
//Initialize directdraw object
ddrval = DirectDrawCreate(NULL, &dd, NULL);
if (ddrval != DD_OK) {
MessageBox(NULL, "Could not init DirectDraw object.", "Error", MB_OK);
return initFail(hWnd); //this posts an error but is one of my funcs.
}
// Setup exclusive mode
ddrval = dd->SetCooperativeLevel(hWnd, DDSCL_ALLOWMODEX |
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
if (ddrval != DD_OK) {
MessageBox(NULL, "Could not set cooperative level.", "Error", MB_OK);
return initFail(hWnd);
}
// Set video mode
ddrval = dd->SetDisplayMode(ddWidth,ddHeight,ddBPP);
if (ddrval != DD_OK) {
MessageBox(NULL, "Could not change display mode.", "Error", MB_OK);
if(ddrval == DDERR_INVALIDMODE)
MessageBox(NULL, "Invalid Mode.", "Error", MB_OK);
if(ddrval == DDERR_INVALIDPARAMS)
MessageBox(NULL, "Invalid Parameters.", "Error", MB_OK);
return initFail(hWnd);
}
...
Be sure to destroy the directDraw object when your app finishes AND in
initFail func:
if( dd != NULL ) {
dd->Release();
dd = NULL;
}
OK. that should work, although i might have left something out.
email me if you can't get it working. also, if anyone thinks using
directDraw is inefficient, and knows a better way pls. let me know. i
started learning openGL last week, and could be doing something totally
stupid (that gives you a lot of confidence in the above, eh?). sorry
this post/msg. was so long. Good Luck!
I too have been able to get this to work in win95, but with some strange
differences in the behaviour of the GL drivers. I make use of a Diamond
Fire GL card running win95. I basically do the same thing as ted above,
but run into problems on anything above 320x240, 8 bit color. For some reason,
opengl32.dll (I believe is the culprit) will not use my hardware unless
I set this mode. Any other mode, specifically 16 bit color, will always
revert to Microsoft's software engine. This is not the result of my hardware
not having enough memory. I can hardware render in a window all the way up
to 800x600 16bit. But using directdraw to set the screen modes first will
screw this up completely. It will always end up in the software rendering
engine.
IF anyone understands what opengl32.dll does when it decides between
hard/software - please let me know. I can't for the life of me
figure out what is going on.
Regards,
Jim Mathies
j...@prophetcomm.com
The same on mine - software rendering with Mesa under FreeBSD/X I get about
20fps 16bpp, 18fps 8bpp, 17fps 24bpp. (of some OpenGL demo.) I think this
is because in 8bpp the dithering slows things down.
--
Michael Searle - cs...@csv.warwick.ac.uk
| one thing to note is that id software's GL quake doesn't go below
| 640x480 resolution. the 320x240 mode in GL quake actually uses 640x480
| resolution. what it does to simulate 320x240 is to to expand each
| pixel's color out in two directions (providing the same look as
| 320x240.
I believe this is incorrect. The version I have apparently uses SciTech
Software's MGL 3.1 beta. www.scitechsoft.com
--
Michael I. Gold Silicon Graphics Inc. http://reality.sgi.com/gold
And my mama cried, "Nanook a no no! Don't be a naughty eskimo! Save your
money, don't go to the show!" Well I turned around and I said, "Ho! Ho!"
ted
Hi Brian,
The method I've been using to change display setting is the standard
Win32 function ChangeDisplaySettings.
You can also use EnumDisplaySettings to get a list of the supported
resolutions.
I have a Diamond FireGL 1000 and have been able to use it at 320x240x8
all the way up to 1024x768x16 by using ChangeDisplaySettings along
with OpenGL.
In order to use full-screen OpenGL, you have to use different window
properties than a windowed application uses.
I use WS_POPUP and WS_VISIBLE in addition to the obligatory
WS_CLIPCHILDREN and WS_CLIPSIBLINGS.
I use the ChangeDisplaySettings before I create my main window and
then create the main window the same size as the display resolution
with the origin at 0,0. This window will have no caption bar and no
menu.
Obviously, you should capture the current screen size and bits per
pixel before you change anything so you can put them back just before
you exit winmain. I also abort my program if the initial call to
ChangeDisplaySettings fails.
Code snippets:
HWND hMainWnd; // Main window handle.
static DEVMODE devmode;
static DWORD dwWidth = 640, dwHeight = 480;
static DWORD dwCurrWidth, dwCurrHeight, dwCurrBPP;
HWND hDesktop;
HDC hDCDesk;
dwCurrWidth = GetSystemMetrics(SM_CXSCREEN);
dwCurrHeight = GetSystemMetrics(SM_CYSCREEN);
hDesktop = GetDesktopWindow();
hDCDesk = GetDC(hDesktop);
dwCurrBPP = GetDeviceCaps(hDCDesk,BITSPIXEL);
ReleaseDC(hDesktop,hDCDesk);
// Create a main window for this application instance.
devmode.dmSize = sizeof(DEVMODE);
devmode.dmBitsPerPel = FS_Bpp; // These are my definitions
devmode.dmPelsWidth = FS_Width; // you use whatever variables you want
devmode.dmPelsHeight = FS_Height; // or even hard code them here...
devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
ChangeDisplaySettings(&devmode,0);
hMainWnd = CreateWindow( szAppName, // app name
szTitle, // Text for window title bar (of
course, we don't have one...)
WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN |
WS_CLIPSIBLINGS,
0, 0, dwWidth, dwHeight,
NULL, // no parent window
NULL, // Use the window class menu.
hInstance,// This instance owns this window
NULL // We don't use any extra data
);
Other initialization and message loop here...
devmode.dmSize = sizeof(DEVMODE);
devmode.dmBitsPerPel = dwCurrBPP;
devmode.dmPelsWidth = dwCurrWidth;
devmode.dmPelsHeight = dwCurrHeight;
devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
ChangeDisplaySettings(&devmode,0);
This is not fool-proof by any stretch but it works for me. There is
also the need for code to handle the desktop being resized again under
the program. (I shutdown the program if this happens.)
Sorry for the long post. I'm sure there'll be lots of laughter at
this code but, like I said. It works for me.
Cheers,
Bruce
actually, i found a new way to use DirectX to get full screen mode,
where i actually go ahead and create a primary DirectDrawSurface with
one backbuffer. I then use IDirectDrawSurface->GetDC(..) to get the
device context for OpenGL to use. when I did this, I almost doubled my
frame rate with 8bpp (from 13 to 24/25) while I still get the 15 fps
with 16bpp no matter what I do. I think it has something to do with
directX allocating more memory on the video card when i actually create
a surface (but i have no way of knowing at this point).
ted
I'd like to use OpenGl, as well as directplay.
I did a very simple program in openGL few years ago but it was on a SGI
workstation so I don't know How to do it on a Win95 PC
Can anyone help me ??
If so please respond trough email as well as post I have problems
accessing the news sometimes.
thanks in advance Gh
--------------------------------------------------------------------
Georges-Henry PORTEFAIT g...@cortosys.fr
http://www.cortosys.fr
Paris FRANCE
01-46-38-06-93
"I have also seen children successfully surmounting the effects of
"an evil inheritance. That is due to purity being an inherent
"attribute of the soul."
[Mahatma Gandhi]
---------------------------------------------------------------------