Beispiel #1
0
 def LoadConsole( self ):
     '''
     Setup the console display
     '''
     self.font = glFreeType.font_data( "%s/gui/fonts/body.ttf" % self.DATA_PATH, 22 )
     self.Titlefont = glFreeType.font_data( "%s/gui/fonts/head.ttf" % self.DATA_PATH, 72 )
     self.m_Messages = []
    def OnInitGL(self):
        glClearColor(1, 1, 1, 1)
        glMatrixMode(GL_PROJECTION)
        glLoadIdentity()
        # Middle of the canvas is the origin
        glOrtho(-self.hwidth,self.hwidth,self.hheight,-self.hheight,0,1)
        glMatrixMode(GL_MODELVIEW)
        glDisable(GL_DEPTH_TEST)
        glLineWidth(2)

        # enable the alpha channel
        glEnable(GL_BLEND)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
        
        # enable line smoothing
        glEnable(GL_LINE_SMOOTH)
        glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST)
        
        # quadric for drawing circles
        self.quadric = gluNewQuadric()

        ### NOTE: the coordinate origin of the glPrint function is
        ### at the bottom-left corner. Be aware of it !!!
        self.myFont = glFreeType.font_data(self.dataInput.cwd+"\Font.ttf", 30)
        self.myCompassFont = glFreeType.font_data(self.dataInput.cwd+"\Font.ttf", 25)
        self.smallFont = glFreeType.font_data(self.dataInput.cwd+"\Font.ttf", 16)
Beispiel #3
0
 def LoadConsole(self):
     '''
     Setup the console display
     '''
     self.font = glFreeType.font_data(
         "%s/gui/fonts/body.ttf" % self.DATA_PATH, 22)
     self.Titlefont = glFreeType.font_data(
         "%s/gui/fonts/head.ttf" % self.DATA_PATH, 72)
     self.m_Messages = []
Beispiel #4
0
def InitGL(Width, Height):
	global width,height,our_font,our_font2
	LoadTextures(("texture.jpg", "walls.jpg", "floor.jpg","blend.jpg"))
	glEnable(GL_TEXTURE_2D)
	glShadeModel(GL_SMOOTH)
	glDepthFunc(GL_LESS)
	glEnable(GL_DEPTH_TEST)
	glDepthFunc(GL_LEQUAL)
	glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)	
	glClearColor(0.0, 0.0, 0.0, 0.0)
	glClearDepth(1.0)	
	glShadeModel(GL_SMOOTH) 
	glBlendFunc(GL_SRC_ALPHA,GL_ONE)
	our_font = glFreeType.font_data ("font.ttf", 50)
	our_font2 = glFreeType.font_data ("fonter.ttf", 25)
	return True
Beispiel #5
0
def set_up(width, height):
    font = glFreeType.font_data( "free_sans.ttf", 30 )
    glOrtho(0.0, width, 0.0, height,-1.0,1.0)
    glClearColor(0.0,0.0,0.0,0.0)

    widgets_list["object_text"] = widgets.Text_Box(0,500, True, "reimu")
    widgets_list["object_button"] = widgets.Button(25, 560, "button", "button_down", load_spritesheet, (widgets_list["object_text"],))
    widgets_list["spritesheet"] = widgets.Null_Widget()

    widgets_list["action_name"] = widgets.Text_Box(200,500, True, "idle-s")
    widgets_list["frame_number"] = widgets.Int_Box(200,480, True, "0")
    widgets_list["frame_x"] = widgets.Int_Box(200,460, True, "0")
    widgets_list["frame_y"] = widgets.Int_Box(260,460, True, "0")
    widgets_list["frame_w"] = widgets.Int_Box(200,440, True, "0")
    widgets_list["frame_h"] = widgets.Int_Box(260,440, True, "0")
    widgets_list["selection"] = widgets.Selection_Box(10,10,100,100,widgets_list, "spritesheet")
    f = widgets_list["selection"].set_dimensions
    args = widgets_list["frame_x"], widgets_list["frame_y"], widgets_list["frame_w"], widgets_list["frame_h"]
    widgets_list["frame_button"] = widgets.Button(210, 520, "button", "button_down", f, args)
    widgets_list["save_button"] = widgets.Button(180, 400, "button", "button_down", save_frame,())
    pygame.time.set_timer(pygame.USEREVENT+1, 300)
    global animated
    try:

        animated = widgets.Animated(600,470,"reimu")
        #print animated.data.actions
        for a in animated.data.actions:
            print a, ": ",
            for f in animated.data.actions[a]:
                print f,
            print ""

    except:
        print "Load Failed"
    def __init__(self, filename):
        self.filename = filename

        pygame.init()
        WINDOW = pygame.display.set_mode((width, height), OPENGL | DOUBLEBUF)
        pygame.display.set_caption('3D Text Renderer')
        glutInit(sys.argv)
        self.WINDOW = WINDOW
        self.our_font = glFreeType.font_data("Test.ttf", FONT_SIZE)

        self.loglikelihood = None
        self.observedIm = None
        self.currentIm = None
        self.state = dict()
        self.state['params'] = {
            'room_self.size_x': SIZEX,
            'room_self.size_y': SIZEY
        }
        self.state['blur'] = True
        self.resolution = SIZEX * SIZEY

        self.pool = dict()
        self.exploreJ = dict()
        self.BLUR = None
        self.loadfilename = None
