s_w := bbb.Width; s_h:= bbb.Height; GetMem( s_data, s_h * s_w * 4 ); ScanLineImage := bbb.CreateIntfImage; // Copy the data from the bitmap for j := 0 to s_h - 1 do begin row := ScanLineImage.GetDataLineStart( j ); for i := 0 to s_w - 1 do s_data[ j * s_w + i ] := $ff000000 + $10000 * row[ i ].b + $100 * row[ i ].g + row[ i ].r; end; ScanLineImage.Free;
Oh, Maybe I did not make it clear enough. tempSurfaces are used as textures during OpenGL calls. So after the WordArray is converted to an SDL surface, I use the surface in OpenGL. Dominique. On Sun, 7 Jun 2009 13:10:23 +0200, Mattias Gaertner <nc-gaert...@netcologne.de> wrote: > On Sun, 07 Jun 2009 06:50:30 -0400 > <domini...@savagesoftware.com.au> wrote: > >> I've narrowed down the surface creation error to the following >> block... >> >> {$IFDEF CPUPOWERPC} >> tempSurface := SDL_CreateRGBSurfaceFrom( aWordArray, aWidth, >> aHeight, 32, aWidth * 4, $FF000000, $00FF0000, $0000FF00, $000000FF ); >> {$ENDIF} >> {$IFDEF CPUi386} >> tempSurface := SDL_CreateRGBSurfaceFrom( aWordArray, aWidth, >> aHeight, 32, aWidth * 4, $000000FF, $0000FF00, $00FF0000, $FF000000 ); >> {$ENDIF} >> {$IFDEF CPUARM} >> tempSurface := SDL_CreateRGBSurfaceFrom( aWordArray, aWidth, >> aHeight, 32, aWidth * 4, $000000FF, $0000FF00, $00FF0000, $FF000000 ); >> {$ENDIF} >> >> The only one that works is the line in CPUi386. The CPUPOWERPC >> displays with the pink glitch I mentioned earlier and I'm not really >> concerned about CPUARM just yet. > > Please tell how tempSurface is passed to the LCL. > > You can see what image format the LCL uses with the following code: > > procedure TMainForm.FormCreate(Sender: TObject); > var > bmp: TBitmap; > IntfImg: TLazIntfImage; > begin > bmp:=TBitmap.Create; > IntfImg:=bmp.CreateIntfImage; > writeln(IntfImg.DataDescription.AsString); > IntfImg.Free; > bmp.Free; > end; > > Keep in mind the the format depends on the source. A screen shot may > have another format than a memory TBitmap. > > > Mattias > > >> >> Dominique. >> >> On Thu, 04 Jun 2009 11:28:12 +0200, Marc Weustink >> <marc.weust...@cuperus.nl> >> wrote: >> > domini...@savagesoftware.com.au wrote: >> >> Hi Dimtry, >> >> I'll try and do so this evening. But the thing is that if I >> >> create the GM >> >> project on PowerPC and run it on Intel it looks fine. >> >> So my question is once the bitmap is loaded from HD or a stream, >> >> shouldn't >> >> it be identical once it is in memory regardless of if it is on >> >> Intel or PowerPC. Shouldn't the RTL or LCL handle those >> >> differences? >> > >> > The LCL should handle this, but as ong as we don't know what you >> > are doing, we cannot tell what is wrong. >> > >> > Marc >> > >> > >> > _______________________________________________ >> > Lazarus mailing list >> > Lazarus@lists.lazarus.freepascal.org >> > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >> >> -- >> _______________________________________________ >> Lazarus mailing list >> Lazarus@lists.lazarus.freepascal.org >> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > -- > _______________________________________________ > Lazarus mailing list > Lazarus@lists.lazarus.freepascal.org > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus