hi,
I have two questions please:
1. What is the difference between a classmethod and a staticmethod, and when would i use either?
2. I want to create an object, presumably a class, to handle attributes of an open gl object.
For example, if i wanted to create a 2d square i need 4 points, each with an x,y co-ord, and each point could also have an optional colour, in the form (1.0, 1.0, 1.0), each of these items is then passed to the 'drawing' function to actually draw the square or polygon etc.
My question is how do i design the appropriate class to do this, i have coded these with lists at the moment, eg
def vertex_position():
vp_r = raw_input('Please enter the co-ordinate for each vertex ')
vp_m = map(int, vp_r.split(','))
return vp_m
and simply call vp_m[i] for the various vertices, however i think that the class method should be simpler.
My main problem is that i need, pairs of co-ords for the vertices and tuples for the colour and am not sure how to code/return this using classes, the other issue realting to this is that the open gl uses the same attribute name for each, ie glVertex2i and glColor3f, and am not sure how to pass this correctly, i have included my open gl below to show how i reference it using the lists at the moment,
glColor3f(1.0, 0.0, 0.0)
glVertex2i(l[0], l[1])
glColor3f(0.0, 1.0, 0.0)
glVertex2i((l[0] + width), l[1])
glColor3f(0.0, 0.0, 1.0)
glVertex2i((l[0] + width), (l[1] + height))
glColor3f(1.0, 1.0, 1.0)
glVertex2i(l[0], (l[1] + height))
glEnd()
This is based on a square, but i would like to change the number of vertices using a for loop, i am just unsure how to get the variables into the correct places.
thanks
paul
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor