Aheeee!
Now the Treevin seem Okhttp://www.kino3d.com/~Ken75/makehuman/MH_GUIbeta087.zip
I’ve used the default MODELVIEW matrix, and I’ve
used push and popMatrix() for the PROJECTION matrix.
Now you can see the Blender Button and the 3D object.
The display list is created in the init
UPDATE 10/10/2002.
Sorry…after 45 min the Tridiwin has
used all memory of my machine…
I don’t understand where is the error.
Please take a look on code and help me…
import Blender
from Blender.BGL import *
from Blender.Draw import Redraw
from BaseWindowClass import BaseWindowClass
class Tridiwin(BaseWindowClass):
def __init__(self, LocX, LocY, Width, Height, obj, Deco):
BaseWindowClass.__init__(self,LocX,LocY,Width,Height)
self.Frame = 0
self.ObjectToDraw=obj
self.title = "3D object"
self.decoration = Deco
global displayList
if len(self.ObjectToDraw)>0:
displayList=glGenLists(1)
glNewList(displayList, GL_COMPILE)
glColor3f(1.0, 0.0, 0.0)
for face in self.ObjectToDraw:
glBegin(GL_LINE_LOOP)
for v in face:
glVertex3f(v[0], v[1], v[2])
glEnd()
glFlush()
glEndList()
def moveAndRotate(self):
#glMatrixMode(GL_MODELVIEW)
#glPushMatrix()
#glLoadIdentity()
glTranslatef(0.0, 0.0, -5.0)
if (self.Frame>=720):
glRotatef(self.Frame, 0.0, 1.0, 0.0)
elif (self.Frame>=360):
glRotatef(self.Frame, 1.0, 0.0, 0.0)
else:
glRotatef(self.Frame, 0.0, 0.0, 1.0)
self.Frame= self.Frame+10
if (self.Frame>1080): self.Frame= 0
glCallList(displayList)
#glPopMatrix()
def drawIt(self):
WinSize = Buffer(GL_FLOAT,4);
glGetFloatv(GL_SCISSOR_BOX,WinSize)
if self.decoration == 0:
self.drawBox()
else:
self.drawBoxS()
self.drawTitle(self.title)
# Cause this window to be continuously redisplayed
Redraw(1)
glMatrixMode(GL_PROJECTION)
glPushMatrix()
glLoadIdentity()
glOrtho(-5.0, 5.0, -5.0, 5.0, 0.1, 10.0)
glViewport(self.LocX+WinSize[0], self.LocY+WinSize[1]-self.Height, self.Width, self.Height)
self.moveAndRotate()
glPopMatrix()
In the client code I use only the drawIt() function. The
list is generated only when a istance is create (one time) in the
client code, because I put it in the init of Tridiwin class