On 8/19/08, Martin <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have an application where I want to render a text 90° rotated but it
> looks like whatever I try as soon as I add a roatation, the text
> disapears completly... I'm sure I miss something obvious, but I can't
> figure out what it is.
>
> I found a hint in a different post that I should add my rotation in th
> eon_resize event handler, so here is what I came up with:
>
> -----
> import pyglet
> from pyglet import gl
>
> w = pyglet.window.Window (640, 480)
>
> label = pyglet.text.Label('Hello, world',
> font_name='Times New Roman',
> font_size=36,
> x=0, y=0)
> @w.event
> def on_draw () :
> label.draw ()
>
> def on_resize (width, height) :
> gl.glViewport(0, 0, width, height)
> gl.glMatrixMode(gl.GL_PROJECTION)
> gl.glLoadIdentity()
> gl.glOrtho(0, width, 0, height, -1, 1)
> #gl.glTranslatef (10, 0, 0)
> gl.glMatrixMode(gl.GL_MODELVIEW)
> #gl.glRotatef (-90, 1, 0, 0)
> #gl.glRotatef (-90, 0, 1, 0)
> # end def on_resize
These rotations are about the origin (bottom-left corner), so that a
ninety degree rotation will rotate the label off the screen. You had
the right idea with glTranslate, you just need to do it after switch
to GL_MODELVIEW, and you need to translate by a larger amount (start
with 30,30,0).
Alex.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---