This site is no longer active and is available for archival purposes only. Registration and login is disabled.

GapiDraw 2.0 development progress


Postby Johan » Apr 18, 2003 @ 12:41pm

User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby Karel » Apr 18, 2003 @ 2:58pm

Karel
pm Member
 
Posts: 23
Joined: Feb 25, 2003 @ 3:54pm
Location: The Netherlands


Postby Johan » Apr 18, 2003 @ 3:54pm

User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby Johan » Apr 19, 2003 @ 9:48pm

[Daily update - Saturday, April 19]

Download latest build here:
http://www.gapidraw.com/GapiDraw110(2003-04-19).exe

(1)
CGapiRGBASurface! This new 32-bit surface can load PNG images with transparency (both 8-bit and 24-bit PNGs with alpha is supported)... Check out the new AlphaBlt and AlphaBltFast in CGapiSurface... The old way is still available however, but I really doubt anyone will want to use it after getting used to this class...

(2)
Minor improvements to the new, single-threaded CGapiApplication (when the application is minimized it will now call WaitForMultipleObjects and sleep in 250ms intervals - and break if a windows message is received)

(3)
It is now again possible to call SetColorKey() before calling CreateSurface().

---------------

Upcoming features: CGapiRLESurface (for nice and quick GUI overlays), and a 4-4-4-4 surface (16-bit RGBA) for alpha blends that are 2x faster than CGapiRGBASurface... But right now I'm out of ideas of what to call it..

*UPDATE* How about CGapiSurfaceRGBA16 and CGapiSurfaceRGBA32? The 4-4-4-4 format gives 16 levels of each base color, with a total of 4096 colors. Should be enough for most uses..
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby efortier » Apr 20, 2003 @ 8:29am

User avatar
efortier
pm Insider
 
Posts: 373
Joined: May 15, 2002 @ 10:32pm


spacemonkey

Postby Guest » Apr 20, 2003 @ 11:46am

Guest
 


Postby Johan » Apr 20, 2003 @ 12:07pm

User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby spacemonkey » Apr 20, 2003 @ 4:49pm

OK, tell me where to look if I'm just wasting your time... but I'm really keen to get the Alpha inclusive surfaces working and loading direct from a RGBA PNG file.

Question is, what's the syntax? I can't find any documentation or instruction in the forum that seems to tell me about this. Even just a bit of sample code so I can figure out the syntax.

Thanx

PS. I was anonymous above, I've taken a cut of my app at the stage where I've moved to 1.10 so I can test the performance difference on smartphone between 1.04 and 1.10 with future releases.
spacemonkey
pm Member
 
Posts: 11
Joined: Apr 20, 2003 @ 12:13pm


Postby Johan » Apr 20, 2003 @ 4:56pm

spacemonkey: Your feedback is most appreciated!

Try this:

header file:
CGapiRGBASurface m_pngimage;

CreateSurface():
m_pngimage.CreateSurface(0, hInstance, IDR_IMAGE, TEXT("PNG"));

ProcessNextFrame():
backbuffer.AlphaBltFast(10, 10, &m_pngimage, NULL, 0, NULL);

As you can see it is a much nicer format than previous...

The next build will allow you to create either a 16-bit (default) or 32-bit RGBA surface using different flags in CreateSurface().
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby Karel » Apr 20, 2003 @ 8:06pm

Should it now be possible to load a huge picture say 1410 x 670 x 8 at once. Because I can't get it to work without the E_OUTOFMEMORY error. I can how ever create such a surface and then use a tilemap to fill that surface but I would like to load the picture in one turn. The tilemap is 320 x 920 x 24. Is there a way or is this just wrong programming?
Karel
pm Member
 
Posts: 23
Joined: Feb 25, 2003 @ 3:54pm
Location: The Netherlands


Postby Johan » Apr 20, 2003 @ 8:28pm

Krelis: Do you get outofmemory even with 1.10? 1410x670 should be no big deal... The new image loader requires almost 2.5 times less memory than the older 1.04 version (see the updated technical overview on www.gapidraw.com for more information). One tip is to create a loop for allocating large surfaces:

(1) Create large surface
(2) If failed, Sleep and try again up to n times

The Pocket PC will adjust the amount of program memory / storage memory available. This adaptaion however takes time, and its possible that the first malloc will fail and the next will succeed. Dan East made a post that this is the strategy used in Pocket Quake for storing the large 10mb level information.
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby Karel » Apr 20, 2003 @ 9:06pm

Thanks for the fast response. First of all this on the smartphone platform. I tried your solution on the emulator but it didn't work. The strange thing is that when I do:
m_environmentFg.CreateSurface(0,TEXT("foreground_farmhouse.gif"));
It fails.
But when I do
m_environmentFg.CreateSurface(0,1400,700);
It succeeds.
Only on the second one I have to blt several tiles from a tile map and that is something I want to prefent.
m_environmentFg is a CGapiSurface.
Maybe there is special flag I have to use for the CreateSurface?
Last edited by Karel on Apr 20, 2003 @ 9:09pm, edited 1 time in total.
Karel
pm Member
 
Posts: 23
Joined: Feb 25, 2003 @ 3:54pm
Location: The Netherlands


Postby Johan » Apr 20, 2003 @ 9:08pm

Aha.. You use a GIF image.. 8O Uuuuu... Don't use GIFs.. The zero-memory-overhead routines only work with PNG and BMP.
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Postby Karel » Apr 20, 2003 @ 9:16pm

Yep that fixes the problem. Thank you.
Still irritating that the malloc doesn't succeed the first time but that could be solved by claiming a big memory heap at the start of the program.
Karel
pm Member
 
Posts: 23
Joined: Feb 25, 2003 @ 3:54pm
Location: The Netherlands


Postby spacemonkey » Apr 20, 2003 @ 10:34pm

Another tip for smartphone that I found today...

Look up SHCloseApps in the SDK help. What the OS does is when available memory drops below a threshold it sends WM_HIBERNATE or more agressively WM_CLOSE to backgrounded apps. SHCloseApps takes a parameter of a memory amount and if that amount isn't currently available the OS will start cleaning up now without needing to reach the threshold. (I presume this gets similar results to the work around mentioned above for pocket pc, just a bit more formally).

PS. got the RGBA surfaces working perfectly, thanks.
spacemonkey
pm Member
 
Posts: 11
Joined: Apr 20, 2003 @ 12:13pm


PreviousNext

Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum