Hey All,

I've started using pyglet and have built a 3DS max loader with which
to load vertex coordinates polygons and textures. I'd like to put
these things into the pyglet app, but I'm having problems configuring
the z-corrdinate. The objects only seem to display if the z-coordinate
is between 0 and 1.

Here is my code:


#My custom 3DS loader
import DSMAXLOADER
import sys
import os.path
from pyglet.gl import *

#The format of the vertex list is as follows
# [(2,3,4), ..., (100,-1, -5)] (a list of 3 tuples)
#This function will convert into a single tuple
# (2,3,4,...,100, -1, -5), so that I can load it with pyglet
# This function also fixes the negative signs
# and scaling the relative pixels, so that they all fit in a window
def createvertexlist(vertices):
    store=list()
    for vertex in vertices:
        store+=map(lambda x: x/8+200, list(vertex))
        #This line will simply set all the z-coordinates to 0 (since
they won't display unless less than 1)
        store[-1]=0
    return tuple(store)





if __name__=="__main__":
    #Basic Processing of the 3DS File
    figure=DSMAXLOADER.dsfile()
    if(len(sys.argv)==2):
        filename=sys.argv[1]
        if(os.path.isfile(filename)):
            figure.load(filename)
        else:
            print("Not a File!")
            exit(0)

    #Getting the Window
    window = pyglet.window.Window(resizable="True")
    vertices=figure.vertices
    #Fixing the Vertices
    vertices=createvertexlist(vertices)

    @window.event
    def on_draw():
        window.clear()
        # Drawing the tuple of coordinates as 3d points
        pyglet.graphics.draw(len(vertices)/3, pyglet.gl.GL_POINTS,
('v3f', vertices))
    pyglet.app.run()


My question is:
How do I set it so that z-coordinates greater than 1 or less than
negative 1 actually show up?

-- 
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.

Reply via email to