The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Get supported resolutions?
^DJ_Link^


Joined: 10 Jun 2011
Posts: 28
Hi everyone.

Is there any way to get the supported resolutions?
I'm using OpenGL.
sdl
necron


Joined: 10 Dec 2011
Posts: 33
sdl can do that. I clicked "index" in the "docs" folder and then clicked "video". It said this is a supported function: SDL_ListModes
How to get SDL_ListModes Work?
rashmi


Joined: 02 Jul 2012
Posts: 5
Hello Team,
We were running this sample example to findout the available modes, on the LCD tv.

#include <SDL/SDL.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
/* Information about the current video settings. */
/* Initialize defaults, Video and Audio */
SDL_Rect **fullmodes;
int i;
if((SDL_Init(SDL_INIT_EVERYTHING)) < 0) {
printf("Could not initialize SDL: %s.\n", SDL_GetError());
exit(-1);
}
const SDL_VideoInfo *vidInfo = NULL;
vidInfo = SDL_GetVideoInfo ();

/* collect all fullscreen & hardware modes available */
if (!(fullmodes = SDL_ListModes (vidInfo->vfmt,SDL_OPENGL))) {

for(i=0;fullmodes[i];++i)
printf( "SDL Mode: %d: %d x %d\n", i, fullmodes[i]->w, fullmodes[i]->h);
}
else {

printf("FullMode Eror\n");
}


}
The program always fails to list the fullmode.

~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.2.10++ |~~~~~~~~~~~~~~~~~~~~~~~~~
(c) 2007-2009 Intel Corporation
(c) 2001-2008 The world wide DirectFB Open Source Community
(c) 2000-2004 Convergence (integrated media) GmbH
----------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2011-06-09 00:06)
(*) IntelCE/Systems: Available GDL driver memory: 55MB of 70MB
(*) Direct/Thread: Started 'Hotplug with Linux Input' (3070) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: Hotplug detecting enabled with Linux Input Driver
(*) DirectFB/Genefx: MMX detected and enabled
(*) IntelCE/GfxDriver: Using OpenGL ES 1.1 graphics library
(*) IntelCE/GfxDriver: Using SRB graphics library
(*) DirectFB/Graphics: Intel Corporation Intel_CE Graphics Driver 2.0 (Intel Corporation)
(*) DirectFB/Core/WM: Default 0.3 (directfb.org)
FullMode Eror
(!!!) *** WARNING [Application exited without deinitialization of DirectFB!] *** [core.c:871 in dfb_core_deinit_check()]
(!!!) *** WARNING [still 1 objects in pool:'Layer Region Pool'] *** [object.c:359 in fusion_object_pool_destroy()]
(!!!) *** WARNING [still 1 objects in pool:'Layer Context Pool'] *** [object.c:359 in fusion_object_pool_destroy()]

Hardware:
IntelAtomProcessor connected to LCD tv thru A/V out .DirectFb example programs are working fine and displays pictures and screen savers on TV.

http://en.wikipedia.org/wiki/List_of_Intel_Atom_microprocessors#CE_processors
SDL-1.2 Version.
Direct FB-1.2.10.
Debian-5.0.8
Any Help on this will be really helpful.
Thanks,
Rashmi
^DJ_Link^


Joined: 10 Jun 2011
Posts: 28
Well I'm using this for detection on Win32

Code:

DISPLAY_DEVICE   display;
   int            displaynum = 0;
   memset(&display, 0, sizeof(display));
   display.cb = sizeof(display);

   // Monitor List
   while(EnumDisplayDevices(NULL, displaynum++, &display, NULL))
   {
      // Default monitor
      if (display.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
      {
         DEVMODE   devmode;
         memset(&devmode, 0, sizeof(devmode));
         devmode.dmSize = sizeof(devmode);
         int num = 0;
         while (EnumDisplaySettings(display.DeviceName, num++, &devmode))
         {
                               // We only want stuff bigger than 640x480 probably
            if (devmode.dmBitsPerPel >=16 && devmode.dmPelsWidth >= 640 && devmode.dmPelsHeight >= 480)
            {
               
               /* Important stuff
               devmode.dmPelsWidth
               devmode.dmPelsHeight
               devmode.dmDisplayFrequency
               devmode.dmBitsPerPel
                                         */               

               // Push to list
            }
         }
      }
   }



Hope it helps
How to get SDL_ListModes Work?
rashmi


Joined: 02 Jul 2012
Posts: 5
SDL_LISTMODES is being used by Mplayer and Mplayer crashes, when it tries to access the fullmodes.
Even if we add a NULL pointer check the functionality does not work , when i tried the example program i get to see that
SDL_ListModes is not working as per documentation, so it is very important for me to get the example program working so that Mplayer also runs fine.
SO any help on successfully using this function is very much appreciated.
SDL_Rect **fullmodes;
if (!(fullmodes = SDL_ListModes (vidInfo->vfmt,SDL_SWSURFCE|SDL_FULLSCREEN))) {

for(i=0;fullmodes[i];++i)
printf( "SDL Mode: %d: %d x %d\n", i, fullmodes[i]->w, fullmodes[i]->h);
}