Archived

This topic is now archived and is closed to further replies.

mininova

a faster way to look through a colored window

Recommended Posts

mininova    122
Hi! The effect I want to achieve is that the whole scene looks like being viewed through a colored window. My current solution is to draw a colored transparent rectangle in ortho mode. This looks exactly like I want it to, BUT: when using that, I notice a 100 to 120 frames drop (from about 330 fps to 200 fps, Athlon XP 2000+, GeForce3, 1152x864x32). This seems ridiculous when taking into account that it is a small and simple 3d engine for a space shooter... So, is there another way to achieve this affect that I didn''t think of yet?

Share this post


Link to post
Share on other sites
Wingman    167
You can approximate this with glColorMask () function.
Its description: http://www.cevis.uni-bremen.de/~uwe/opengl/glColorMask.html

For example, if you want to see everything red:
glColorMask (GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE).

Share this post


Link to post
Share on other sites
mininova    122
Hm, that would be nice to use a "native" GL function, but this one does not exactly what I want. The point is, when using that transparent rectangle, all the colors are still there but "overlayed" with blue (or red, whatever). glColorMask just lets me disable everything BUT red, and so I can see only one color... Thank you anyway - very fast response here :-)

Share this post


Link to post
Share on other sites
Nik02    4351
With gamma ramps, you can control r,g and b global brightnesses individually.

for Windows:
BOOL WINAPI SetDeviceGammaRamp( HDC hDC, LPVOID lpRamp );

for Linux, i don''t know any functions

I hope this helps!

Nik

Share this post


Link to post
Share on other sites
mininova    122
Whoa, that''s something really cool - in the dirty hardwareish way. I just had a look at the documentation, and it says that there must be hardware support for that to work. I''ll check it out, thank you!

Share this post


Link to post
Share on other sites
mininova    122
BTW, talking bout gamma, there must be some way to influence the contrast/brightness/whatever via OpenGL (as the gamma setting that a lot of games offer today). Maybe there is something in that direction that could be (ab)used...?

Share this post


Link to post
Share on other sites
OrangyTang    1298
quote:
Original post by mininova
BUT: when using that, I notice a 100 to 120 frames drop (from about 330 fps to 200 fps, Athlon XP 2000+, GeForce3, 1152x864x32). This seems ridiculous when taking into account that it is a small and simple 3d engine for a space shooter...


1. You''re probably making yourself fill limited with added a fullscreen quad at that high resolution. Decreasing your display resolution would probably up your fps again.

2. With fps numbers this high, you''ve got to take changes like these with a pinch of salt. Loosing 100fps sounds like a lot, but its not a linear scale.

Time delta @ 300fps = 1000/300 = 3.33r ms
Time delta @ 200fps = 1000/200 = 5.00 ms
So you''re now taking 1.66 milliseconds longer to render a frame. Now imagine you needed to do the same effect again, your time delta would be 6.66ms. This would be 150fps. So instead of dropping 100fps you''ve ''lost'' 50fps.

Put simply, because your fps is so high *anything* you do is likely to drastically drop your fps. Besides, all these hacks to get a colour shift are no way as near flexible - say you wanted some detail on the window? You could just paint it on the texture, but use one of the other methods and you''re stuck.

Share this post


Link to post
Share on other sites
mininova    122
Yes, you are right about the resolution. I just noticed that massive fps drop because I was too lazy to switch resolution in-game since I am debugging a lot at the moment.

The "window" itself will not be a window, it is just an indicator for whether the ship is cloaked or gets hit or something similar. Maybe I really should just stick to that - your calculated times a rather impressive. When doing the same in 640x480, it is 650 fps vs. 450 with "cloak" turned on - not too bad for a working engine. Collision detection eats by far more frames than that.

Share this post


Link to post
Share on other sites
Nik02    4351
quote:
Original post by mininova
BTW, talking bout gamma, there must be some way to influence the contrast/brightness/whatever via OpenGL (as the gamma setting that a lot of games offer today). Maybe there is something in that direction that could be (ab)used...?


Global contrast/brightness effects can be achieved thru gamma ramps. Just modify the ramp values accordingly.
They are only color transfer maps, after all...


[edited by - Nik02 on August 10, 2003 8:44:00 AM]

Share this post


Link to post
Share on other sites
mininova    122
With win32, that should work ok, but I intend to do a Linux port some time in the future http://www.gamedev.net/community/forums/icons/icon12.gif - if there is no such function, I will need to find another way. So staying with OpenGL or some toolkit is my best choice, I guess.

Share this post


Link to post
Share on other sites
Nik02    4351
quote:
Original post by GameCat
You can set the gamma ramp in linux, although i don''t remeber the function name off hand.


I agree on that.
It''s a hardware capability, and as such should be accessible on any OS, given driver support...

I can''t seem to remember much of linux stuff nowadays...

My clients all use Windows, so i''m stuck with it

Share this post


Link to post
Share on other sites