Ejemplo n.º 1
0
 /**
  * @param id
  * @param data @Info Stocke le FloatBuffer dans le GPU
  */
 public void bufferData() {
   buffer = BufferUtils.createFloatBuffer(floatlist.size());
   for (Float f : floatlist) {
     buffer.put(f);
   }
   buffer.flip();
   glBindBuffer(GL_ARRAY_BUFFER, vboID);
   glBufferData(GL_ARRAY_BUFFER, buffer, GL_STATIC_DRAW);
   //		glBufferSubData(vboID, 0, buffer);
   glBindBuffer(GL_ARRAY_BUFFER, 0);
   bufferSize = buffer.limit() / 7; // 7 = 3 vertex(x,y,z) + 4 color (r,g,b,a)
 }
Ejemplo n.º 2
0
  private void init() {
    if (glfwInit() != GL_TRUE) {
      System.err.println("Could not initialize GLFW!");
      return;
    }

    glfwWindowHint(GLFW_SAMPLES, 4);
    glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
    OSCompatibility.GLFWSpecifics();
    window = glfwCreateWindow(width, height, "Voxel Engine", NULL, NULL);
    if (window == NULL) {
      System.err.println("Could not create GLFW window!");
      return;
    }
    // Compatibility for screen with 1:X | X =/= 1 ratio
    ByteBuffer FBW = BufferUtils.createByteBuffer(4), FBH = BufferUtils.createByteBuffer(4);
    glfwGetFramebufferSize(window, FBW, FBH);
    pix_width = FBW.getInt(0);
    pix_height = FBH.getInt(0);

    InitWindow();
    InitGL();
  }