PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Some ECE2.0 code questions

Some quick EasyCE 2.0 questions:

1. How come the primary surface is never actually used in the code? Is this because 2.0 is still in beta? {Since the memory for it *IS* allocated, just never used in anything I could find}

2. All sprites currently -- and since I've used EasyCE -- write themselves to a single (class scope) static surface pointer (s_Dest). Is this to save the space over each sprite having it's own surface pointer. Why not have each sprite "know" what surface it should draw itself to? This is more of a curiousity to me rather than anything else.

3. I missed the whole Dan's code thread, but if you uncomment the #ifdef DAN 0, I assume you'd use his version of the pixel buffer code. Is it any faster/better?

Lots of props to you, by the way. Awesome work.

Andre
Primary surface: Oops, messed up there. It was supposed to contain the hardware framebuffer. Apparently I created a buffer instead. Not good. :) Note that the primary surface, in it's intended implementation, does not have a fixed layout. It will be different on each device. That's why you should use the secondary surface. Only when you need top performance and know what you're doing, you should use the primary surface. Good thing about that is that while you're using a direct interface to GAPI, you still get the easy full-screen GAPI setup and event handling stuff. Saves a lot of time.

Sprites all write to the same surface, since they where supposed to be linked to the secondary buffer. However, I can imagine that you want to draw different sprites to different surfaces. If I change this, you should be aware of the fact that you MUST define the target surface for EVERY sprite. Perhaps I can mix this: Have a single destination by default, wich you can overrule on a per-sprite basis. That way newbies keep the simplicity, while you get the control.

Dan suggested that we should write to the hardware framebuffer in a linear fashion. On the iPaq, that would mean that we would draw per column, rather than per row. This means that we are reading 'randomly' in the secondary buffer. Since the hardware framebuffer is not cached (apparently), this is very slow, since the secondary buffer reads suffer from extreme cache penalties. This was about 5 times as slow, wich slows down games to a crawl (about 28 fps max).

- Jacco.
Thanks for the replies. I just as soon leave your code as is (with no disrespect to Dan, I'll leave that #IFDEF in :).

BTW: I know it may be just me, but I still get the mouse cursor being off by +4,+4 (in XP). I added the same fix I've been using to correct the cursor in Windows OpenPTC mode. Maybe this is a PTC thing, but it kinda looks like the window extras (border, etc) account for this.

Not a biggie, as I put in an #IFDEF just inside the update() to fix it, but I thought I mention it again.

Andre