there's something wrong with my D3DGAMMARAMP..., :(
i''ve tried lots of stuffs with it already, and this one here is the last code i tried,
for(DWORD i = 0; i < 255; i++)
{
d3dRamp.red = gamma*256;
d3dRamp.green = gamma*256;
d3dRamp.blue = gamma*256;
}
where gamma is from 1 to 256,
this thing achieve the fadein/out i want, but first, it changes the color of my screen to say, for example, pink, before it applies the fade..,
also one more thing, i thought these ramps contains WORD? i do not understand, when i output say, d3dRamp.red[150], i also get the value 150??
thanks! <img src="smile.gif" width=15 height=15 align=middle> </i>
Hi, I had to deal with gamma ramps few weeks ago, and I would like to help you:
to understand you have first to build a default gammaramp that will not modify
the colors of your scene at all!
->that''s the code
D3DGAMMARAMP *pGammaRamp;
for(int i=0; i<256; i++) { pGammaRamp->red=257*i; pGammaRamp->green=257*i; pGammaRamp->blue=257*i; }<br>d3ddevice->SetGammaRamp(D3DSGR_NO_CALIBRATION, pGammaRamp); <br> <br>after doing that you will not notice any color change.<br>you should notice that the values in pGammaRamp->red are not equal to i! ie pGammaRamp->red[255]=65535 <br><br>Ok, now you have to play with the r/g/b channels, assigning them values from 0 to 65535 (not 65536 !)<br><br>this is an example of how to fade your scene from normal colors to red shaded color:<br><br>// set the default ramp at the beginning <br>D3DGAMMARAMP *pGammaRamp;<br>for(int i=0; i<256; i++) { pGammaRamp->red=257*i; pGammaRamp->green=257*i; pGammaRamp->blue=257*i; }<br><br>while(fade effect is not finished)<br>{<br>for(int i=0; i<256; i++) { if(pGammaRamp->red+1000<65535) { pGammaRamp->red+=1000; } }<br>cdx8->d3ddevice->SetGammaRamp(D3DSGR_NO_CALIBRATION, pGammaRamp);<br>}<br><br>// restore the gamma ramp<br>for(int i=0; i<256; i++) { pGammaRamp->red=257*i; pGammaRamp->green=257*i; pGammaRamp->blue=257*i; }<br>cdx8->d3ddevice->SetGammaRamp(D3DSGR_NO_CALIBRATION, pGammaRamp); </i>
to understand you have first to build a default gammaramp that will not modify
the colors of your scene at all!
->that''s the code
D3DGAMMARAMP *pGammaRamp;
for(int i=0; i<256; i++) { pGammaRamp->red=257*i; pGammaRamp->green=257*i; pGammaRamp->blue=257*i; }<br>d3ddevice->SetGammaRamp(D3DSGR_NO_CALIBRATION, pGammaRamp); <br> <br>after doing that you will not notice any color change.<br>you should notice that the values in pGammaRamp->red are not equal to i! ie pGammaRamp->red[255]=65535 <br><br>Ok, now you have to play with the r/g/b channels, assigning them values from 0 to 65535 (not 65536 !)<br><br>this is an example of how to fade your scene from normal colors to red shaded color:<br><br>// set the default ramp at the beginning <br>D3DGAMMARAMP *pGammaRamp;<br>for(int i=0; i<256; i++) { pGammaRamp->red=257*i; pGammaRamp->green=257*i; pGammaRamp->blue=257*i; }<br><br>while(fade effect is not finished)<br>{<br>for(int i=0; i<256; i++) { if(pGammaRamp->red+1000<65535) { pGammaRamp->red+=1000; } }<br>cdx8->d3ddevice->SetGammaRamp(D3DSGR_NO_CALIBRATION, pGammaRamp);<br>}<br><br>// restore the gamma ramp<br>for(int i=0; i<256; i++) { pGammaRamp->red=257*i; pGammaRamp->green=257*i; pGammaRamp->blue=257*i; }<br>cdx8->d3ddevice->SetGammaRamp(D3DSGR_NO_CALIBRATION, pGammaRamp); </i>
hi, thanks pal, it's been quite a well this post was, and thanks a lot and i've finally got an answer,
but plz, before you go, i got a few more questions,
what does this D3DSGR_NO_CALIBRATION and this D3DSGR_CALIBRATION really do? or mean(i didn't really quite understand the MSDN)?
if(pGammaRamp->red+1000<65535)
what does that line really mean? i get strange result if i commented out that statement, same results i get before,
also i can't perform the fade to black? this is what i did,
again, thanks!!
[edited by - mickey on June 18, 2002 12:48:57 PM]
[edited by - mickey on June 18, 2002 12:50:32 PM]
but plz, before you go, i got a few more questions,
what does this D3DSGR_NO_CALIBRATION and this D3DSGR_CALIBRATION really do? or mean(i didn't really quite understand the MSDN)?
if(pGammaRamp->red+1000<65535)
what does that line really mean? i get strange result if i commented out that statement, same results i get before,
also i can't perform the fade to black? this is what i did,
for(int i = 0; i < 256; i++){if(m_d3dRamp.red[i]+1000<65535){ m_d3dRamp.red[i]-=1000;}if(m_d3dRamp.blue[i]+1000<65535){ m_d3dRamp.blue[i]-=1000;}if(m_d3dRamp.green[i]+1000<65535){ m_d3dRamp.green[i]-=1000;}}
again, thanks!!
[edited by - mickey on June 18, 2002 12:48:57 PM]
[edited by - mickey on June 18, 2002 12:50:32 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement