9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Charles Forsyth <charles.forsyth@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] nix at lsub
Date: Thu, 19 Apr 2012 09:46:28 +0100	[thread overview]
Message-ID: <CAOw7k5gX=L4kywDTjgkDbOpLXBAQK6ywxBfzfmdPftj9TX2D4w@mail.gmail.com> (raw)
In-Reply-To: <CANGQBe46HfLUqzb1=zsaFLXo341g+UFCqPueG6rRRits0R4ioA@mail.gmail.com>

On 19 April 2012 09:16, Joseph Stewart <joseph.stewart@gmail.com> wrote:
>
> 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.)



  reply	other threads:[~2012-04-19  8:46 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-18 18:05 arnold
2012-04-19  1:37 ` hiro
2012-04-19  4:15   ` Jeff Sickel
2012-04-19  8:10     ` Charles Forsyth
2012-04-19  8:16       ` Joseph Stewart
2012-04-19  8:46         ` Charles Forsyth [this message]
2012-04-19 10:03           ` Bakul Shah
2012-04-19 10:32             ` Charles Forsyth
2012-04-19 16:36               ` Bakul Shah
2012-04-19 15:50 ` ComeauAt9Fans@gmail.com
2012-04-19 16:11   ` Lucio De Re
2012-04-19 17:09     ` ComeauAt9Fans@gmail.com
2012-04-19 17:56       ` Lucio De Re
2012-04-19 18:05         ` Comeau At9Fans
2012-04-19 18:23           ` Lucio De Re
2012-04-19 18:27           ` Lucio De Re
  -- strict thread matches above, loose matches on Subject: below --
2012-04-18 16:09 arnold
2012-04-18 16:18 ` Nemo
2012-04-18 16:28   ` Charles Forsyth
2012-04-18 16:35     ` Francisco J Ballesteros
2012-04-18 17:43 ` Lucio De Re
2012-04-18 15:45 arnold
2012-04-18 15:49 ` Francisco J Ballesteros
2012-04-14 21:02 Nemo
2012-04-15 13:45 ` David Leimbach
2012-04-16 10:47 ` Francisco J Ballesteros
2012-04-16 11:02   ` Noah Evans
2012-04-16 17:23     ` Aram Hăvărneanu
2012-04-16 17:32       ` Noah Evans
2012-04-16 17:42         ` Noah Evans
2012-04-16 17:44         ` ron minnich
2012-04-16 20:53         ` Andrés Domínguez
     [not found]     ` <CAEAzY380ECzLQJCbNaK=QiYE6vzQpqTW3ZoakzW7EJ-WajptHg@mail.gmail.c>
2012-04-16 17:54       ` sl
2012-04-16 13:22   ` Christoph Lohmann
2012-04-16 18:04     ` Lucio De Re
2012-04-17  2:16 ` kokamoto
2012-04-17  5:53   ` andy zerger
2012-04-17  5:54     ` andy zerger
2012-04-17  7:17   ` Nemo
2012-04-17  8:41     ` kokamoto
2012-04-17  8:51       ` Francisco J Ballesteros
2012-04-17 12:22       ` Tristan
2012-04-17 18:56       ` Charles Forsyth
2012-04-17 19:13         ` Nemo
     [not found]         ` <charles.forsyth@gmail.com>
2012-04-18  0:26           ` kokamoto
2012-04-18  4:07             ` John Floren
2012-04-18  4:12               ` John Floren
2012-04-18  7:54             ` Francisco J Ballesteros
2012-04-18 12:27               ` Charles Forsyth
2012-04-18 12:35                 ` Francisco J Ballesteros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOw7k5gX=L4kywDTjgkDbOpLXBAQK6ywxBfzfmdPftj9TX2D4w@mail.gmail.com' \
    --to=charles.forsyth@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).