Author Topic: nGL - a fast (enough) 3D engine for the nspire  (Read 263699 times)

0 Members and 1 Guest are viewing this topic.

Offline Legimet

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +29/-0
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #225 on: April 29, 2014, 11:03:23 am »
What? I only copied the headers, static library, and a Makefile to build it (and similarly for zlib). git submodules sounds like a good idea, since we won't have to  have prebuilt stuff in the repo, and we can build the libs from source.

As for using freetype in crafti, just choose whatever works best. If you think FreeType is a good choice, just take a look at the sample, and put whatever font you use in a header file using "xxd -i" so people don't have to copy an extra file.

I updated to GCC 4.9.0 by the way and the problem with elf2flt sucking all RAM out (if iostream is used) is there again :(

What do you think about making our own tool to convert elf to bflt? I think everyone agrees by now that elff2flt is an unmaintained piece of crap.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #226 on: April 29, 2014, 11:14:51 am »
Quote
What? I only copied the headers, static library, and a Makefile to build it (and similarly for zlib).
Oops, I didn't look at the content, just the amount of lines (>20.000) :/
BTW: You removed fdlibm without mentioning it in the commit message. That's not an issue, but it's better to document any (non-subtle) changes.

Quote
git submodules sounds like a good idea, since we won't have to have prebuilt stuff in the repo, and we can build the libs from source.
Yeah, compling nSDL, nspireio and the other two shouldn't take long.

I updated to GCC 4.9.0 by the way and the problem with elf2flt sucking all RAM out (if iostream is used) is there again :(

What do you think about making our own tool to convert elf to bflt? I think everyone agrees by now that elff2flt is an unmaintained piece of crap.
It definitely is. With libelfELFIO that should be possible, IIRC tangrs already tried something similiar.
But I'd rather invent a better-documented format, with support for generic sections with attributes (e.g. for exceptions).
Basically elf, but without requiring symbol information for relocation.

Quote
As for using freetype in crafti, just choose whatever works best. If you think FreeType is a good choice, just take a look at the sample, and put whatever font you use in a header file using "xxd -i" so people don't have to copy an extra file.
I'll try some solutions. I'll probably end up rendering a font table with freetype into a buffer and use it to directly blit to the screen buffer.
Or without freetype, prerendered using CBFG.
« Last Edit: April 29, 2014, 12:06:33 pm by Vogtinator »

Offline GinDiamond

  • LV3 Member (Next: 100)
  • ***
  • Posts: 71
  • Rating: +2/-2
  • I dont always fail at life, but when I do, I dont
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #227 on: April 29, 2014, 11:37:17 am »
Is this being compiled on a linux machine?

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #228 on: April 29, 2014, 12:06:02 pm »
Quote
Is this being compiled on a linux machine?
Yeah, I'm not using windows, even if I wanted to, I couldn't. I haven't got a license key anymore, let alone free space on my drive.

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #229 on: April 29, 2014, 01:10:25 pm »
Quote
Should we perhaps reset the poll, now that a new option has been added?
No, my intention is to remove an option from the poll after I implemented it and add considerable suggestions and possible features on-the-fly.
It shouldn't make a huge difference anyway, as lighting doesn't have an impact on gameplay at all (yet).

But now that lighting is in the poll, I want to vote for it, but I can't because I've already voted. Others might want to do the same.

There's also an option to allow people to change their votes without resetting the poll entirely, I just didn't like that idea as much because it wouldn't force people to re-evaluate their decision with the new option being present.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #230 on: April 29, 2014, 01:13:25 pm »
As I created the poll there was a checkbox "Allow everyone to change their vote" which I enabled.
Bug? Anyway, I reseted it.

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #231 on: April 29, 2014, 06:17:01 pm »
Alright, cool. Now to help make sure people get the message:

Due to the addition of a new option, the poll has been reset! If you previously voted, please re-examine the options and cast your vote again.

Offline ordelore

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 168
  • Rating: +7/-0
  • Genius and Friend
    • View Profile
    • ordelore8x
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #232 on: April 29, 2014, 07:25:19 pm »
Nice to see that I'm finally in the majority.  :3
I am a friend.
I mine Bitcoins.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #233 on: April 30, 2014, 01:17:03 am »
There isn't an "other" thingy. Whatever, I'll say it here : you should start by implementing the easier stuff and only leave the tricky features in the poll. Just a thought.

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #234 on: April 30, 2014, 02:10:28 am »
Quote
For fonts, you can use nGC or Freetype (which works without any changes)
Does nGC support rendering into (raw) buffers with different width than the screen?

It maybe does, but never managed to do so. The OS simply uses a gui_gc_clipRect before gui_gc_blit_buffer in order to draw part of the 3D engine (splitted app for example).
gui_gc_blit_buffer is not that slow IIRC, Of course I never had the opportunity to test it with a real 3D buffer.

Two ways offer to you :
Code: [Select]
static char* screen_buffer[SCREEN_BYTES];
void draw()
{
  ngl(screen_buffer, scene);
  gui_gc_blit_buffer(gc, screen_buffer); /* syscall */
  gui_gc_drawString(gc, "H\0e\0l\0l\0o\0 \0W\0o\0r\0l\0d\0\0", 0, 10);
  gui_gc_blit_to_screen(gc); /* part of libndls */
}

Code: [Select]
static Gc text_gc;
void init()
{
  text_gc = gui_gc_copy(gc, 100, 100)
  gui_gc_setColorRGB(255, 255, 255);
  gui_gc_fillRect(0, 0, 100, 100);
  gui_gc_setColorRGB(0, 0, 0);
  gui_gc_drawString(text_gc, "H\0e\0l\0l\0o\0 \0W\0o\0r\0l\0d\0\0", 0, 10);
}

void draw()
{
  ngl(scene);
  gui_gc_blit_to_screen_region(text_gc, 0, 0, 100, 100); /* You can even redefine this function in order to handle alpha */
}

Quote
nGC uses the OS' font routines AFAIK which are slow and ugly
Slow because of syscalls, and in my second example the draw method doesn't use any syscall on time critical code.
Ugly ? Their code is mainly a top level API over Nucleus GRAFIX in order to define primitive like in Java's Graphic2D.
The only thing you need to bother with nGC is utf16 which is simpler to use with the String API.
« Last Edit: April 30, 2014, 02:16:28 am by Levak »
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #235 on: May 01, 2014, 05:06:31 pm »
(Mostly) bugfix release v0.8.1:
New features:
 -Transparent leaves
 -Bedrock (y=0, indestructible)
 -Better AABBs for billboards (flowers, mushroom, torch) and cake
 -Oriented blocks

Bugfixes:
 -Can't break your neck anymore
 -A bit faster
 -Textures not 256x256 now fully work

Known issues:
-If you jump into a wall, you can slide along it without falling
-Graphical glitches
-Too many diamonds..

Refactoring took a long time, but it was worth it. I had to fix a bug in Ndless (I introduced...) so some crashes are now fixed.
I also hit a bug in GCC 4.9.0, but it should be faster now, as one of the major features in 4.9.0 is a optimized LTO.
I haven't tried it outside nspire_emu.
No screenshots, as there's nothing screenshot-worthy in this release.

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #236 on: May 02, 2014, 01:10:21 am »
I also hit a bug in GCC 4.9.0, but it should be faster now, as one of the major features in 4.9.0 is a optimized LTO.
What bug? I'm intrigued.
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #237 on: May 02, 2014, 01:12:35 am »
I have voted for water and lava :D

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #238 on: May 02, 2014, 11:06:43 am »
I also hit a bug in GCC 4.9.0, but it should be faster now, as one of the major features in 4.9.0 is a optimized LTO.
What bug? I'm intrigued.
A segmentation fault: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61008

I have voted for water and lava :D
Well, with 7 votes this is probably going to be it. v0.9 will take a while, though. I want to fix most of the graphical glitches and add some more "stuff" I don't know yet.
« Last Edit: May 02, 2014, 02:41:40 pm by Vogtinator »

Offline GinDiamond

  • LV3 Member (Next: 100)
  • ***
  • Posts: 71
  • Rating: +2/-2
  • I dont always fail at life, but when I do, I dont
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #239 on: May 03, 2014, 10:44:15 am »
Is there a way to make the movement controlled by pressing the arrow keys, and rotations controlled by the "touchpad", as in sliding your thumb across it instead of pressing?