comp.lang.ada
 help / color / mirror / Atom feed
From: "Luke A. Guest" <laguest@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk>
Subject: Re: Access type conversions, how?
Date: Tue, 13 Apr 2004 20:31:43 +0100
Date: 2004-04-13T20:31:43+01:00	[thread overview]
Message-ID: <pan.2004.04.13.19.31.42.47535@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk> (raw)
In-Reply-To: yLVec.158$xN.24@newsfe1-gui.server.ntli.net

On Tue, 13 Apr 2004 18:54:20 +0100, chris wrote:

>  From the code you posted it looks like a convoluted solution.  Maybe 
> it's the lack of context.

No, it's really really simple...the code I posted was all you needed.
 
> I would do one of two things.  Either just stick with the native GL 
> types or make Ada ones corresponding to them and convert like this...

Yes, and like I said before, when writing portable games, i.e. games that
will not always have OpenGL available, I need to to not do this. I need to
abstract it away, hide the rendering code, etc. I cannot say this any
other way.
 
> type GLMatrix is array (1..15) of GLFloat; pragma Convention (C,
> GLMatrix);
> 
> type OpenGLMatrix is array (1..15) of GLFloat;
> 
> 
> A : OpenGLMatrix;
> 
> A (1..15) := OpenGLMatrix (SomeMatrix (1..15));
> 
> or A := OpenGLMatrix(SomeMatrix);

No, unacceptable. I don't want to be creating/destroying temporary arrays
like that, especially for a 3D game.

>> But as GL bindings use the GL types, I cannot get a pointer to convert
>> to another pointer with the same base types.
> 
> Why do that?

Take the glMultMatrixf procedure I posted before, *you want to have your
own types* but *you also want to be able to pass them to the GL functions*
but it's tricky because the strong typing is getting in the way. I need a
way to convert my aliased matrix type to another. That function expects a
GL.GLfloatPtr, I want to use something else, do you understand?

Luke.





  reply	other threads:[~2004-04-13 19:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-13  0:32 Access type conversions, how? Luke A. Guest
2004-04-13  1:25 ` Randy Brukardt
2004-04-13  8:08   ` Luke A. Guest
2004-04-13 15:11     ` chris
2004-04-13 16:01       ` Luke Guest
2004-04-13 17:54         ` chris
2004-04-13 19:31           ` Luke A. Guest [this message]
2004-04-13 22:51             ` Luke A. Guest
2004-04-13 21:59               ` Lutz Donnerhacke
2004-04-14 11:53                 ` Luke Guest
2004-04-14 12:07                   ` Lutz Donnerhacke
2004-04-14 13:36             ` Robert I. Eachus
2004-04-14 17:37               ` Jeffrey Carter
2004-04-13 14:57 ` zhenglonggen
2004-04-14  7:45   ` Martin Dowie
2004-04-14 11:49     ` Luke Guest
replies disabled

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