Beispiel #7
0
    def __init__(self, vsAI=1):
        self.ball = Ball()
        self.P1 = Player(25,HEIGHT/2.0)
        self.P2 = Player(WIDTH-25, HEIGHT/2.0, vsAI)
        
        self.MAX_BALL_ATTENUATION = 0.25

        self.our_font = glFreeType.font_data ("Test.ttf", 16) 
Beispiel #8
0
 def initializeGL(self):
   glEnable(GL_BLEND)
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
   #glEnable(GL_TEXTURE_2D) # Enables texture mapping
   glEnable(GL_LINE_SMOOTH)
   self.font = glFreeType.font_data(self.font_file, 64)
   #glEnable(GL_POLYGON_STIPPLE)
   #pattern=np.fromfunction(lambda x,y: 0xAA, (32,32), dtype=uint1)
   #glPolygonStipple(pattern)
   (r,g,b,a) = self.colorscheme['background']
   glClearColor(r, g, b, a)
   self.make_dot_field_vbo()
   self.gldraw = GLDraw(self, self.font, self.colorscheme)
Beispiel #9
0
def InitGL(Width, Height):				# We call this right after our OpenGL window is created.
	global our_font
	glShadeModel(GL_SMOOTH)				# Enables Smooth Color Shading
	glClearColor(0.0, 0.0, 0.0, 0.5)	# This Will Clear The Background Color To Black
	glClearDepth(1.0)					# Enables Clearing Of The Depth Buffer
	glEnable(GL_DEPTH_TEST)				# Enables Depth Testing
	glEnable(GL_TEXTURE_2D)				# Enables texture mapping
	glDepthFunc(GL_LEQUAL)				# The Type Of Depth Test To Do
	glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) # Really Nice Perspective Calculations

	# Currently omitting the wgl based font. See lesson13.py for example use of wgl font.
	# FYI, the ttf font file "Test.ttf" in lesson43 is the typeface "Arial Black Italic".
	# our_font = glFreeType.font_data ("ARBLI___.ttf", 16)
	our_font = glFreeType.font_data ("Test.ttf", 16)

	return True
Beispiel #10
0
def InitGL(Width, Height):				# We call this right after our OpenGL window is created.
	global our_font
	glShadeModel(GL_SMOOTH)				# Enables Smooth Color Shading
	glClearColor(0.0, 0.0, 0.0, 0.5)	# This Will Clear The Background Color To Black
	glClearDepth(1.0)					# Enables Clearing Of The Depth Buffer
	glEnable(GL_DEPTH_TEST)				# Enables Depth Testing
	glEnable(GL_TEXTURE_2D)				# Enables texture mapping
	glDepthFunc(GL_LEQUAL)				# The Type Of Depth Test To Do
	glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) # Really Nice Perspective Calculations

	# Currently omitting the wgl based font. See lesson13.py for example use of wgl font.
	# FYI, the ttf font file "Test.ttf" in lesson43 is the typeface "Arial Black Italic".
	# our_font = glFreeType.font_data ("ARBLI___.ttf", 16)
	our_font = glFreeType.font_data ("Test.ttf", 16)

	return True
