Examples of GLTexture


Examples of org.mt4j.util.opengl.GLTexture

//      this.setTexture(glTex);
     
      GLTextureSettings ts = new GLTextureSettings();
      ts.wrappingHorizontal = WRAP_MODE.CLAMP;
      ts.wrappingVertical = WRAP_MODE.CLAMP;
      GLTexture glTex = new GLTexture(app, menuImage.width, menuImage.height, ts);
      glTex.loadGLTexture(menuImage);
      this.setTexture(glTex);
    }else{
      this.setTexture(menuImage);
    }
   
View Full Code Here

Examples of org.mt4j.util.opengl.GLTexture

    }
   
//    if (MT4jSettings.getInstance().isOpenGlMode()){ //FIXME USE WHICH ONE?
    if (this.isUseDirectGL()){
      if (newTexImage instanceof GLTexture) {
        GLTexture glTex = (GLTexture) newTexImage;
       
        if (glTex.getTextureTargetEnum() == TEXTURE_TARGET.RECTANGULAR){
          this.setTextureMode(PConstants.IMAGE);
         
          if (this.getGeometryInfo().isTextureCoordsNormalized()){
            //0..1 -> 0..width
            this.unNormalizeFromPOTtoRectMode(newTexImage, this.getVerticesLocal());
            this.getGeometryInfo().setTextureCoordsNormalized(false);
          }else{
            //0..oldWidth -> 0..newWidth  GLTexture is NPOT but this component's texture coords have seemingly already been un-normalized
            //FIXME dont do it if it has the same dimensions!
            this.fromRectModeToRectMode(newTexImage, this.getVerticesLocal(), this.lastTextureDimension.x, this.lastTextureDimension.y);
          }
        }else{
          //GLTexture is POT -> normalize tex coords if neccessary
          this.setTextureMode(PConstants.NORMALIZED);
         
          if (this.getGeometryInfo().isTextureCoordsNormalized()){
            //0..1 -> 0..1
          }else{
            //0..width -> 0..1
            this.normalizeFromRectMode(newTexImage, this.getVerticesLocal(), this.lastTextureDimension.x, this.lastTextureDimension.y);
            this.getGeometryInfo().setTextureCoordsNormalized(true);
          }
        }
        this.textureImage = newTexImage;
        //FIXME always save last tex dimensions? also if POT?
        this.lastTextureDimension.setXYZ(newTexImage.width, newTexImage.height, 0);
      }else{
        //We are in OpenGL mode but the new texture is not a GLTexture -> create new GLTexture from PImage
        boolean isPOT = Tools3D.isPowerOfTwoDimension(newTexImage);
        GLTextureSettings ts = new GLTextureSettings();
        if (!isPOT){
          ts.target = TEXTURE_TARGET.RECTANGULAR;
          this.setTextureMode(PConstants.IMAGE);
         
          if (this.getGeometryInfo().isTextureCoordsNormalized()){
            //0..1 -> 0..newWidth
            this.unNormalizeFromPOTtoRectMode(newTexImage, this.getVerticesLocal());
            this.getGeometryInfo().setTextureCoordsNormalized(false);
          }else{
            //0..oldWidth -> 0..newWidth
            //FIXME dont do it if it has the same dimensions!
            this.fromRectModeToRectMode(newTexImage, this.getVerticesLocal(), this.lastTextureDimension.x, this.lastTextureDimension.y);
          }
         
          this.textureImage = newTexImage;
          this.lastTextureDimension.setXYZ(newTexImage.width, newTexImage.height, 0);
        }else{
          ts.target = TEXTURE_TARGET.TEXTURE_2D;
          this.setTextureMode(PConstants.NORMALIZED);
         
          //We are in OpenGL mode, new texture is a PImage, is POT -> create POT GLTexture and un-normalize tex coords if neccessary
          if (this.getGeometryInfo().isTextureCoordsNormalized()){
            //0..1 -> 0..1
          }else{
            //normalize 0..width -> 0..1
            this.normalizeFromRectMode(newTexImage, this.getVerticesLocal(), this.lastTextureDimension.x, this.lastTextureDimension.y);
            this.getGeometryInfo().setTextureCoordsNormalized(true);
          }
        }
       
        //Create new GLTexture from PImage
        ts.shrinkFilter     = SHRINKAGE_FILTER.BilinearNoMipMaps;
        ts.expansionFilter     = EXPANSION_FILTER.Bilinear;
        ts.wrappingHorizontal   = WRAP_MODE.CLAMP_TO_EDGE;
        ts.wrappingVertical   = WRAP_MODE.CLAMP_TO_EDGE;
        GLTexture newGLTexture = new GLTexture(this.getRenderer(), newTexImage, ts);
//        newGLTexture.format = newTexImage.format;  //FIXME REMOVE?
       
        this.textureImage = newGLTexture;
        this.lastTextureDimension.setXYZ(newTexImage.width, newTexImage.height, 0);
      }
View Full Code Here

Examples of org.mt4j.util.opengl.GLTexture

//    this.boundingShape = null;
    this.setBounds(null);
   
    //Delete openGL texture object
    if (this.getTexture() instanceof GLTexture){
      GLTexture tex = (GLTexture) this.getTexture();
      //Delete texture
      tex.destroy();
      this.setTexture(null);
      this.setTextureEnabled(false);
    }
    super.destroy();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.