SFML community forums
Help => Graphics => Topic started by: wademcgillis on February 13, 2010, 07:22:30 pm
-
SFML's graphics rendering is supposed to be faster than Game Maker, right?
Well, I'm trying to display two 512x512 png images on the screen, and the framerate drops drastically.
http://www.wademcgillis.com/downloads/stupidcode.zip
-
SFML's graphics rendering is supposed to be faster than Game Maker, right?
I have no idea, I don't know how Game Maker is implemented, and I've never used it.
Well, I'm trying to display two 512x512 png images on the screen, and the framerate drops drastically
Can you show your code?
http://www.wademcgillis.com/downloads/stupidcode.png
This link doesn't work.
-
Are you sure you're not also loading the images every frame?
-
http://www.wademcgillis.com/downloads/stupidcode.png
This link doesn't work.
Oops. I wrote png instead of zip
Are you sure you're not also loading the images every frame?
Yes. I'm sure.
-
I've done a comparison of Game Maker and SFML before. SFML was much faster at everything. It's most likely your code. Also, your code is VERY messy and unsafe. You call new a lot but I don't see you calling delete anywhere!
-
I've done a comparison of Game Maker and SFML before. SFML was much faster at everything. It's most likely your code. Also, your code is VERY messy and unsafe. You call new a lot but I don't see you calling delete anywhere!
How do I call new "a lot"? Each new only gets called once, it's not like it's a memory leak since the game goes out of memory when it closes.
Also, my code is very readable in my perspective. I'd probably think your code is very messy too.
-
I've done a comparison of Game Maker and SFML before. SFML was much faster at everything. It's most likely your code. Also, your code is VERY messy and unsafe. You call new a lot but I don't see you calling delete anywhere!
How do I call new "a lot"? Each new only gets called once, it's not like it's a memory leak since the game goes out of memory when it closes.
Also, my code is very readable in my perspective. I'd probably think your code is very messy too.
By "a lot", I mean "multiple times without calling delete". If you use new, your objects will NEVER go out of scope, because new defines them OUTSIDE of your program's scope, on the GLOBAL heap. You need to call delete to make them go out of scope. If you don't, they won't go out of scope until the computer is shut down.
-
Also, my code is very readable in my perspective. I'd probably think your code is very messy too.
I have not seen OniLink10's code, but have seen yours. Sorry but it's really a mess. Not only because of allocating memory without freeing it. Classes and c-stylish free functions, lumps of implementation code in *.h files that should be placed in *.cpp files, and so on... No offense, just my friendly opinion. :wink:
-
Also, my code is very readable in my perspective. I'd probably think your code is very messy too.
I have not seen OniLink10's code, but have seen yours. Sorry but it's really a mess. Not only because of allocating memory without freeing it. Classes and c-stylish free functions, lumps of implementation code in *.h files that should be placed in *.cpp files, and so on... No offense, just my friendly opinion. :wink:
I have never been able to link multiple cpp files together. Well, I have... but never when code in one cpp file depends on code in another. If I try to do that, "multiple defintion. ur code is fubar'd"
edit1: This wasn't a discussion of my code. This is a discussion of why, when I display two 512x512 textures, the game runs like poo.
edit2: wow. All openGL based games are doing this. Sorry, it wasn't a problem with SFML...
-
edit: how did I double post?
-
Maybe you just need to update your graphics drivers.
-
Maybe you just need to update your graphics drivers.
I started doing that right before you made that post.
-
I've done a comparison of Game Maker and SFML before. SFML was much faster at everything. It's most likely your code. Also, your code is VERY messy and unsafe. You call new a lot but I don't see you calling delete anywhere!
How do I call new "a lot"? Each new only gets called once, it's not like it's a memory leak since the game goes out of memory when it closes.
Also, my code is very readable in my perspective. I'd probably think your code is very messy too.
If you have pointers pointing to a variable using new, then the pointers go out of scope but the data they point to doesn't.