comp.lang.ada
 help / color / mirror / Atom feed
* Accessing a sub-array in C from Ada in SDL
@ 2016-09-21 17:31 Lucretia
  2016-09-21 18:50 ` Lucretia
  0 siblings, 1 reply; 2+ messages in thread
From: Lucretia @ 2016-09-21 17:31 UTC (permalink / raw)


Hi,

I'm gone back to try and get some updates on SDLAda textures (and also surfaces). 

When locking a texture you get a pointer to the array and a pitch value to the next line. Mapping a 2D or 3D texture data from C onto a 2D or 3D Ada array is quite easy for a full image, by setting the address. So, currently I have this for a full frame:

Actual_Pixels    : Texture_2D_Array (1 .. Height, 1 .. Width) with
   Address => To_Address (Pixels);


But what if you want to lock a partial area of this texture? Ideally, we'd want to be able to set a stride/pitch value in the array declaration, something like:

Actual_Pixels    : Texture_2D_Array (1 .. Height, 1 .. Width) with
   Address => To_Address (Pixels),
   Stride  => Pitch;

As far as I can see, this is currently not possible, but I can see this as being immensely useful when working with C libs.

Luke.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Accessing a sub-array in C from Ada in SDL
  2016-09-21 17:31 Accessing a sub-array in C from Ada in SDL Lucretia
@ 2016-09-21 18:50 ` Lucretia
  0 siblings, 0 replies; 2+ messages in thread
From: Lucretia @ 2016-09-21 18:50 UTC (permalink / raw)


On Wednesday, 21 September 2016 18:31:16 UTC+1, Lucretia  wrote:
> Hi,
> 
> I'm gone back to try and get some updates on SDLAda textures (and also surfaces). 
> 
> When locking a texture you get a pointer to the array and a pitch value to the next line. Mapping a 2D or 3D texture data from C onto a 2D or 3D Ada array is quite easy for a full image, by setting the address. So, currently I have this for a full frame:
> 
> Actual_Pixels    : Texture_2D_Array (1 .. Height, 1 .. Width) with
>    Address => To_Address (Pixels);
> 
> 
> But what if you want to lock a partial area of this texture? Ideally, we'd want to be able to set a stride/pitch value in the array declaration, something like:
> 
> Actual_Pixels    : Texture_2D_Array (1 .. Height, 1 .. Width) with
>    Address => To_Address (Pixels),
>    Stride  => Pitch;
> 
> As far as I can see, this is currently not possible, but I can see this as being immensely useful when working with C libs.
> 
> Luke.

A bad doodle to picture it https://snag.gy/A7waEd.jpg


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-21 18:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21 17:31 Accessing a sub-array in C from Ada in SDL Lucretia
2016-09-21 18:50 ` Lucretia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox