Package javax.media.opengl

Examples of javax.media.opengl.GLException


    setSource(source);
  }
 
  public String getSource() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    return source;
  }
View Full Code Here


    if (value.isEmpty()) {
      throw new IllegalArgumentException();
    }
   
    if (isDisposed()) {
      throw new GLException();
    }

    glInvoke("glShaderSource",
      int.class, getId(),
      int.class, 1,
View Full Code Here

    source = value;
  }
 
  public void compile() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    if (source == null || source.isEmpty()) {
      throw new GLException();
    }
   
    glInvoke("glCompileShader",
      int.class, getId()
    );
   
    int[] status = new int[1];
    glInvoke("glGetShaderiv",
      int.class, getId(),
      int.class, GL3.GL_COMPILE_STATUS,
      int[].class, status,
      int.class, 0
    );
   
    if (status[0] == GL.GL_TRUE) {
      return;
    }
   
    int[] length = new int[1];
    glInvoke("glGetShaderiv",
      int.class, getId(),
      int.class, GL3.GL_INFO_LOG_LENGTH,
      int[].class, length,
      int.class, 0
    );
   
    byte[] chars = new byte[length[0]];
    glInvoke("glGetShaderInfoLog",
      int.class, getId(),
      int.class, length[0],
      int[].class, length,
      int.class, 0,
      char[].class, chars,
      int.class, 0
    );
   
    String message = new String(chars, Charset.forName("utf-8"));
    throw new GLException(message);
  }
View Full Code Here

    this.gl = gl;
  }
 
  public final GL getGL() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    return gl;
  }
View Full Code Here

    return gl;
  }
 
  public final int getId() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    return id;
  }
View Full Code Here

    disposed = true;
  }
 
  protected final void setId(int value) {
    if (id != 0) {
      throw new GLException();
    }
   
    id = value;
  }
View Full Code Here

    setId((Integer )glInvoke("glCreateProgram"));
  }
 
  public GLShader[] getShaders() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    List<GLShader> shaderList = getShaderList();
    return shaderList.toArray(new GLShader[shaderList.size()]);
  }
View Full Code Here

    if (shader.isDisposed()) {
      throw new IllegalArgumentException();
    }
   
    if (isDisposed()) {
      throw new GLException();
    }
   
    glInvoke("glAttachShader",
      int.class, getId(),
      int.class, shader.getId()
View Full Code Here

    if (shader.isDisposed()) {
      throw new IllegalArgumentException();
    }
   
    if (isDisposed()) {
      throw new GLException();
    }
   
    getShaderList().remove(shader);
    glInvoke("glDetachShader",
      int.class, getId(),
View Full Code Here

    }
  }
 
  public void link() {
    if (isDisposed()) {
      throw new GLException();
    }
   
    glInvoke("glLinkProgram", int.class, getId());
   
    int[] status = new int[1];
    glInvoke("glGetProgramiv",
      int.class, getId(),
      int.class, GL3.GL_LINK_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

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.