ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/daodan_gl.c
(Generate patch)

Comparing Daodan/src/daodan_gl.c (file contents):
Revision 472 by rossy, Sat Jun 6 13:23:59 2009 UTC vs.
Revision 473 by gumby, Fri Oct 30 07:41:39 2009 UTC

# Line 194 | Line 194 | int daodan_set_display_mode(short width,
194  
195   void daodan_set_gamma(float gamma)
196   {
197 <        WORD ramp[3 * 256];
197 >        WORD ramp[3][256];
198          int i;
199  
200          if (!gl_gamma_ramp_valid)
# Line 202 | Line 202 | void daodan_set_gamma(float gamma)
202  
203          gamma = (1.0f - gamma) * 1.2f + 0.4f;
204  
205 <        for (i = 0; i < sizeof(ramp); i++)
205 >        for (i = 0; i < 256; i++)
206          {
207                  int value = (int)(pow(gl_gamma_ramp[i] / 65535.0f, gamma) * 65535.0f);
208  
# Line 211 | Line 211 | void daodan_set_gamma(float gamma)
211                  else if (value > 65535)
212                          value = 65535;
213  
214 <                ramp[i] = value;
214 >                ramp[0][i] = ramp[1][i] = ramp[2][i] = value;
215          }
216          
217          if (gl_api->wglSetDeviceGammaRamp3DFX)
# Line 241 | Line 241 | int ONICALL daodangl_platform_initialize
241                  Rect.top = (GetSystemMetrics(SM_CYSCREEN) / 2) - (gl->DisplayMode.Height / 2);
242                  Rect.right = Rect.left + gl->DisplayMode.Width;
243                  Rect.bottom = Rect.top + gl->DisplayMode.Height;
244 <                AdjustWindowRect(&Rect, WS_OVERLAPPED | WS_MAXIMIZEBOX | WS_MINIMIZEBOX, FALSE);
244 >                //http://msdn.microsoft.com/en-us/library/ms632665(VS.85).aspx
245 >                //dwStyle
246 >                //[in] Specifies the window style of the window whose required size is to be calculated. Note that you cannot specify the WS_OVERLAPPED style.
247 >                AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_CAPTION, TRUE);
248                  
249                  SetWindowPos(ONgPlatformData.Window, NULL, Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, SWP_NOACTIVATE | SWP_NOZORDER);
250          }
# Line 265 | Line 268 | int ONICALL daodangl_platform_initialize
268                          gl_gamma_ramp_valid = 1;
269          }
270          
271 < //      if (gl_gamma_ramp_valid)
272 < //              daodan_set_gamma(ONrPersist_GetGamma());  Its not working :(
273 < //      else
271 >        if (gl_gamma_ramp_valid)
272 >                //Its working now
273 >                daodan_set_gamma(ONrPersist_GetGamma());  
274 >        else
275                  DDrStartupMessage("gamma adjustment not supported");
276          
277          if (!gl_platform_set_pixel_format(gl->HDC))
# Line 283 | Line 287 | int ONICALL daodangl_platform_initialize
287          lastmode.Width = gl->DisplayMode.Width;
288          lastmode.Height = gl->DisplayMode.Height;
289          lastmode.Depth = gl->DisplayMode.Depth;
290 <        
287 <        return 0;
290 >        return 1;
291  
292   exit_err:
293          AUrMessageBox(1, "Failed to initialize OpenGL contexts; Oni will now exit.");
294          exit(0);
295 <        return 1;
295 >        return 0;
296   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)