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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.157.46.166 with SMTP id w35mr5571223ota.96.1490534878978; Sun, 26 Mar 2017 06:27:58 -0700 (PDT) X-Received: by 10.157.46.203 with SMTP id w69mr1473357ota.5.1490534878947; Sun, 26 Mar 2017 06:27:58 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!w124no2076556itb.0!news-out.google.com!i72ni3245itb.0!nntp.google.com!w124no2076554itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 26 Mar 2017 06:27:58 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.167.213.185; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR NNTP-Posting-Host: 85.167.213.185 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7830a5ce-52a3-46b8-8a73-3738005cd206@googlegroups.com> Subject: Re: Best way to put an array-based pixmap on a screen? From: reinert Injection-Date: Sun, 26 Mar 2017 13:27:58 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:46461 Date: 2017-03-26T06:27:58-07:00 List-Id: In case it could be useful, here is a simple test program using GLOBE_3D (texture). I just started to use GLOBE_3D for fast (interactive) video-like rendering (programming in Ada). reinert https://korsnesbiocomputing.no/ with Text_IO; use Text_IO; with GL, GLUT.Devices; use GL, GLUT.Devices; procedure a1 is package Flt_Io is new Text_IO.Float_Io (Float); package Int_Io is new Text_IO.Integer_Io (Integer); use Flt_Io,Int_Io; GLUT_Problem: exception; use GLUT; texDat : array (1..64) of aliased gl.ushort; texDat_Ptr : constant pointer := to_Pointer(texDat(texDat'First)'unchecked_access); tex : aliased GL.uint; tex_Ptr : constant GL.uintPtr := tex'unchecked_access; n,k : Integer := 1; begin glut.Init; glut.SetOption(GLUT.ACTION_ON_WINDOW_CLOSE, GLUT.ACTION_GLUTMAINLOOP_RETURNS); glut.InitDisplayMode( GLUT.DOUBLE or GLUT.RGB or GLUT.DEPTH ); glut.InitWindowSize(800,600); glut.InitWindowPosition(1, 1); if glut.CreateWindow( "Tittel A" ) = 0 then raise GLUT_Problem; end if; glut.Devices.Initialize; n := texDat'First; for i in 1..8 loop for j in 1..8 loop k := (if i = j then 1 else 0); k := (if (i + j) mod 2 = 0 then 1 else 0); texDat(n) := gl.ushort(k*100 + 100); n := n + 1; end loop; end loop; gl.GenTextures(1, tex_Ptr); gl.BindTexture(GL.TEXTURE_2D, tex); gl.TexParameter(GL.TEXTURE_2D, GL.TEXTURE_MIN_FILTER, GL.NEAREST); gl.TexParameter(GL.TEXTURE_2D, GL.TEXTURE_MAG_FILTER, GL.NEAREST); gl.TexImage2D(GL.TEXTURE_2D, 0, GL.LUMINANCE, 8, 8, 0, GL.LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, texDat_Ptr); gl.BindTexture(GL.TEXTURE_2D, 0); gl.MatrixMode(GL.PROJECTION); gl.Ortho(0.0, 800.0, 0.0, 600.0, -1.0, 1.0); gl.MatrixMode(GL.MODELVIEW); gl.ClearColor(1.0, 1.0, 1.0, 0.0); gl.Clear(GL.COLOR_BUFFER_BIT); gl.BindTexture(GL.TEXTURE_2D, tex); gl.Enable(GL.TEXTURE_2D); gl.Color(1.0, 1.0, 1.0, 1.0); gl_Begin(QUADS); gl.TexCoord(0.0, 0.0); gl.Vertex(100, 100); gl.TexCoord(0.0, 1.0); gl.Vertex(100, 500); gl.TexCoord(1.0, 1.0); gl.Vertex(500, 500); gl.TexCoord(1.0, 0.0); gl.Vertex(500, 100); gl_End; gl.Disable(GL.TEXTURE_2D); gl.BindTexture(GL.TEXTURE_2D, 0); gl.Flush; glut.SwapBuffers; Delay 10.0; end a1;