Package javax.media.opengl

Examples of javax.media.opengl.GLException


    throw new GLException(message);
  }
 
  public void validate() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    glInvoke("glValidateProgram", int.class, getId());
   
    int[] status = new int[1];
    glInvoke("glGetProgramiv",
      int.class, getId(),
      int.class, GL3.GL_VALIDATE_STATUS,
      int[].class, status,
      int.class, 0
    );
   
    if (status[0] == GL.GL_TRUE) {
      return;
    }
   
    int[] length = new int[1];
    glInvoke("glGetProgramiv",
      int.class, getId(),
      int.class, GL3.GL_INFO_LOG_LENGTH,
      int[].class, length,
      int.class, 0
    );
   
    byte[] chars = new byte[length[0]];
    glInvoke("glGetProgramInfoLog",
      int.class, getId(),
      int.class, length[0],
      int[].class, length,
      int.class, 0,
      byte[].class, chars,
      int.class, 0
    );
   
    String message = new String(chars, Charset.forName("utf-8"));
    throw new GLException(message);
  }
View Full Code Here


    );
  }
 
  public void bind() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    glInvoke("glUseProgram",
      int.class, getId()
    );
View Full Code Here

    );
  }
 
  public void unbind() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    glInvoke("glUseProgram",
      int.class, 0
    );
View Full Code Here

    setUrl(url);
  }
 
  public URL getUrl() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    return url;
  }
View Full Code Here

    if (value == null) {
      throw new IllegalArgumentException();
    }
   
    if (isDisposed()) {
      throw new GLException();
    }
   
    url = value;
  }
View Full Code Here

    url = value;
  }

  public void load() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    if (url == null) {
      throw new GLException();
    }
   
    try {
      texture = TextureIO.newTexture(url, false, ".jpg");
      texture.setTexParameteri(getGL(), GL3.GL_TEXTURE_MIN_FILTER, GL3.GL_LINEAR);
      texture.setTexParameteri(getGL(), GL3.GL_TEXTURE_MAG_FILTER, GL3.GL_LINEAR);
      texture.setTexParameteri(getGL(), GL3.GL_TEXTURE_WRAP_S, GL3.GL_CLAMP_TO_EDGE);
      texture.setTexParameteri(getGL(), GL3.GL_TEXTURE_WRAP_T, GL3.GL_CLAMP_TO_EDGE);
    } catch (RuntimeException ex) {
      throw ex;
    } catch (Exception ex) {
      throw new GLException(ex);
    }
  }
View Full Code Here

    }
  }
 
  public void enable() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    if (texture == null) {
      throw new GLException();
    }
   
    texture.enable(getGL());
  }
View Full Code Here

    texture.enable(getGL());
  }
 
  public void disable() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    if (texture == null) {
      throw new GLException();
    }
   
    texture.disable(getGL());
  }
View Full Code Here

    texture.disable(getGL());
  }
 
  public void bind() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    if (texture == null) {
      throw new GLException();
    }
   
    texture.bind(getGL());
  }
View Full Code Here

      Method method = type.getMethod(name, types);
      return method.invoke(gl, args);
    } catch (RuntimeException ex) {
      throw ex;
    } catch (Exception ex) {
      throw new GLException(ex);
    }
  }
View Full Code Here

TOP

Related Classes of javax.media.opengl.GLException

Copyright © 2018 www.massapicom. 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.