def loadImage(self, file_name): """ Loads an image to be displayed on the plane as a texture. Displays a warning message if the image format is not supported or the file cannot be open. This method should be extened to support basic image operations (resizing, flipping, cropping). @param file_name: The name of the image file. """ # piotr 080528 self.deleteImage() try: mipmaps, image = load_image_into_new_texture_name(file_name) self.imagePath = file_name # piotr 080624 self.tex_image = image # this gl_update may not be enough to show the image immediately self.glpane.gl_update() except: msg = redmsg("Cannot load plane image " + file_name) env.history.message(msg) self.tex_image = None
def ensure_courierfile_loaded(): #e rename to reflect binding too """ Load font-texture if we edited the params for that in this function, or didn't load it yet; bind it for drawing """ tex_filename = courierfile ## "xxx.png" # the charset "courierfile" tex_data = (tex_filename,) if vv.tex_name == 0 or vv.tex_data != tex_data: vv.have_mipmaps, vv.tex_name = load_image_into_new_texture_name( tex_filename, vv.tex_name) vv.tex_data = tex_data else: pass # assume those vars are fine from last time setup_to_draw_texture_name(vv.have_mipmaps, vv.tex_name) return
def ensure_courierfile_loaded(): #e rename to reflect binding too """ Load font-texture if we edited the params for that in this function, or didn't load it yet; bind it for drawing Anything that calls this should eventually call glpane.kluge_reset_texture_mode_to_work_around_renderText_bug(), but only after all drawing using the texture is done. """ tex_filename = courierfile ## "xxx.png" # the charset "courierfile" tex_data = (tex_filename, ) if vv.tex_name == 0 or vv.tex_data != tex_data: vv.have_mipmaps, vv.tex_name = load_image_into_new_texture_name( tex_filename, vv.tex_name) vv.tex_data = tex_data else: pass # assume those vars are fine from last time setup_to_draw_texture_name(vv.have_mipmaps, vv.tex_name) return
def ensure_courierfile_loaded(): #e rename to reflect binding too """ Load font-texture if we edited the params for that in this function, or didn't load it yet; bind it for drawing Anything that calls this should eventually call glpane.kluge_reset_texture_mode_to_work_around_renderText_bug(), but only after all drawing using the texture is done. """ tex_filename = courierfile ## "xxx.png" # the charset "courierfile" tex_data = (tex_filename,) if vv.tex_name == 0 or vv.tex_data != tex_data: vv.have_mipmaps, vv.tex_name = load_image_into_new_texture_name( tex_filename, vv.tex_name) vv.tex_data = tex_data else: pass # assume those vars are fine from last time setup_to_draw_texture_name(vv.have_mipmaps, vv.tex_name) return