Package org.lwjgl

Examples of org.lwjgl.LWJGLException


    private static Font font = new Font("Tahoma", Font.BOLD, 14);

    private int read_keyboard_key(int lastkey) throws LWJGLException
    {
        String place = tKeys.getValueAt(tKeys.getSelectedRow(), 0).toString();
        if(Display.isCreated())throw new LWJGLException();
        Display.setDisplayMode(new DisplayMode(220,50));
        Display.setTitle(place);
        Display.setVSyncEnabled(true);
        Display.setIcon(null);
        Display.create();
View Full Code Here


 
  FrameBuffer(Texture texture, boolean ownsTexture) throws LWJGLException {
    this.texture = texture;
    this.ownsTexture = ownsTexture;
    if (!isSupported()) {
      throw new LWJGLException("FBO extension not supported in hardware");
    }
    texture.bind();
    id = glGenFramebuffersEXT();
    glBindFramebufferEXT(GL_FRAMEBUFFER, id);
    glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                   texture.getTarget(), texture.getID(), 0);
    int result = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER);
    if (result!=GL_FRAMEBUFFER_COMPLETE) {
      glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
      glDeleteFramebuffers(id);
      throw new LWJGLException("exception "+result+" when checking FBO status");
    }
    glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
  }
View Full Code Here

  public ShaderProgram(String vertexShaderSource, String fragShaderSource,
      List<VertexAttrib> attribLocations) throws LWJGLException {
    if (vertexShaderSource == null || fragShaderSource == null)
      throw new IllegalArgumentException("shader source must be non-null");
    if (!isSupported())
      throw new LWJGLException("no shader support found; shaders require OpenGL 2.0");
    this.vertShaderSource = vertexShaderSource;
    this.fragShaderSource = fragShaderSource;
    vert = compileShader(VERTEX_SHADER, vertexShaderSource);
    frag = compileShader(FRAGMENT_SHADER, fragShaderSource);
    program = createProgram();
View Full Code Here

   * @return the OpenGL handle for the newly created shader program
   * @throws SlimException if the result is zero */
  protected int createProgram() throws LWJGLException {
    int program = glCreateProgram();
    if (program == 0)
      throw new LWJGLException("could not create program; check ShaderProgram.isSupported()");
    return program;
  }
View Full Code Here

   * @return the resulting ID
   * @throws SlimException if compilation was unsuccessful */
  protected int compileShader(int type, String source) throws LWJGLException {
    int shader = glCreateShader(type);
    if (shader == 0)
      throw new LWJGLException(
          "could not create shader object; check ShaderProgram.isSupported()");
    glShaderSource(shader, source);
    glCompileShader(shader);

    int comp = glGetShaderi(shader, GL_COMPILE_STATUS);
    int len = glGetShaderi(shader, GL_INFO_LOG_LENGTH);
    String t = shaderTypeString(type);
    String err = glGetShaderInfoLog(shader, len);
    if (err != null && err.length() != 0)
      log += t + " compile log:\n" + err + "\n";
    if (comp == GL11.GL_FALSE)
      throw new LWJGLException(log.length()!=0 ? log : "Could not compile "+shaderTypeString(type));
    return shader;
  }
View Full Code Here

   * appearance
   * @throws SlimException if this program is invalid (released) or if the
   * link was unsuccessful */
  protected void linkProgram(List<VertexAttrib> attribLocations) throws LWJGLException {
    if (!valid())
      throw new LWJGLException("trying to link an invalid (i.e. released) program");

    uniforms.clear();

    // bind user-defined attribute locations
    if (attribLocations != null) {
      for (VertexAttrib a : attribLocations) {
        if (a != null)
          glBindAttribLocation(program, a.location, a.name);
      }
    }

    attachShaders();
    glLinkProgram(program);
    int comp = glGetProgrami(program, GL_LINK_STATUS);
    int len = glGetProgrami(program, GL_INFO_LOG_LENGTH);
    String err = glGetProgramInfoLog(program, len);
    if (err != null && err.length() != 0)
      log = err + "\n" + log;
    if (log != null)
      log = log.trim();
    if (comp == GL11.GL_FALSE)
      throw new LWJGLException(log.length()!=0 ? log : "Could not link program");

    fetchUniforms();
    fetchAttributes();
  }
View Full Code Here

      }
     
      return new Cursor(imageData.getTexWidth(), imageData.getTexHeight(), x, yspot, 1, buf.asIntBuffer(), null);
    } catch (Throwable e) {
      Log.info("Chances are you cursor is too small for this platform");
      throw new LWJGLException(e);
    }
  }
View Full Code Here

        yspot = 0;
      }
      return new Cursor(width,height, x, yspot, 1, buf.asIntBuffer(), null);
    } catch (Throwable e) {
      Log.info("Chances are you cursor is too small for this platform");
      throw new LWJGLException(e);
    }
  }
View Full Code Here

        yspot = 0;
      }
      return new Cursor(imageData.getTexWidth(), imageData.getTexHeight(), x, yspot, 1, buf.asIntBuffer(), null);
    } catch (Throwable e) {
      Log.info("Chances are you cursor is too small for this platform");
      throw new LWJGLException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.lwjgl.LWJGLException

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.