コード例 #1
0
ファイル: Plane.py プロジェクト: elfion/nanoengineer
    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
コード例 #2
0
ファイル: Plane.py プロジェクト: ematvey/NanoEngineer-1
    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
コード例 #3
0
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
コード例 #4
0
ファイル: texture_fonts.py プロジェクト: vcsrc/nanoengineer
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
コード例 #5
0
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