From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <201204181805.q3II5VO2025497@freefriends.org> <6078AC91-47C1-4EE4-A48B-3B6A9A02FDF1@corpus-callosum.com> Date: Thu, 19 Apr 2012 09:46:28 +0100 Message-ID: From: Charles Forsyth To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] nix at lsub Topicbox-Message-UUID: 78486b58-ead7-11e9-9d60-3106f5b1d025 On 19 April 2012 09:16, Joseph Stewart=C2=A0=C2= =A0wrote: > > Anyone here know if it's a model to learn from? Another glance, and I'd say it's similar to the others (except for the onXYZ style of programming). Because GL is fairly big and complicated, everyone copies the original interface conventions precisely. That way you can look it up in the manual. Unfortunately, it means you get FORTRAN in every language. (The original target might have been C, but it looks like "FORTRAN in any language". There are older graphics interfaces in C that have data structures, so it's not impossible.= ) Thus, you get // Enabled the vertices buffer for writing and to be used during // rendering. gl.glFrontFace(GL10.GL_CCW); // OpenGL docs // Enable face culling. gl.glEnable(GL10.GL_CULL_FACE); // OpenGL docs // What faces to remove with the face culling. gl.glCullFace(GL10.GL_BACK); // OpenGL docs // Enabled the vertices buffer for writing and to be used during // rendering. gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);// OpenGL docs. // Specifies the location and data format of an array of vertex // coordinates to use when rendering. gl.glVertexPointer(3, GL10.GL_FLOAT, 0, // OpenGL docs vertexBuffer); gl.glDrawElements(GL10.GL_TRIANGLES, indices.length,// OpenGL docs GL10.GL_UNSIGNED_SHORT, indexBuffer); // Disable the vertices buffer. gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); // OpenGL docs // Disable face culling. gl.glDisable(GL10.GL_CULL_FACE); // OpenGL docs Note the state, and the stylish "gl.gl...". Stutter and suffer! "But wait!", I hear you cry. State, callbacks, no data structures to speak of, ... why don't we look at how they handle this stuff in ... Haskell! (Monads, and a learning curve, though you can then build up something that's not entirely graphics machine code.)