LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 12-24-2004, 05:58 PM   #1
edmundo_ba
Member
 
Registered: Jun 2004
Location: Buenos Aires
Distribution: kubuntu 20.04, Slackware64 14.2
Posts: 43

Rep: Reputation: 15
Question Problem with SDL_GetVideoInfo


I tried to get info from the video system with the SDL_GetVideoInfo , and the only field that gives an acceptable value is the one concerning the windows manager (it finds one).But every other field in the SDL_ViedoInfo is zero. This is the code I use:

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

int main()
{
const SDL_VideoInfo *informacion;

if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}
atexit(SDL_Quit);

informacion = SDL_GetVideoInfo();

cout << "hw_available : " << informacion->hw_available << endl;
cout << "wm_available : " << informacion->wm_available << endl;
cout << "blit_hw : " << informacion->blit_hw << endl;
cout << "blit_hw_CC : " << informacion->blit_hw_CC << endl;
cout << "blit_hw_A : " << informacion->blit_hw_A << endl;
cout << "blit_sw : " << informacion->blit_sw << endl;
cout << "blit_sw_CC : " << informacion->blit_sw_CC << endl;
cout << "blit_sw_A : " << informacion->blit_sw_A << endl;
cout << "blit_fill : " << informacion->blit_fill << endl;
cout << "video_mem : " << informacion->video_mem << endl;

return 0;
}

I have an NVidia card, using KDE 3.2 in Slackware 10.0
 
Old 12-24-2004, 07:44 PM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
If Hardware is not available, then the rest of the hw, sw checks are a waste. ( how do you measure the video mem when theirs no hardware support? ).

I would of through that the software value would of returned something though. Hmm. how about

const SDL_VideoInfo *infomacion = SDL_GetVideoInfo();

Instead of declaring it at the beginning, declare where you initialize ( which is normal C++ practice anyway ).

Also try

cout << "Bits per pixel : " informacion->vfmt->BitsPerPixel << endl;

at the end of the list.
 
Old 12-27-2004, 08:32 PM   #3
edmundo_ba
Member
 
Registered: Jun 2004
Location: Buenos Aires
Distribution: kubuntu 20.04, Slackware64 14.2
Posts: 43

Original Poster
Rep: Reputation: 15
thanks leonscape. I know I should initialize the SDL_Video pointer at the beginning. The code I posted is one of the many trials I wrote.

So it seems that there is no need to initialize the SDL video subsystem before asking the video information with SDL_GetVideoInfo.
 
Old 12-28-2004, 04:51 AM   #4
Marius2
Member
 
Registered: Jan 2004
Location: Munich
Distribution: SuSE 9.2, 10.2, 10.3, knoppix
Posts: 276

Rep: Reputation: 31
Which driver are you using? SVGA, VESA, the NVidia driver? There is
certainly no hw acceleration with SVGA and probably not with the
VESA driver, so 0 in these fields would be a reasonable value.
 
Old 12-28-2004, 08:56 AM   #5
edmundo_ba
Member
 
Registered: Jun 2004
Location: Buenos Aires
Distribution: kubuntu 20.04, Slackware64 14.2
Posts: 43

Original Poster
Rep: Reputation: 15
I'm using the NVidia driver. All the applications that use graphics run fine, also opengl is working perfectly.

So I asume that the hardware is capable of accelerating graphic operation, but I'm not able to check this.
The Video Card is GeForce2 with 32mb (Teppro)
I think maybe the NVidia driver is not giving the right information.
 
Old 12-28-2004, 01:49 PM   #6
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
SDL will always report No hardware accelaration except for certain drivers it's tuned for ( DGA ).

OpenGL will be accelerated ( with the NVidia drivers ) despite what SDL reports, as what SDL is reporting on is its ability to accelarate 2D graphics ( blitting and stuff ). The HW Acceleration for 3D is handled by OpenGL and has very littile to do with SDL directly.

I think thats accurate, its what I've been lead to believe when using SDL.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 07:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration