What I'm doing is basically this, so here's the code:
------------------------------------------------------------
# -*- coding: cp1252 -*-
import pyglet
import math
from pyglet.gl import *
# Direct OpenGL commands to this window.
window = pyglet.window.Window(resizable=True)
@window.event
def on_draw():
glClear(GL_COLOR_BUFFER_BIT)
glLoadIdentity()
#glTranslatef(50.0,0.0,0.0)#Sirve para mover la vista de la
ventana(o algo asi).
rtri = 15
glRotatef(rtri,0.0,0.0,1.0)#Rotating around Z.
#glRotatef(rtri,0.0,1.0,0.0)#Rotating around Y.
#glRotatef(rtri,1.0,0.0,0.0)#Rotting around X.
#COMENZANDO A DIBUJAR EL TRIANGULO.
glBegin(GL_TRIANGLES)
glColor3f(1.0,0.0,0.0)#Color, justo antes del primer vertice (en
RGB---ROJO).
glVertex3f(window.width/2,window.height,0.0)#SUPERIOR.
glColor3f(0.0,1.0,0.0)#Color, justo antes del segundo vertice (en
RGB---VERDE).
glVertex3f(100.0,0.0,0.0)#INFERIOR IZQUIERDO.
glColor3f(0.0,0.0,1.0)#Color, justo antes del tercer vertice (en
RGB---AZUL).
glVertex3f(window.width,0.0,0.0)#INFERIOR DERECHO.
glEnd()
pyglet.app.run()
------------------------------------------------------------
The triangle basically disappears if I don't use decimals in 'rtri'.
If I use the decimals, it is when the triangle starts getting
'slashed.'
On 21 abr, 19:25, Greg Ewing <[email protected]> wrote:
> On 22/04/10 13:21, Alejandro Castellanos wrote:
>
> > But I'm having to use glRotatef(rtri, 0.0, 0.0, 1.0); which, yet
> > again, rotates around the Z axis but 'slashes' the figure if I attempt
> > to rotate around X or Y.
>
> You'll have to show us the code you're using to rotate
> about the other axes.
>
> It should be something like
>
> glRotatef(rtri, 1.0, 0.0, 0.0) # x-axis
> glRotatef(rtri, 0.0, 1.0, 0.0) # y-axis
>
> As for the "slashing", it sounds like the triangle
> is getting clipped by something, maybe the near or
> far plane. It might be that the triangle is actually
> getting rotated correctly, but you're having trouble
> seeing it because of clipping.
>
> --
> Greg
>
> --
> 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
> athttp://groups.google.com/group/pyglet-users?hl=en.
--
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.