Beispiel #11
0
 def initializeGL(self):
   self.glversion = glGetString(GL_VERSION)
   self.glversion = self.glversion.split()[0] # take numeric part
   self.glversion = self.glversion.split('.') # split on dots
   if len(self.glversion) < 2:
     raise Exception("Error parsing openGL version")
   self.glversion = float("%s.%s" % (self.glversion[0], self.glversion[1]))
   glEnable(GL_BLEND)
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
   #glEnable(GL_TEXTURE_2D) # Enables texture mapping
   glEnable(GL_LINE_SMOOTH)
   self.font = glFreeType.font_data(self.font_file, 64)
   #glEnable(GL_POLYGON_STIPPLE)
   #pattern=np.fromfunction(lambda x,y: 0xAA, (32,32), dtype=uint1)
   #glPolygonStipple(pattern)
   (r,g,b,a) = self.colorscheme['background']
   glClearColor(r, g, b, a)
   self.make_dot_field_vbo()
   self.gldraw = GLDraw(self, self.font, self.colorscheme)
Beispiel #12
0
 def initializeGL(self):
   self.glversion = glGetString(GL_VERSION)
   self.glversion = self.glversion.split()[0] # take numeric part
   self.glversion = self.glversion.split('.') # split on dots
   if len(self.glversion) < 2:
     raise Exception("Error parsing openGL version")
   self.glversion = float("%s.%s" % (self.glversion[0], self.glversion[1]))
   glEnable(GL_BLEND)
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
   #glEnable(GL_TEXTURE_2D) # Enables texture mapping
   glEnable(GL_LINE_SMOOTH)
   self.font = glFreeType.font_data(self.font_file, 64)
   #glEnable(GL_POLYGON_STIPPLE)
   #pattern=np.fromfunction(lambda x,y: 0xAA, (32,32), dtype=uint1)
   #glPolygonStipple(pattern)
   (r,g,b,a) = self.colorscheme['background']
   glClearColor(r, g, b, a)
   self.make_dot_field_vbo()
   self.gldraw = GLDraw(self, self.font, self.colorscheme)
Beispiel #13
0
    def __init__(self):
        pygame.init()
        WINDOW = pygame.display.set_mode((width,height),OPENGL|DOUBLEBUF)
        pygame.display.set_caption('3D Text Renderer')
        glutInit(sys.argv)
        self.WINDOW = WINDOW
        self.our_font = glFreeType.font_data("Test.ttf", FONT_SIZE)

        self.loglikelihood = None
        self.observedIm = None
        self.currentIm = None
        self.state = dict()
        self.state['params'] = {'room_self.size_x':SIZEX, 'room_self.size_y':SIZEY}
        self.state['blur'] = True
        self.resolution = SIZEX*SIZEY

        self.pool = dict()

        self.BLUR = None
Beispiel #14
0
 def __init__(self, x, y, modable = False):
     self.font = glFreeType.font_data( "free_sans.ttf", 20 )
     self.selected = False
     self.x, self.y = x, y
     self.modable = modable
Beispiel #15
0
 def __init__(self, x, y, modable=False):
     self.font = glFreeType.font_data("free_sans.ttf", 20)
     self.selected = False
     self.x, self.y = x, y
     self.modable = modable
Beispiel #16
0
	glLoadIdentity()                                   # reset position
    
	glColor4f(1.0,0.0,0.0,0.7)

	glEnable(GL_BLEND)
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

	global font
	font.glPrint(600,480,"Space Palette")
	font.glPrint(600,380,"is initializing")

	# draw_rect(-0.725,-0.175,0.8,0.8,0.2, True)

	glutSwapBuffers()

# initialization
glutInit()                                             # initialize glut
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
glutInitWindowSize(1920, 1080)                      # set window size
glutInitWindowPosition(1024, 0)                           # set window position
window = glutCreateWindow("PaletteProgress")              # create window with title
# glutFullScreen()

fontname = "arial.ttf"
fontheight = 80
font = glFreeType.font_data(fontname,fontheight)

glutDisplayFunc(draw)                                  # set draw function callback
glutIdleFunc(draw)                                     # draw all the time
glutMainLoop()                                         # start everything