LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 03-19-2011, 09:03 AM   #1
ekuaL
LQ Newbie
 
Registered: Mar 2011
Location: Berlin
Posts: 2

Rep: Reputation: 2
OpenGL / SDL: crossplatform performance


While i was searching the internet google often answered with linuxquestions.org. Now where i cant find an answer through google i thought i'll register myself in here. Because you guys helped me alot without knowing it Thank you so far!

Now, here i am!^^

I used to write some programs in ANSI C, OpenGL and xf86 (X11). Everything is working well. Now i want my programs to run under windows XP/Vista/7 too. As far as i read at LQ SDL is an API which provides me with a window and other stuff i need, like sound. My Questions are now:

Do i have lost in performance programming with sdl instead of glx and x11? How "much" do i lose?

Do i get more performance when i program seperate glx/x11 and gl/WinAPI? sure, i have to program each thing twice. like window initialization and keymapping.

ekual

before i forgot: i already searched the forum.
 
Old 03-19-2011, 09:26 AM   #2
SigTerm
Member
 
Registered: Dec 2009
Distribution: Slackware 12.2
Posts: 379

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by ekuaL View Post
Do i have lost in performance programming with sdl instead of glx and x11? How "much" do i lose?
You know, you could simply compile and test the application instead of asking.

Anyway... unless your application should be able to render pictures at 5000 frames per second, I wouldn't worry much about performance - that, in my opinion, is a premature optimization.

The point of SDL (and other toolkits) is that you get one program version to babysit instead of several. I cannot give you glx vs SDL comparison, but SDL speed is comparable with what you can get by using WinAPI + OpenGL + DirectInput (for keyboard/mouse) on windows platform. Disable vsync, and achieving few hundreds frames per second won't be a problem. There may be few percents difference, though, but it'll be hard to notice.

In my opinion, you should not worry about performance (unless you have some really heavy graphic-related stuff) until you run into problem, and you should not worry about providing several platform-dependent versions to manage OpenGL, until you have to do that - that'll be premature optimization. Make your app, test it, and once it is working as expected, you can start finetuning. Even with SDL, you may run into some compiler-related cross-platform quirks (non standard functions like vsprintf can be implemented differently, non-standard sprintf parameters can behave differently, and so on), so you'll have things to do before optimizing.
 
Old 03-19-2011, 09:44 AM   #3
ekuaL
LQ Newbie
 
Registered: Mar 2011
Location: Berlin
Posts: 2

Original Poster
Rep: Reputation: 2
Maybe i am just too much afraid. I like clean code and so i have a voice in my mind that everything i want to code must be written in plain c and OpenGL functions

I'll take a deeper look into SDL and just give it a try tho i have the feeling of losing the overview and i dont know what my code does exactly. Looks like i have to read the sdl header files.

thanks for your advice.
 
  


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
Bad opengl performance with two or more OpenGL windows on nvidia drivers (GF 7600 GS) psokol Linux - Software 0 02-21-2009 10:40 AM
Java vs OpenGL vs SDL vs ????? LinuxNoob75 Programming 12 12-08-2007 04:30 PM
Using SDL/OpenGL, need help. kornerr Programming 33 11-19-2005 11:19 PM
Using OpenGL (+SDL) for 2D programs R00ts Programming 4 07-16-2004 12:33 PM
OpenGL lighting with SDL MadCactus Programming 0 09-21-2003 11:52 AM

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

All times are GMT -5. The time now is 04:16 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