Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-04-2009, 05:43 AM
|
#1
|
|
LQ Newbie
Registered: Apr 2007
Location: Gdynia, Poland
Distribution: Fedora 10/11
Posts: 22
Rep:
|
Possible screen resolutions in C/C++
Hi!
I am writing a game in OpenGL and I have encountered a problem.
I cannot find a way to get all possible screen resolutions.
SDL is not much of help unfortunately as SDL_ListModes tells me that "all resolutions are supported" which is pretty much useless :/
I have been looking for the xrandr code, and I found it a bit overwhelming :/
Can anyone help me find a solution, or at least provide some hints?
thanks 
|
|
|
|
08-04-2009, 06:40 AM
|
#2
|
|
Member
Registered: Oct 2005
Posts: 970
Rep: 
|
SDL_GetVideoInfo
Quote:
If it is called before SDL_SetVideoMode, the vfmt member of the returned structure will contain the pixel format of the best video mode.
... This read-only structure is returned by SDL_GetVideoInfo. It contains information on either the best available mode if called before SDL_SetVideoMode or the current video mode if called after SDL_SetVideoMode.
|
Last edited by dmail; 08-04-2009 at 06:45 AM.
|
|
|
|
08-04-2009, 07:09 AM
|
#3
|
|
LQ Newbie
Registered: Apr 2007
Location: Gdynia, Poland
Distribution: Fedora 10/11
Posts: 22
Original Poster
Rep:
|
Thanks but SDL_GetVideoInfo is also useless as it only gives me the CURRENT resolution :/
|
|
|
|
08-04-2009, 07:20 AM
|
#4
|
|
Member
Registered: Oct 2005
Posts: 970
Rep: 
|
Code:
std::list<LVD::Renderer::Resoultion> create_mode_list()
{
SDL_PixelFormat format;
SDL_Rect **modes;
std::list<Resoultion_entry> mode_list;
int loops(0);
int bpp(0);
do
{
//format.BitsPerPixel seems to get zeroed out on my windows box
switch(loops)
{
case 0://32 bpp
format.BitsPerPixel = 32;
bpp = 32;
break;
case 1://24 bpp
format.BitsPerPixel = 24;
bpp = 24;
break;
case 2://16 bpp
format.BitsPerPixel = 16;
bpp = 16;
break;
}
//get available fullscreen/hardware modes
modes=SDL::SDL_ListModes(&format, SDL_FULLSCREEN);
if(modes)
{
for(int i=0;modes[i];++i)
{
LVD::Renderer::Resoultion entry(modes[i]->w,modes[i]->h, bpp/*format.BitsPerPixel*/, 0);
mode_list.push_back(entry);
}
}
}while(++loops != 3);
return mode_list;
}
Last edited by dmail; 08-04-2009 at 07:23 AM.
Reason: fixed tab spacing
|
|
|
|
08-04-2009, 07:54 AM
|
#5
|
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2012.8, Slack1337 DebSqueeze, +50+ other Linux OS, for test only.
Posts: 11,626
|
Do you mean
640x480, 800x600, 1024x768, 1152x864, 1280x768, 1280x960, 1280x1024
like the settings in 'gl-117' ?
http://www.heptargon.de/gl-117/gl-117.html
(( gl-117-1.3.2-src/src/conf.cpp ))
.....
Other OpenGL game with res. settings : Emilia Pinball
http://pinball.sourceforge.net/
.....
Last edited by knudfl; 08-04-2009 at 07:58 AM.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 03:05 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|