I'm trying to write a scientific simulation. Therefore I need to render
a junk of memory to screen. This data is a kind of image.
I have already done this with QT so I have an idea how it is done.
But now I've come into troubles creatig the surface using preallocated data.
Could someone give me a hint?
Is it possible to first create the surface and then access it's data?
thanks a lot
-----
code scribble:
struct{ /* parameter, data, ... */ } junk;
// we use primary pixelformat for now
primary->GetPixelFormat( primary, &junk.pixelformat );
// allocate some memory for surface data
// some code creates image data here
junk.data = calloc( junk.size, (junk.pixelformat >> 17) & 0x07 );
// create a surface description
dsc.flags = DSDESCR_CAPS | DSDESC_WIDTH | DSDESCR_HEIGHT |\
DSDESC_PIXELFORMAT | DSDESC_PREALLOCATED;
dsc.caps = DSCAPS_NONE; /* ????????? */
dsc.width = junk.width;
dsc.height = junk.height;
dsc.pixelformat = junk.pixelformat;
dsc.preallocated[0].data = junk.data;
dsc.preallocated[0].pitch = ; /* ????????? */
//
dfb->CreateSurface( dfb, &dsc, &junk.surface ); /* this is LINE 56 */
-----
build:
gcc -Wall -I/usr/include/directfb -ldirectfb -02 -o simula simula.c
-----
whatever I try the engine keeps complaining:
---------------------- DirectFB v0.9.24 ---------------------
(c) 2000-2002 convergence integrated media GmbH
(c) 2002-2004 convergence GmbH
-----------------------------------------------------------
(*) DirectFB/Core: Single Application Core. (2006-01-01 00:12)
(*) Direct/Memcpy: Using MMXEXT optimized memcpy()
(*) Direct/Thread: Running 'VT Switcher' (CRITICAL, 4326)...
(*) Direct/Thread: Running 'Keyboard Input' (INPUT, 4327)...
(!!!) *** UNIMPLEMENTED [fusion_reactor_set_lock] *** [reactor.c:797]
(*) DirectFB/Input: Keyboard 0.9 (convergence integrated media GmbH)
(*) DirectFB/Genefx: MMX detected and enabled
(*) DirectFB/Graphics: Matrox G550 0.7 (directfb.org)
(*) DirectFB/Core/WM: Default 0.2 (Convergence GmbH)
main.c <56>:
(#) DirectFBError [dfb->CreateSurface( dfb, &dsc, &junk.surface )]:
Invalid argument!
(!!!) *** WARNING [Application exited without deinitialization of
DirectFB!] *** [core.c:630 in dfb_core_deinit_check()]
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev