Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Pic.ScreenLoad vs Pic.Draw
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Wolf_Destiny




PostPosted: Fri Nov 17, 2006 11:18 pm   Post subject: Pic.ScreenLoad vs Pic.Draw

Okay so I've been working on this 3d game, and I'm thinking of saving the school computers the work of dealing with more polygons for the enemies, so I'll probably use bitmaps or pngs or some such thing. Anyways what I was wondering is whether Pic.ScreenLoad is faster than Pic.Draw or vice-versa because up until now I've used Pic.ScreenLoad for its simplicity even though I do know how to use Pic.Draw. Just wondering so that I can use the faster option if anyone knows.

Is there even a difference? If anyone knows I'd appreciate it!
~Wolf_Destiny
Sponsor
Sponsor
Sponsor
sponsor
ericfourfour




PostPosted: Fri Nov 17, 2006 11:26 pm   Post subject: (No subject)

For Pic.ScreenLoad Turing has to parse the picture file and then display it. With Pic.Draw it is already on the memory from Pic.New.
DemonZ




PostPosted: Fri Nov 17, 2006 11:46 pm   Post subject: (No subject)

Pic.Draw is the faster approach since when your using Pic.ScreenLoad, it is accessing and loading it up in the program, while with Pic.New or FileNew, it is already in turings memory and is used with ease, though there is an issue that if you have lets say a 1000 pics on the screen at one time, it will crash turing because the memory has been overloaded, so youll have to use Pic.Free to free up space on turings memory. If u wanna know how to use Pic.Draw, read up on the tutorials on this site, or check the help file, i would explain it to you but Im really tired and lazy to do it.
zylum




PostPosted: Sat Nov 18, 2006 1:03 am   Post subject: (No subject)

benchmarking tutorial
ericfourfour




PostPosted: Sat Nov 18, 2006 1:12 am   Post subject: (No subject)

Well, what is faster to do.

code:
(Pic.ScreenLoad)
1. read information from file
2. allocate memory
3. store information in memory
4. read information from memory
5. display it on the screen
6. delete allocated memory
repeat from 1.


code:
(Pic.FileNew/Pic.Draw)
1. read information from file
2. allocate memory
3. store information in memory
4. read information from memory
5. display it on the screen
repeat from 4 until done
6. delete allocated memory
TokenHerbz




PostPosted: Sat Nov 18, 2006 1:28 am   Post subject: (No subject)

constantly saving and clearing a picture isn't good, or so i think...

it be best to keep this pic in memory (if your using it alot)...
TokenHerbz




PostPosted: Sat Nov 18, 2006 1:29 am   Post subject: (No subject)

an example i have, would be with my game.

When i draw my tiles, i save the "final" map as a pic.

this pic i use, untill it changes, thus id save that pic.

this is much more effective then constantly drawing that tile map.
ericfourfour




PostPosted: Sat Nov 18, 2006 1:50 am   Post subject: (No subject)

I'm afraid you should not do a tile map like that. The main reason tile maps were created was to save memory. You're not saving memory by making a completely new picture out of all of the tiles.

You should draw every tile that you need to draw. Drawing every tile on the screen is enough but drawing every tile and then saving it as a picture is worse. With drawing every tile there is also room for optimizations. These could include, not redrawing tiles that have not moved or been drawn on or only drawing the tiles that are visible in the display area. This means you total picture could be 2048x2048 pixels (4 194 304 pixels) but you only end up needing to draw 16 tiles at 32x32 (16x32x32 = 16 384 pixels). That is 1/256 the amount of pixels!

The main slowdowns with creating a completely new picture is allocating the memory and deleting it. These two things are what programmers want to be at a minimum in every program. All memory allocations/deallocations should be done while loading not in game play.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: