| @@ -1,7 +1,7 @@ | |||
| // | |||
| // Lol Engine | |||
| // | |||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||
| // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
| // This program is free software; you can redistribute it and/or | |||
| // modify it under the terms of the Do What The Fuck You Want To | |||
| // Public License, Version 2, as published by Sam Hocevar. See | |||
| @@ -87,11 +87,52 @@ Ps3App::Ps3App(char const *title, ivec2 res, float fps) : | |||
| (uint8_t *)stack.pst_addr + stack.pst_size); | |||
| #endif | |||
| PSGLdevice* psgl = psglCreateDeviceAuto(GL_ARGB_SCE, GL_DEPTH_COMPONENT24, | |||
| GL_MULTISAMPLING_4X_SQUARE_ROTATED_SCE); | |||
| PSGLdeviceParameters psgldp = | |||
| { | |||
| enable: PSGL_DEVICE_PARAMETERS_COLOR_FORMAT | |||
| | PSGL_DEVICE_PARAMETERS_DEPTH_FORMAT | |||
| | PSGL_DEVICE_PARAMETERS_MULTISAMPLING_MODE | |||
| | PSGL_DEVICE_PARAMETERS_WIDTH_HEIGHT, | |||
| colorFormat: GL_ARGB_SCE, /* can also be GL_RGBA16F_ARB */ | |||
| depthFormat: GL_DEPTH_COMPONENT16, /* can also be 24-bit */ | |||
| multisamplingMode: GL_MULTISAMPLING_4X_SQUARE_ROTATED_SCE, | |||
| width: 720, | |||
| height: 480, | |||
| }; | |||
| /* Find closest valid resolution */ | |||
| ivec2 const valid_resolutions[8] = | |||
| { | |||
| ivec2( 720, 480), | |||
| ivec2( 720, 576), | |||
| ivec2(1280, 720), | |||
| ivec2(1920, 1080), | |||
| ivec2( 960, 1080), | |||
| ivec2(1280, 1080), | |||
| ivec2(1440, 1080), | |||
| ivec2(1600, 1080), | |||
| }; | |||
| for (int i = 0; i < 8; ++i) | |||
| { | |||
| ivec2 cur(psgldp.width, psgldp.height); | |||
| if (sqlength(valid_resolutions[i] - res) < sqlength(cur - res)) | |||
| { | |||
| psgldp.width = valid_resolutions[i].x; | |||
| psgldp.height = valid_resolutions[i].y; | |||
| } | |||
| } | |||
| /* Create graphics device */ | |||
| PSGLdevice* psgl = psglCreateDeviceExtended(&psgldp); | |||
| if (!psgl) | |||
| Log::Error("could not create PSGL device; expect imminent crash\n"); | |||
| GLuint w, h; | |||
| psglGetDeviceDimensions(psgl, &w, &h); | |||
| res = ivec2(w, h); | |||
| ivec2 newres(w, h); | |||
| Log::Debug("resolution asked %d×%d, closest valid %d×%d, final %d×%d\n", | |||
| res.x, res.y, psgldp.width, psgldp.height, newres.x, newres.y); | |||
| PSGLcontext *ctx = psglCreateContext(); | |||
| psglMakeCurrent(ctx, psgl); | |||
| @@ -101,7 +142,7 @@ Ps3App::Ps3App(char const *title, ivec2 res, float fps) : | |||
| /* Initialise everything */ | |||
| Ticker::Setup(fps); | |||
| Video::Setup(res); | |||
| Video::Setup(newres); | |||
| Audio::Setup(2); | |||
| /* Autoreleased objects */ | |||