static {
    IntBuffer offsets = BufferUtils.createIntBuffer(6);

    SIZEOF = offsets(memAddress(offsets));

    WIDTH = offsets.get(0);
    HEIGHT = offsets.get(1);
    REDBITS = offsets.get(2);
    GREENBITS = offsets.get(3);
    BLUEBITS = offsets.get(4);
    REFRESHRATE = offsets.get(5);
  }
Exemplo 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();
  }
 /**
  * Returns a new {@link VkImageSubresourceRange.Buffer} instance allocated with {@link
  * BufferUtils}.
  *
  * @param capacity the buffer capacity
  */
 public static Buffer create(int capacity) {
   return new Buffer(BufferUtils.createByteBuffer(capacity * SIZEOF));
 }
 /**
  * Returns a new {@link java.nio.ByteBuffer} instance with a capacity equal to {@link #SIZEOF}.
  */
 public static ByteBuffer malloc() {
   return BufferUtils.createByteBuffer(SIZEOF);
 }
 /** Returns a new {@link VkImageSubresourceRange} instance allocated with {@link BufferUtils}. */
 public static VkImageSubresourceRange create() {
   return new VkImageSubresourceRange(BufferUtils.createByteBuffer(SIZEOF));
 }