Beispiel #1
0
  public static int createGLResource(int type, int param) {
    int id = 0;
    if (type == GL_TEXTURE_OBJECT) {
      int[] temp = new int[1];
      gl.glGenTextures(1, temp, 0);
      id = temp[0];
      glTextureObjects.add(id);
    } else if (type == GL_VERTEX_BUFFER) {
      int[] temp = new int[1];
      gl.glGenBuffersARB(1, temp, 0);
      id = temp[0];
      glVertexBuffers.add(id);
    } else if (type == GL_FRAME_BUFFER) {
      int[] temp = new int[1];
      gl.glGenFramebuffersEXT(1, temp, 0);
      id = temp[0];
      glFrameBuffers.add(id);
    } else if (type == GL_RENDER_BUFFER) {
      int[] temp = new int[1];
      gl.glGenRenderbuffersEXT(1, temp, 0);
      id = temp[0];
      glRenderBuffers.add(id);
    } else if (type == GLSL_PROGRAM) {
      id = gl.glCreateProgram();
      glslPrograms.add(id);
    } else if (type == GLSL_SHADER) {
      id = gl.glCreateShader(param);
      glslShaders.add(id);
    }

    return id;
  }
 /**
  * Creates a new texture ID.
  *
  * @param gl the GL object associated with the current OpenGL context
  * @return a new texture ID
  */
 private static int createTextureID(GL gl) {
   int[] tmp = new int[1];
   gl.glGenTextures(1, tmp, 0);
   return tmp[0];
 }