blackberry / SDL

Simple DirectMedia Layer is an open-source, cross-platform multimedia library designed to provide a low level API.
GNU Lesser General Public License v2.1
86 stars 46 forks source link

Problem setting video mode #21

Closed hamlatzis closed 12 years ago

hamlatzis commented 12 years ago

I'm trying to port a game of mine from webOS to PlayBook which uses SDL.

I've downloaded SDL (emulate branch: blackberry-SDL-d8ad2b9) and the master branch for TouchControlOverlay (blackberry-TouchControlOverlay-437dfb5)

I use the latest NDK and the simulator under Windows XP using eclipse and have set my project as managed.

In my main I initialise SDL as follows:

int main(int argc, char *argv[]) { // init SDL. This function is all it takes to init both // the audio and video. int result = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE ); atexit(SDL_Quit); if ( result < 0 ) return result;

SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);

const int nScreenWidth = 1024;
const int nScreenHeight = 600;

SDL_Surface* pSurface = SDL_SetVideoMode(nScreenWidth, nScreenHeight, 0, SDL_OPENGL | SDL_FULLSCREEN);
if ( !pSurface )
{
    fprintf( stderr, "Video mode set failed: %s\n",
                 SDL_GetError( ) );
    return 1;
}

....................................... }

It fails to return a valid surface with error message: "Video mode set failed: No video mode large enough for 1024x600". I thought PlayBook's resolution was 1024x600. I've tried to create a smaller surface (640x480) and it succeeds but I need the higher resolution.

I even downloaded the sample SDL_GL (https://github.com/asimonov-rim/SDL_GL) but I get the same error message.

jnicholl commented 12 years ago

That seems strange to me, but I haven't actually tested on simulator at all. Do you know if the problem also exists on device?

hamlatzis commented 12 years ago

I don't have a device yet. I couldn't buy here in Greece the device and ordering it from Europe was too expensive for me (around 600euro) so I've asked my sister who is in the UK to buy one for me (250pounds - have the euro price) and I'm waiting for her to come home for her summer vacations (in two weeks time). Until then I'm stack with the simulator.

jnicholl commented 12 years ago

I'll try to investigate, I'm setting up the simulator now.

-----Original Message----- From: hamlatzis [mailto:reply@reply.github.com] Sent: Wednesday, June 06, 2012 1:56 PM To: Jeremy Nicholl Subject: Re: [SDL] Problem setting video mode (#21)

I don't have a device yet. I couldn't buy here in Greece the device and ordering it from Europe was too expensive for me (around 600euro) so I've asked my sister who is in the UK to buy one for me (250pounds - have the euro price) and I'm waiting for her to come home for her summer vacations (in two weeks time). Until then I'm stack with the simulator.


Reply to this email directly or view it on GitHub: https://github.com/blackberry/SDL/issues/21#issuecomment-6157677


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

jnicholl commented 12 years ago

I've found a fix. Apparently simulator doesn't support SCREEN_PROPERTY_NATIVE_RESOLUTION and was returning 0x0 as the native resolution of the display. Should be fixed with https://github.com/blackberry/SDL/commit/b7631ef912515f5435fdb1ce288274706446378b

hamlatzis commented 12 years ago

Thank you it worked perfectly.