Gamma Control

Started by
11 comments, last by EnochDagor 23 years, 6 months ago
Hi all. I''ve been trying to use the Gamma Control in DDRAW. The first time I read the documentation it said that if QueryInterface did not return it as a supported feature then the HEL would be able to emulate it. Than I go to another part of the DX SDK documentation and it said that the HEL would not emulate it. Well, I implemented the code and it didn''t work. I was wondering if anyone else got it to work? And if you did, did it use the HEL or HAL? If it used the HAL than what is your video card? If you haven''t gotten it to work than I was wondering about some pretty fast ideas on how to handle lighting in Direct Draw. (Namely ambient lighting not spot) Thanks.
Enoch DagorLead DeveloperDark Sky EntertainmentBeyond Protocol
Advertisement
Sorry about that, when I origionaly read the documentation I miss-read the information in it. Gamma will not work unless it''s supported on the video card. I''m extremly sorry about that, a little miss-communication between the MS Docs and my brain I suppose.
Joseph FernaldSoftware EngineerRed Storm Entertainment.------------------------The opinions expressed are that of the person postingand not that of Red Storm Entertainment.
So what are some good methods for adding ambient lighting? For example... I''m using the same tileset for bright-in-the-sun situations as I am for dark-out-from-under-the-sun situations.

Instead of adjusting all of the tile''s pics to compensate for the difference of lighting... how can I do that with just one tileset...

Now I''ve been thinking about the fog-of-war type deal but I don''t know how to implement that either. So if anyone could give me some advice I''d be grateful.
Enoch DagorLead DeveloperDark Sky EntertainmentBeyond Protocol
Wait a minute... how did StarCraft do it? (using DirectX 2.0 and back in the days when nothing really was supported on video cards).

If I recall correctly, there was a menu option in the game that you could adjust the gamma correction...

Enoch DagorLead DeveloperDark Sky EntertainmentBeyond Protocol
Enoch: gamma control will affect the entire screen. So you can use it for day-time vs. night-time. But you will not be able to use it for a fog of war effect where you only hide part of the screen.

Of course, if you go 3D then you can control the gamma on every single vertex...


Edited by - Buster on October 4, 2000 3:37:01 PM
Buster,

Ok, so how do I get the Gamma Control to work in DDraw? I QueryInterface but it doesn''t work.
Enoch DagorLead DeveloperDark Sky EntertainmentBeyond Protocol
quote: Original post by EnochDagor

Wait a minute... how did StarCraft do it? (using DirectX 2.0 and back in the days when nothing really was supported on video cards).

If I recall correctly, there was a menu option in the game that you could adjust the gamma correction...



Hmmm... Maybe Assembly?

EDIT: Oops, forgot the gamma stuff
Here:

    LPDIRECTDRAW7 lpdds; // your directdraw 7 objectLPDIRECTDRAWGAMMACONTROL lpdgc; // gamma control// ... initaliaze ddraw herelpdds->QueryInterface(IID_IDirectDrawGammaControl,(LPVOID*)lpdgc);    


This should make DirectDrawGammaControl initaliaze
Now you can use SetGammaRamp() to change the gamma values.

- Goblineye Entertainment
The road to success is always under construction

Edited by - Tornado on October 4, 2000 4:08:53 PM
Goblineye EntertainmentThe road to success is always under construction
Alright. So I tried that but it appears that QueryInterface return unsupported. So DirectX would emulate this right? Or no?

If it is not, what other ways can I control that type of thing?
Enoch DagorLead DeveloperDark Sky EntertainmentBeyond Protocol
No, DX doesn''t emulate
You can check for sure if your video card can support gamma ramp with DDCAPS2_CANCALIBRATEGAMMA.
Look it up it in the SDK.
You can try using Alpha Blending instead.
It''s pretty fast, and not so hard to setup.
You can use software alpha blending (With MMX acceleration or w/o) or with D3D (Much faster).
There''s articles about it right here at Gamedev.net and at Mr-GameMaker.
Goblineye EntertainmentThe road to success is always under construction
quote:Original post by Tornado

No, DX doesn''t emulate
You can check for sure if your video card can support gamma ramp with DDCAPS2_CANCALIBRATEGAMMA.
Look it up it in the SDK.
You can try using Alpha Blending instead.
It''s pretty fast, and not so hard to setup.
You can use software alpha blending (With MMX acceleration or w/o) or with D3D (Much faster).
There''s articles about it right here at Gamedev.net and at Mr-GameMaker.


Well, you really need a 3D accelerator for D3D alpha blending. I tried turning acceleration off on mine, and it ran at about 4 fps on my P3 450. That was with a textured and blended polygon though, it was more like 6 or 7 without the texture, but it''d probably be a lot slower with an actual game running behind it, so you might wanna try checking if the user has a 3D card before using it, and if not, write an asm routine to darken and lighten each pixel of the surface one at a time.


-Deku-chan

DK Art (my site, which has little programming-related stuff on it, but you should go anyway^_^)

"I'm dropping like flies!" - me, playing Super Smash Bros. (and losing)
"What fun!" - me, playing Super Smash Bros. (and beating the crap out of somebody)

This topic is closed to new replies.

Advertisement