[SOLVED]OpenGL and SDL regular lags
Moderator: Coders of Rage
- Milch
- Chaos Rift Junior
- Posts: 241
- Joined: Sat Jul 11, 2009 5:55 am
- Programming Language of Choice: C++
- Location: Austria, Vienna
[SOLVED]OpenGL and SDL regular lags
Hey!
In my SDL+OpenGL program I experienc regular lags every 5 seconds or so.
It does that on every pc I tested - from ultra low to ultra high.
I cant post the whole sourcecode because its a large project and I just wanted to know if anyone experienced similar problems with SDL+OpenGL. ( or only with OpenGL )
Just for the info - it has to do with the rendering.
I disabled everything ( input, collision,...) but the lag still occurs =/
I only use ortho in the game - its a 2d jump and run game.
In my SDL+OpenGL program I experienc regular lags every 5 seconds or so.
It does that on every pc I tested - from ultra low to ultra high.
I cant post the whole sourcecode because its a large project and I just wanted to know if anyone experienced similar problems with SDL+OpenGL. ( or only with OpenGL )
Just for the info - it has to do with the rendering.
I disabled everything ( input, collision,...) but the lag still occurs =/
I only use ortho in the game - its a 2d jump and run game.
Last edited by Milch on Thu Jan 14, 2010 6:43 am, edited 1 time in total.
Follow me on twitter!
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: OpenGL and SDL regular lags
Never seen lag in any of my SDL / OGL projects. I've seen things run REALLY slow, but always at a constant speed.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
-
- Chaos Rift Junior
- Posts: 345
- Joined: Tue Jan 12, 2010 7:23 pm
- Favorite Gaming Platforms: PC - Windows 7
- Programming Language of Choice: c++;haxe
- Contact:
Re: OpenGL and SDL regular lags
There is any number of things that could create this programming wise. There IS a known de-sync issue on dual-core/quad-core processors in WinXP, but it generally happens quicker, ie, 1-2 seconds max. It affects other programs, especially other games, but not all programs/games have the issue. It can be patched though.
What you may find is your doing something every 5 seconds that causes the lag (Loading a whole bunch of resources, reinitialising stuff, doing 10-trillion calculations in a single frame, etc). I'd look very close at anything in your code that checks at regular exact intervals (250ms/500ms/1s/5s) even if it's not meant to be triggering during play. You may find it somehow got past you and is still doing stuff in the background, such as reloading all resources. Past that there's obviously some kind programming bug at work here.
What you may find is your doing something every 5 seconds that causes the lag (Loading a whole bunch of resources, reinitialising stuff, doing 10-trillion calculations in a single frame, etc). I'd look very close at anything in your code that checks at regular exact intervals (250ms/500ms/1s/5s) even if it's not meant to be triggering during play. You may find it somehow got past you and is still doing stuff in the background, such as reloading all resources. Past that there's obviously some kind programming bug at work here.
- Lord Pingas
- Chaos Rift Regular
- Posts: 178
- Joined: Thu Dec 31, 2009 9:33 am
- Favorite Gaming Platforms: NES, SNES, Nintendo 64, Dreamcast, Wii
- Programming Language of Choice: C++
- Location: Hiding In My Mum's Basement With My Pokemon Cards
Re: OpenGL and SDL regular lags
Perhaps it has something to do with the frames per second?
Sorry, I don't know much when it comes to game programming. Still learning the language.
Sorry, I don't know much when it comes to game programming. Still learning the language.
- Milch
- Chaos Rift Junior
- Posts: 241
- Joined: Sat Jul 11, 2009 5:55 am
- Programming Language of Choice: C++
- Location: Austria, Vienna
Re: OpenGL and SDL regular lags
Thank you, Lord Pingas ;D
I just checked my fps-regulating function - this is where the lag came from. :D
I just checked my fps-regulating function - this is where the lag came from. :D
Follow me on twitter!
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: OpenGL and SDL regular lags
Lord Pingas wrote:Perhaps it has something to do with the frames per second?
Sorry, I don't know much when it comes to game programming. Still learning the language.
Milch wrote:Thank you, Lord Pingas ;D
I just checked my fps-regulating function - this is where the lag came from. :D
- Milch
- Chaos Rift Junior
- Posts: 241
- Joined: Sat Jul 11, 2009 5:55 am
- Programming Language of Choice: C++
- Location: Austria, Vienna
Re: [SOLVED]OpenGL and SDL regular lags
Wow - something strange happened.
I changed this and that - and came to the conclusion that NOTHING was wrong.
I took out my fps-function and reimplemented it again and all of a sudden everything worked with no lag oO
MinGW is strange...or am I? <.<
I changed this and that - and came to the conclusion that NOTHING was wrong.
I took out my fps-function and reimplemented it again and all of a sudden everything worked with no lag oO
MinGW is strange...or am I? <.<
Follow me on twitter!
- RyanPridgeon
- Chaos Rift Maniac
- Posts: 447
- Joined: Sun Sep 21, 2008 1:34 pm
- Current Project: "Triangle"
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C/C++
- Location: UK
- Contact:
Re: OpenGL and SDL regular lags
Ditto on that.GyroVorbis wrote:Lord Pingas wrote:Perhaps it has something to do with the frames per second?
Sorry, I don't know much when it comes to game programming. Still learning the language.Milch wrote:Thank you, Lord Pingas ;D
I just checked my fps-regulating function - this is where the lag came from. :D
Re: OpenGL and SDL regular lags
Same here...RyanPridgeon wrote:Ditto on that.GyroVorbis wrote:Lord Pingas wrote:Perhaps it has something to do with the frames per second?
Sorry, I don't know much when it comes to game programming. Still learning the language.Milch wrote:Thank you, Lord Pingas ;D
I just checked my fps-regulating function - this is where the lag came from. :D
- Lord Pingas
- Chaos Rift Regular
- Posts: 178
- Joined: Thu Dec 31, 2009 9:33 am
- Favorite Gaming Platforms: NES, SNES, Nintendo 64, Dreamcast, Wii
- Programming Language of Choice: C++
- Location: Hiding In My Mum's Basement With My Pokemon Cards
Re: OpenGL and SDL regular lags
OMG, I'm a miracle maker! I Guess from now on you can refer to me as MASTER Lord Pingas.XianForce wrote:Same here...RyanPridgeon wrote:Ditto on that.GyroVorbis wrote:Lord Pingas wrote:Perhaps it has something to do with the frames per second?
Sorry, I don't know much when it comes to game programming. Still learning the language.Milch wrote:Thank you, Lord Pingas ;D
I just checked my fps-regulating function - this is where the lag came from. :D
Glad I could help.
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: [SOLVED]OpenGL and SDL regular lags
My guess is that you had something else running in the background (not in your program, but rather a completely different process on your computer). Although it never hurts to check for major memory leaks (Task Manager, see if your process's memory usage is skyrocketing rather quickly after the initial resource loading).Milch wrote:Wow - something strange happened.
I changed this and that - and came to the conclusion that NOTHING was wrong.
I took out my fps-function and reimplemented it again and all of a sudden everything worked with no lag oO
MinGW is strange...or am I? <.<
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!