Message from discussion
that wacky y-axis
MIME-Version: 1.0
Received: by 10.151.112.12 with SMTP id p12mr44364ybm.23.1223623539457; Fri,
10 Oct 2008 00:25:39 -0700 (PDT)
Date: Fri, 10 Oct 2008 00:25:39 -0700 (PDT)
In-Reply-To: <7db362a90810092330q2d318790m8e582e00402e943f@mail.gmail.com>
X-IP: 58.175.132.93
References: <715a55f7-7774-4ec5-b650-7e7d2bb76025@r38g2000prr.googlegroups.com>
<2ee64dcc0810092253h454ba1acofae4b53c0168cf61@mail.gmail.com>
<720a922b-29a3-4818-9071-e83edcaca6fb@40g2000prx.googlegroups.com>
<7db362a90810092330q2d318790m8e582e00402e943f@mail.gmail.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Opera/9.52 (Windows NT 5.1; U; en),gzip(gfe),gzip(gfe)
Message-ID: <f08f7d85-5699-41b8-92c9-25123a282744@v13g2000pro.googlegroups.com>
Subject: Re: that wacky y-axis
From: "ashaman...@yahoo.com" <ashaman...@yahoo.com>
To: pyglet-users <pyglet-users@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Very amusing.
There's no simple cure? That's slightly mind-boggling. Every tool has
its quirks, but I've not seen before the kind of balls it takes to
blandly ignore a near-universal standard like this.
I suppose I can carry on what I'm doing, which is flipping every
sprite's y co-ordinate before drawing it and putting it back after,
but that's like a joke.
On Oct 10, 5:30=A0pm, "Nathan Whitehead" <nwhit...@gmail.com> wrote:
> On Thu, Oct 9, 2008 at 11:04 PM, ashaman...@yahoo.com
>
> <ashaman...@yahoo.com> wrote:
> > ...
> > There must be simple gl command I can put somewhere to flip the co-
> > ordinates, right? I can hardly be the first person to run up against
> > this...
>
> Here's what I do:
>
> =A0 =A0 # Set default projection to use upper left as origin
> =A0 =A0 pyglet.gl.glMatrixMode(pyglet.gl.GL_PROJECTION)
> =A0 =A0 pyglet.gl.glLoadIdentity()
> =A0 =A0 pyglet.gl.glOrtho(0.0, 1024.0, 768.0, 0.0, -1.0, 1.0)
> =A0 =A0 pyglet.gl.glMatrixMode(pyglet.gl.GL_MODELVIEW)
> =A0 =A0 pyglet.gl.glLoadIdentity()
>
> This makes 0,0 the upper left corner of the screen and 1024, 768 the
> bottom right corner. =A0But if you're thinking that this is what you
> want, you should consider what will happen! =A0If you use any function
> that is not expecting this, it will draw upside down. =A0For example,
> try drawing some text using:
>
> label =3D pyglet.text.Label('Hello, world',
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 font_name=3D'Times Ne=
w Roman',
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 font_size=3D36,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 x=3Dwindow.width//2, =
y=3Dwindow.height//2,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 anchor_x=3D'center', =
anchor_y=3D'center')
> label.draw()
>
> It will come out beautifully rendered in the right location, but
> reflected upside down.
> --