| 4 |
|
#include "Oni.h" |
| 5 |
|
#include "Oni_Persistence.h" |
| 6 |
|
#include "Daodan_Utility.h" |
| 7 |
< |
|
| 7 |
> |
#include <gl/gl.h> |
| 8 |
> |
#include <gl/glu.h> |
| 9 |
> |
#include "gl/wglext.h" //WGL extensions |
| 10 |
> |
#include "gl/glext.h" //GL extensions |
| 11 |
> |
#include "Daodan_Win32.h" |
| 12 |
|
#include "BFW_Utility.h" |
| 13 |
|
|
| 14 |
|
#include "daodan_gl.h" |
| 48 |
|
{ 1920, 1200, 0, 0 }, |
| 49 |
|
{ 1920, 1440, 0, 0 }, |
| 50 |
|
}; |
| 51 |
< |
|
| 52 |
< |
short daodan_resdepths[] = { 16, 32 }; |
| 53 |
< |
|
| 51 |
> |
//Just going to always use 32 bits for now... |
| 52 |
> |
//short daodan_resdepths[] = { 16, 32 }; |
| 53 |
> |
short daodan_resdepths[] = { 32 }; |
| 54 |
|
DEVMODE orig_devmode, cur_devmode, new_devmode; |
| 55 |
|
|
| 56 |
|
void init_daodan_gl() |
| 86 |
|
unsigned int ONICALL daodan_enumerate_valid_display_modes(M3tDisplayMode modes[max_modes]) |
| 87 |
|
{ |
| 88 |
|
unsigned int vmodes = 0; |
| 89 |
< |
unsigned int screen_x = orig_devmode.dmPelsWidth; |
| 90 |
< |
unsigned int screen_y = orig_devmode.dmPelsHeight; |
| 89 |
> |
unsigned int screen_x = GetSystemMetrics(SM_CXSCREEN); |
| 90 |
> |
unsigned int screen_y = GetSystemMetrics(SM_CYSCREEN); |
| 91 |
|
|
| 92 |
|
uint16_t i, j; |
| 93 |
|
|
| 94 |
|
DDrStartupMessage("listing display modes"); |
| 95 |
< |
|
| 95 |
> |
/* |
| 96 |
|
if (!M3gResolutionSwitch) |
| 97 |
|
daodan_resdepths[0] = orig_devmode.dmBitsPerPel; |
| 98 |
< |
|
| 98 |
> |
*/ |
| 99 |
|
for (i = 0; i < builtin_depths; i ++) |
| 100 |
|
{ |
| 101 |
|
bool scrInsert = false; |
| 195 |
|
} |
| 196 |
|
return 1; |
| 197 |
|
} |
| 194 |
– |
|
| 195 |
– |
void daodan_set_gamma(float gamma) |
| 196 |
– |
{ |
| 197 |
– |
WORD ramp[3][256]; |
| 198 |
– |
int i; |
| 199 |
– |
|
| 200 |
– |
if (!gl_gamma_ramp_valid) |
| 201 |
– |
return; |
| 202 |
– |
|
| 203 |
– |
gamma = (1.0f - gamma) * 1.2f + 0.4f; |
| 204 |
– |
|
| 205 |
– |
for (i = 0; i < 256; i++) |
| 206 |
– |
{ |
| 207 |
– |
int value = (int)(pow(gl_gamma_ramp[i] / 65535.0f, gamma) * 65535.0f); |
| 208 |
– |
|
| 209 |
– |
if (value < 0) |
| 210 |
– |
value = 0; |
| 211 |
– |
else if (value > 65535) |
| 212 |
– |
value = 65535; |
| 213 |
– |
|
| 214 |
– |
ramp[0][i] = ramp[1][i] = ramp[2][i] = value; |
| 215 |
– |
} |
| 216 |
– |
|
| 217 |
– |
if (gl_api->wglSetDeviceGammaRamp3DFX) |
| 218 |
– |
gl_api->wglSetDeviceGammaRamp3DFX(gl_eng->HDC, ramp); |
| 219 |
– |
else |
| 220 |
– |
SetDeviceGammaRamp(gl_eng->HDC, ramp); |
| 221 |
– |
} |
| 222 |
– |
|
| 198 |
|
int ONICALL daodangl_platform_initialize() |
| 199 |
|
{ |
| 200 |
|
static M3tDisplayMode lastmode = {0, 0, 0, 0}; |
| 239 |
|
if (GetDeviceGammaRamp(gl_eng->HDC, gl_gamma_ramp)) |
| 240 |
|
gl_gamma_ramp_valid = 1; |
| 241 |
|
} |
| 242 |
< |
|
| 242 |
> |
/* |
| 243 |
|
if (gl_gamma_ramp_valid) |
| 244 |
|
daodan_set_gamma(ONrPersist_GetGamma()); |
| 245 |
< |
else |
| 245 |
> |
else*/ |
| 246 |
|
DDrStartupMessage("gamma adjustment not supported"); |
| 247 |
|
|
| 248 |
|
if (!gl_platform_set_pixel_format(gl_eng->HDC)) |