Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Using memblocks or blitting for rendering?

Author
Message
jayandy
20
Years of Service
User Offline
Joined: 14th Sep 2004
Location:
Posted: 19th Oct 2004 03:27 Edited at: 19th Oct 2004 03:29
Can someone explain to me how to draw, say using the circle command to a memblock, then display it.

Or if that isn't possible, how can I create some section of memory, using the simple 2D commands, off screen, then blit them to the screen for better preformance.

Here's some code I'm trying to speed up:
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Oct 2004 06:54
Let's go for simpler stuff first ...

1 - You haven't set a SYNC RATE, so your rate is locked to approx 40fps. Put a line 'SYNC RATE 0' after the 'SYNC ON' command.

2 - Circles with a radius of 0 just draw dots, so your Plot_PenPoint function could be changed to this:



3 - Drawing directly to the display requires that the display memory be locked each time you issue a 2D command. You can take over this control yourself, by locking and unlocking only when you need to by using the LOCK PIXELS and UNLOCK PIXELS commands in the appropriate place. Change your main loop to this:



That's just 3 suggestions for a large speed-up of the code.

If you need circles of varying radius, then it might be worthwhile to pre-render the circles, grab them into images and paste those images when required. You would also need to drop point 3 to do this.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
jayandy
20
Years of Service
User Offline
Joined: 14th Sep 2004
Location:
Posted: 19th Oct 2004 09:42
Thanks, that helps a lot. That increased the speed drastically.

Any suggestions from others for speed increase are welcome, (especially reguarding bitmap or memblock)
Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 19th Oct 2004 11:53
hey this isnt a speed suggestion but it would be cool if u made that swirly thing tidi

Login to post a reply

Server time is: 2025-05-16 23:47:46
Your offset time is: 2025-05-16 23:47:46