From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5d708145f98f6273 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-13 11:31:22 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: "Luke A. Guest" Newsgroups: comp.lang.ada Subject: Re: Access type conversions, how? Date: Tue, 13 Apr 2004 20:31:43 +0100 Message-ID: References: <107mgcjspsour11@corp.supernews.com> <407c0f2c.0@entanet> NNTP-Posting-Host: abyss2.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.demon.co.uk 1081881080 27769 62.49.62.197 (13 Apr 2004 18:31:20 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Tue, 13 Apr 2004 18:31:20 +0000 (UTC) User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Xref: archiver1.google.com comp.lang.ada:7057 Date: 2004-04-13T20:31:43+01:00 List-Id: 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.