Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
18 May, 2013, 22:46:28 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 ... 6 7 [8] 9 10 ... 23   Go Down
  Print  
Author Topic: nSDL 1.1.1 Anniversary Edition—The Ultimate TI-Nspire Graphics Library! -  (Read 15092 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
lkj
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 16 May, 2013, 21:36:25
Date Registered: 07 September, 2011, 20:05:25
Posts: 348

Total Post Ratings: +40

View Profile
« Reply #105 on: 16 March, 2012, 20:05:12 »
0

Great job! I'll have to learn how to use SDL Smiley
Logged

My Nspire Ndless C projects:
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 17:18:30
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #106 on: 17 March, 2012, 21:58:28 »
0

I did some benchmarking, and the performance seems rather good.

Blitting 1000 times a 100x100 BMP image takes about 2.6 seconds. See for yourself:

<a href="http://www.youtube.com/watch?v=2t23GheOAJ4" target="_blank">http://www.youtube.com/watch?v=2t23GheOAJ4</a>
« Last Edit: 20 March, 2012, 21:34:54 by hoffa » Logged
Lionel Debroux
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: Today at 19:24:33
Date Registered: 17 December, 2009, 09:37:25
Location: France
Posts: 1853

Total Post Ratings: +208

View Profile WWW
« Reply #107 on: 17 March, 2012, 22:06:30 »
0

That's ~400 100x100 BMP images per second.
What are the figures for 32x32 and 16x16 bitmaps (if possible, drawn with various modes: replace, masked, transparent), i.e. game sprites ? Smiley
Logged

Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 17:18:30
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #108 on: 17 March, 2012, 22:25:01 »
+1

Image: (16x16)
1000 blits in 114 ms: 8772 blits/second

Image: (32x32)
1000 blits in 334 ms: 2994 blits/second

EDIT:

Trying out alpha, just posting this here as it gives a nice-looking CRT effect (well, more or less): (don't mind the results, it's on an emulator)

Alpha doesn't work on palettized surfaces though (i.e. Touchpad/Clickpad models), although I could hack it a bit and add support for them.

EDIT2:

Here's the code I used for the benchmark test: http://pastebin.com/vvdpJq57
« Last Edit: 19 March, 2012, 21:17:44 by hoffa » Logged
Lionel Debroux
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: Today at 19:24:33
Date Registered: 17 December, 2009, 09:37:25
Location: France
Posts: 1853

Total Post Ratings: +208

View Profile WWW
« Reply #109 on: 18 March, 2012, 13:59:00 »
0

Thanks Smiley

So... as there are 20*15 16x16 sprites on the Nspire's 320x240 screen, 8-9K blits per second for 16x16 sprites translates to 26-30 FPS for redrawing the entire screen using only 16x16 clipped sprites. That's better than the performance achievable on TI-68k calcs (shown by e.g. ExtGraph demo12), which is good news, but it's still insufficient for completely getting rid of a tilemap engine for platform games. But unlike what we did on TI-68k calculators (reimplementing tilemap engines), we'll surely be able to take advantage of a number of existing tilemap engine implementations Smiley
Logged

Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 17:18:30
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #110 on: 18 March, 2012, 15:20:00 »
0

Seems pretty good for a start. Performance hasn't really been my main thing yet though, as I have been dealing with more important stuff. In later versions I'll optimize whatever possible to squeeze all the juice out of the TI-Nspire. (memcpy I'm looking at you)

On a side note, I'm working on getting SDL_image to run, i.e. support for a lot of different image formats.
« Last Edit: 18 March, 2012, 21:38:10 by hoffa » Logged
Lionel Debroux
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: Today at 19:24:33
Date Registered: 17 December, 2009, 09:37:25
Location: France
Posts: 1853

Total Post Ratings: +208

View Profile WWW
« Reply #111 on: 18 March, 2012, 15:32:45 »
0

Quote
Seems pretty good for a start. Performance hasn't really been my main thing yet though, as I have been dealing with more important stuff. In later versions I'll optimize whatever possible to squeeze all the juice out of the TI-Nspire.
Sure Smiley

Quote
On a side note, I'm working on getting SDL_image to run, i.e. support for a lot of different image formats.
Nice Smiley

Logged

Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 18:13:08
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50196


Total Post Ratings: +2611

View Profile WWW
« Reply #112 on: 18 March, 2012, 20:25:00 »
0

Darn that is awesome, you even got alpha transparency! Great job on this Smiley
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 17:18:30
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #113 on: 20 March, 2012, 21:20:52 »
0

0.1.2's out, it contains mostly just minor changes. One useful addition though is printf-like formatting for SDL_nDrawString (along with NSP_COL and NSP_ROW to easily align text).
For example, to draw "Hello 0xFFFF, 42, world!" in row 1 (starts from 0) column 5, you could do something like (just replace the values by variables of course, otherwise it's useless):

SDL_nDrawString(screen, font, NSP_COL(5), NSP_ROW(1), "Hello 0x%X, %d, %s!", 65535, 42, "world");

It also supports tabs and newline characters, and text wrapping.

I've looked at the mouse stuff, and I might be able to implement that for the next release. I'll also write a full how-to guide to (I reckon it's not very homely when I just dump the headers and static libs in a zip file) and a few example codes in the thread soon.

EDIT:

Could somebody check how fast sprites are blitted on the CX? Download the zip and copy both TNS files to the Examples folder on your TI-Nspire, then run sdl_test.tns. I'm not sure how well memcpy is optimized, but with some magic it might (it's a vague guess though) be faster on the CX than on the non-CX. Thanks a lot.

* blitspeed_cx.zip (96.92 KB - downloaded 17 times.)
« Last Edit: 20 March, 2012, 23:34:03 by hoffa » Logged
Nick
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: Today at 20:19:20
Date Registered: 05 June, 2011, 20:01:07
Location: 51° 12′ 34″ N, 3° 13′ 31″ E
Posts: 1178


Total Post Ratings: +158

View Profile WWW
« Reply #114 on: 20 March, 2012, 22:26:15 »
0

it varies between about 112 and 116 ms per 1000 blits (i tried it about 10 times) with an average of 113.44

edit: it's a CX CAS btw
edit2: changed 100 to 1000 (typo)
« Last Edit: 20 March, 2012, 22:33:32 by Nick » Logged

hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 17:18:30
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #115 on: 20 March, 2012, 22:40:39 »
0

1000 blits in 113 ms means 8850 blits/s for a 32x32 BMP image, while on the non-CX it was 2994 blits/s. If your figures and my calculations are correct, that's nearly three times faster than on the non-CX. Damn. Shocked

Is that correct or am I just missing something and failing at basic math? (EDIT: indeed I messed up, it was 16x16 not 32x32)

EDIT:

Could you (or anyone else for that matter) replace the image.bmp.tns, by the one attached (it's the 16x16 one)? Thanks a lot, you're doing a great favor.


* image.bmp.tns (0.8 KB, 16x16 - viewed 189 times.)
« Last Edit: 21 March, 2012, 08:43:39 by hoffa » Logged
atiatinini
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 19 November, 2012, 01:04:19
Date Registered: 02 March, 2012, 20:49:13
Location: Portugal
Posts: 19

Total Post Ratings: 0

View Profile
« Reply #116 on: 20 March, 2012, 22:54:20 »
0

Both images are exactly the same (16x16).

EDIT: I've tried with another 32x32 image and it says '1000 blits in 282 ms'.
« Last Edit: 20 March, 2012, 22:56:06 by atiatinini » Logged
hoffa
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 17:18:30
Date Registered: 28 May, 2011, 20:26:32
Posts: 302


Topic starter
Total Post Ratings: +115

View Profile
« Reply #117 on: 20 March, 2012, 23:11:49 »
0

Oh wow what a mistake, so it was the 16x16 after all. No wonder the results seemed too great to be true.

Well seems like there's not much difference with the 16x16 (although maybe 1000 blits is too little), but in a 1000-blit run it seems to be about 50 ms faster on the CX with the 32x32 image. Thanks for the information.

Once I get the more important stuff working (mouse for instance), I'll look into performance.

EDIT:

Good news. I hadn't compiled with any GCC optimization yet and had forgot about it. Now I compiled SDL with -O3 (i.e. highest optimization level), and the size went from 383K to 241K. But most importantly, with the exact same 32x32 image on a 1000-blit run, it took 325 ms without optimization, and 155 ms with optimization. That's over twice as fast. Smiley


I checked and rechecked, and it is indeed true. I tried with a 10000-blit run this time, one program compiled with no optimization and the other one with O3. Here are the results that fit the previous finding:

(10000-blit run, 32x32 BMP image)
Unoptimized: 3261 ms or 3067 blits/s (+0%)
O3 optimized: 1555 ms or 6431 blits/s (+110%)
« Last Edit: 21 March, 2012, 00:53:32 by hoffa » Logged
atiatinini
LV1 Newcomer (Next: 20)
*
Offline Offline

Gender: Male
Last Login: 19 November, 2012, 01:04:19
Date Registered: 02 March, 2012, 20:49:13
Location: Portugal
Posts: 19

Total Post Ratings: 0

View Profile
« Reply #118 on: 21 March, 2012, 01:25:50 »
0

Great news, can't wait for that how-to! Cheesy
Logged
adriweb
Editor
LV9 Veteran (Next: 1337)
*
Offline Offline

Gender: Male
Last Login: Today at 17:16:08
Date Registered: 13 April, 2011, 18:42:59
Location: South of France
Posts: 1193


Total Post Ratings: +185

View Profile WWW
« Reply #119 on: 21 March, 2012, 02:37:54 »
0

Really nice Shocked
Logged


TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation
Pages: 1 ... 6 7 [8] 9 10 ... 23   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.475 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.