It's okay. As I stated before, the problem has been solved (idiocy was the main culprit).
But thanks for the help. It really did push me towards finding the solution on my own. Alejandro Castellanos. On 2 oct, 20:47, Gary Herron <[email protected]> wrote: > On 10/02/2010 07:47 PM, Alejandro Castellanos wrote: > > > > > These are actually the lines I tried after reading your post: > > -------------CODE START: > > > import pyglet > > import math > > from pyglet.gl import * > > > #Direct OpenGL commands to this window. > > > window = pyglet.window.Window(200, 200); > > config = Config(double_buffer=True, depth_size=1000) > > pyglet.window.Window.__init__(window, > > config=config, > > vsync=True, > > width=window.width, > > height=window.height, > > resizable=True) > > > -------------CODE END. > > > The rest pretty much remains the same, the functions are pretty much > > unchanged. But alas, that does not seem to fix it. Unless I royally > > misinterpreted your post (for which I shamefully apologize) that does > > not seem to be the problem as things remain the same. > > > I'm kinda surprised, and stumped. Do you have my exact problem when > > copying and pasting my code? 'Cause if the problem is mostly local > > then I may be royally screwed. I hope not as I was kinda jazzed at > > flexing some of my math muscle with some 3D stuff once I found my way > > around operating Opengl in pyglet. > > > Though thanks for taking the time. It's always appreciated. > > No, sorry, I did not even run your code. I just flashed on our > description of the problem and read your code. > > Something in the mail system is mangling your code. (Introducing many > extra line breaks.) If you attach it as a file, I'll try running it > on both Linux and Windows and see if I can reproduce the problem. (Then > see if I can solve it.) > > -- > Gary Herron, PhD. > Department of Computer Science > DigiPen Institute of Technology > (425) 895-4418 > > > On 2 oct, 19:13, Gary Herron<[email protected]> wrote: > > >> On 10/02/2010 03:46 PM, Alejandro Castellanos wrote: > > >>> Hi, I've been away from Pyglet for a while and now that time allows > >>> I'm back again, trying some Opengl stuff. I've been following some > >>> tutorials online (the NeHe ones) but I found something rather odd: > > >>> I'm trying to draw a pyramid with no base and I make it spin around > >>> the Y axis, and everything seems just fine except for the fact that > >>> the drawing of the faces seems rather odd, appearing superimposed over > >>> each other, from the last one to the first one. The pyramid spins just > >>> fine but it all just looks weird. > > >>> I've tried drawing the individual faces individually, and then they > >>> seem just fine. Everything goes out the window when I try to draw them > >>> all in the same scene, though. > > >>> The faces have different colors so maybe that's it, but the problem is > >>> that I can't see where I'm going wrong. > > >> What you describe sounds like the depth buffer isn't working. I see > >> where you enable depth testing and where you clear the depth buffer, but > >> missing is the request for a depth buffer to be allocated. If I > >> remember correctly, some implementations give you one whether or not you > >> ask for it, and some only if you explicitly ask for it. So I always > >> make it explicit. Here's a bit cut and pasted from one of my apps that > >> runs on both Windows and Linux. > > >> config = Config(double_buffer=True, depth_size=24) > > >> pyglet.window.Window.__init__(self, > >> config=config, > >> vsync=True, > >> width=width, > >> height=height, > >> resizable=True) > > >> Hope that's the problem... > > >> Gary Herron > > >>> Code is Below: > > >>> --------------------------------------------------------------------------- > >>> CODE START: > > >>> import pyglet > >>> import math > >>> from pyglet.gl import * > > >>> #Direct OpenGL commands to this window. > >>> #window = pyglet.window.Window(resizable=True) > >>> window = pyglet.window.Window(200, 200, resizable=True); > > >>> def ReSizeGLScene(width, height): > >>> glViewport(0, 0, width, height); > >>> glMatrixMode(GL_PROJECTION); > >>> glLoadIdentity(); > >>> gluPerspective(45.0,width/height,0.1,100.0); > >>> glMatrixMode(GL_MODELVIEW); > > >>> def InitGL(): > >>> glShadeModel(GL_SMOOTH); > >>> glClearColor(0.0, 0.0, 0.0, 0.0); > >>> glClearDepth(1.0); > >>> glEnable(GL_DEPTH_TEST); > >>> glDepthFunc(GL_LEQUAL); > >>> glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); > >>> return True > > >>> def PyramidExmpl(): > >>> glBegin(GL_TRIANGLES);#Drawing using triangles > >>> #DRAWING FRONT FACE. > >>> glColor3f(1.0,0.0,0.0);#---------------------------RED > >>> glVertex3f(0.0,1.0,0.0);#Top > >>> glVertex3f(-1.0,-1.0,1.0);#Bottom Left > >>> glVertex3f(1.0,-1.0,1.0);#Bottom Right > >>> #DRAWING RIGHT FACE. > >>> glColor3f(0.0,0.0,1.0);#---------------------------BLUE > >>> glVertex3f(0.0,1.0, 0.0);#Top > >>> glVertex3f(1.0,-1.0,1.0);#Bottom Left > >>> glVertex3f(1.0,-1.0,-1.0);#Bottom Right > >>> #DRAWING BACK FACE. > >>> glColor3f(0.0,1.0,0.0);#---------------------------GREEN > >>> glVertex3f(0.0,1.0,0.0);#Top > >>> glVertex3f(1.0,-1.0,-1.0);#Bottom Left > >>> glVertex3f(-1.0,-1.0,-1.0);#Bottom Right > >>> #DRAWING LEFT FACE. > >>> glColor3f(1.0,1.0,0.0);#---------------------------YELLOW > >>> glVertex3f(0.0,1.0,0.0);#Top > >>> glVertex3f(-1.0,-1.0,-1.0);#Bottom Left > >>> glVertex3f(-1.0,-1.0,1.0);#Bottom Right > >>> glEnd();#Finished Drawing The Pyramid > > >>> #---------------------------------- > >>> #---------------------------------- > > >>> class Rots(object): > >>> def __init__(self): > >>> self.tri = 0 > >>> self.quad = 0 > > >>> def DrawGLScene(rtri,rquad): > >>> glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);#Clear The > >>> Screen And The Depth Buffer > > >>> glLoadIdentity();#Reset The Current Modelview Matrix > >>> glTranslatef(-1.5,0.0,-6.0); #Move Left 1.5 Units And Into The > >>> Screen 6.0. > >>> glRotatef(rtri,0.0,1.0,0.0);#Rotate The Triangle On The Y axis > >>> ( NEW ) > >>> PyramidExmpl() > > >>> "Defino un objeto que guarda unas variables r.tri y r.quad" > >>> "para que puedan ser accesadas desde adentro de una funcion." > >>> #----------------------------------Definiendo mis variables globales. > >>> r=Rots()#En este objeto guardo los valores de mis variables globales. > >>> r.tri=0.0 > >>> r.quad=0.0 > >>> #---------------------------------- > >>> def sumadorangulos(dt):#Es la funcion que se encarga de sumarles > >>> valores. > >>> r.tri = r.tri+2.0 > >>> if r.tri>= 360: > >>> r.tri=0 > > >>> @window.event > >>> def on_draw(): > >>> DrawGLScene(r.tri,r.quad) > >>> ReSizeGLScene(window.width, window.height) > > >>> pyglet.clock.schedule_interval(sumadorangulos, 1.0/60.0)#lo que hecha > >>> a andar el sumador. > > >>> pyglet.app.run() > >>> --------------------------------------------------------------------------- > >>> CODE END. > > >>> Sadly I can't really tell where my mistake is. > > >>> Anyways, any help would be greatly appreciated. Thanks in advance. -- 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.
