SDL can't run 1024x1280 screen

Member
Posts: 321
Joined: 2004.10
Post: #1
The following SDL code on a Mac Mini G4 with 512 Meg Ram:

Code:
// Check if or resolution is restricted
      if(modes == (SDL_Rect **)-1)
      {
          cout << "All resolutions available" << endl;
      }
      else
      {
         // Print valid modes */
         cout << "Available Modes" << endl;
         for(int i = 0; modes[i]; ++i)
         {
            cout << "modes width and height " << modes[i]->w << " x " << modes[i]->h << endl;            
         }

      }    

      flags = SDL_OPENGL | SDL_FULLSCREEN | /*SDL_DOUBLEBUF*/ SDL_SWSURFACE;  // SDL_HWSURFACE      
      screen = SDL_SetVideoMode(gHeight, gWidth, 0, flags);  
      
      if ( screen == NULL )
      {
         cout << endl << SDL_GetError() << endl;
         exit(1);
      }

Produces the following:

Quote:Available Modes
modes width and height 1280 x 1024
modes width and height 1280 x 960
modes width and height 1024 x 820
modes width and height 1024 x 768
modes width and height 800 x 640
modes width and height 800 x 600
modes width and height 640 x 512
modes width and height 640 x 480
gHeight = 1024
gWidth = 1280

No video mode large enough for 1024x1280

I've played with flag settings for hours. The largest screen
I've been able to bring up is 1024x1024. Close but no cigar.
Anybody have any suggestions? Thanks.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #2
That's because you don't have a resolution available with a height of 1280. I'm guessing what you really want is 1280x1024.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
You seem to have height & width backward in your call to SetVideoMode....
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #4
Yes, that solved ALL my problems. Not one of my prouder moments.

THANKS!
Quote this message in a reply
Jones
Unregistered
 
Post: #5
Noticed you attached SDL_SWSURFACE to your flags, is that a valid combination, SDL_OPENGL and SDL_SWSURFACE?
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #6
That was just a copy and paste job, so I assume it is OK. No problems.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
Whether it's legal or not, it doesn't make much sense, and could easily cause severe problems...
Quote this message in a reply
Jones
Unregistered
 
Post: #8
I've got several questions about SDL now...

In samples I've seen here and here and here people combine SDL_DOUBLEBUF, SDL_OPENGL and/or SDL_**SURFACE (** = HW | SW).

As far as I know, these are *all* incorrect. SDL_OPENGL can only be combined with SDL_FULLSCREEN. All other properties are set with SDL_GL_SetAttribute().

Am I missing something or are many people using SDL incorrectly? Wacko Huh

Thanks!
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #9
I think you're write that they're incorrect, but I'm assuming that if it sees SDL_OPENGL it ignores all else that doesn't make sense. (otherwise all these examples would break. Rasp) I know that SDL_*SURFACE is for non-OpenGL, but I'm not 100% sure whether SDL_DOUBLEBUF does anything or not with OpenGL. (it could have a bearing over whether or not the window is double buffered)
Quote this message in a reply
Jones
Unregistered
 
Post: #10
Thanks for clearing that up, akb.
Quote this message in a reply
Moderator
Posts: 691
Joined: 2002.04
Post: #11
akb825 Wrote:I'm not 100% sure whether SDL_DOUBLEBUF does anything or not with OpenGL
It doesn't; to specify that SDL should create a double-buffered OpenGL context, you should call...
Code:
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 )
...before the call to SDL_SetVideoMode(); if SDL_OPENGL is passed as a flag to SDL_SetVideoMode(), I believe the only other flag which will have any meaning is SDL_FULLSCREEN - it is my experience that any flag but this will be ignored.

Mark Bishop
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL full screen mode leaves garbage on screen when exiting app Malarkey 5 4,940 Nov 19, 2008 12:51 PM
Last Post: Malarkey