コード例 #1
0
 public static void glBindFragDataLocationEXT(int program, int color, CharSequence name) {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     ByteBuffer nameEncoded = stack.ASCII(name);
     nglBindFragDataLocationEXT(program, color, memAddress(nameEncoded));
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #2
0
 public static int glGetFragDataLocationEXT(int program, CharSequence name) {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     ByteBuffer nameEncoded = stack.ASCII(name);
     return nglGetFragDataLocationEXT(program, memAddress(nameEncoded));
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #3
0
ファイル: STBImage.java プロジェクト: stkromm/vine-engine
 /**
  * Checks if the specified file contains an HDR image.
  *
  * @param filename the file name
  * @return 1 if the image is HDR, 0 otherwise
  */
 public static int stbi_is_hdr(CharSequence filename) {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     ByteBuffer filenameEncoded = stack.ASCII(filename);
     return nstbi_is_hdr(memAddress(filenameEncoded));
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #4
0
 /**
  * Unsigned version of {@link #glGetVertexAttribIivEXT GetVertexAttribIivEXT}.
  *
  * @param index the index of the pure integer generic vertex attribute to be modified
  * @param pname the symbolic name of the vertex attribute parameter to be queried
  */
 public static int glGetVertexAttribIuiEXT(int index, int pname) {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     IntBuffer params = stack.callocInt(1);
     nglGetVertexAttribIuivEXT(index, pname, memAddress(params));
     return params.get(0);
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #5
0
 /**
  * Retrieves information about implementation-dependent support for internal formats.
  *
  * @param target the usage of the internal format. One of:<br>
  *     <table>
  *     <tr><td>{@link GL11#GL_TEXTURE_1D TEXTURE_1D}</td><td>{@link GL11#GL_TEXTURE_2D TEXTURE_2D}</td><td>{@link GL30#GL_TEXTURE_1D_ARRAY TEXTURE_1D_ARRAY}</td><td>{@link GL31#GL_TEXTURE_RECTANGLE TEXTURE_RECTANGLE}</td><td>{@link GL13#GL_TEXTURE_CUBE_MAP TEXTURE_CUBE_MAP}</td></tr><tr><td>{@link GL12#GL_TEXTURE_3D TEXTURE_3D}</td><td>{@link GL30#GL_TEXTURE_2D_ARRAY TEXTURE_2D_ARRAY}</td><td>{@link GL40#GL_TEXTURE_CUBE_MAP_ARRAY TEXTURE_CUBE_MAP_ARRAY}</td><td>{@link GL30#GL_RENDERBUFFER RENDERBUFFER}</td><td>{@link GL31#GL_TEXTURE_BUFFER TEXTURE_BUFFER}</td></tr><tr><td>{@link GL32#GL_TEXTURE_2D_MULTISAMPLE TEXTURE_2D_MULTISAMPLE}</td><td>{@link GL32#GL_TEXTURE_2D_MULTISAMPLE_ARRAY TEXTURE_2D_MULTISAMPLE_ARRAY}</td></tr>
  *     </table>
  *
  * @param internalformat the internal format about which to retrieve information
  * @param pname the type of information to query
  */
 public static long glGetInternalformati64(int target, int internalformat, int pname) {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     LongBuffer params = stack.callocLong(1);
     nglGetInternalformati64v(target, internalformat, pname, 1, memAddress(params));
     return params.get(0);
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #6
0
 public static void glGetPerfQueryIdByNameINTEL(CharSequence queryName, IntBuffer queryId) {
   if (CHECKS) checkBuffer(queryId, 1);
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     ByteBuffer queryNameEncoded = stack.ASCII(queryName);
     nglGetPerfQueryIdByNameINTEL(memAddress(queryNameEncoded), memAddress(queryId));
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #7
0
 public static int glGetNextPerfQueryIdINTEL(int queryId) {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     IntBuffer nextQueryId = stack.callocInt(1);
     nglGetNextPerfQueryIdINTEL(queryId, memAddress(nextQueryId));
     return nextQueryId.get(0);
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #8
0
 public static int glGetFirstPerfQueryIdINTEL() {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     IntBuffer queryId = stack.callocInt(1);
     nglGetFirstPerfQueryIdINTEL(memAddress(queryId));
     return queryId.get(0);
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #9
0
 public static int glCreatePerfQueryINTEL(int queryId) {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     IntBuffer queryHandle = stack.callocInt(1);
     nglCreatePerfQueryINTEL(queryId, memAddress(queryHandle));
     return queryHandle.get(0);
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #10
0
 public static int glGetUniformuiEXT(int program, int location) {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     IntBuffer params = stack.callocInt(1);
     nglGetUniformuivEXT(program, location, memAddress(params));
     return params.get(0);
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #11
0
ファイル: STBImage.java プロジェクト: stkromm/vine-engine
 /**
  * ZLIB client - used by PNG, available for other purposes
  *
  * @param buffer
  */
 public static ByteBuffer stbi_zlib_decode_malloc(ByteBuffer buffer) {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     IntBuffer outlen = stack.callocInt(1);
     long __result =
         nstbi_zlib_decode_malloc(memAddress(buffer), buffer.remaining(), memAddress(outlen));
     return memByteBuffer(__result, outlen.get(0));
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #12
0
 public static int glGetPerfQueryIdByNameINTEL(CharSequence queryName) {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     ByteBuffer queryNameEncoded = stack.ASCII(queryName);
     IntBuffer queryId = stack.callocInt(1);
     nglGetPerfQueryIdByNameINTEL(memAddress(queryNameEncoded), memAddress(queryId));
     return queryId.get(0);
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #13
0
ファイル: STBImage.java プロジェクト: stkromm/vine-engine
 /** Array version of: {@link #stbi_info info} */
 public static int stbi_info(CharSequence filename, int[] x, int[] y, int[] comp) {
   if (CHECKS) {
     checkBuffer(x, 1);
     checkBuffer(y, 1);
     checkBuffer(comp, 1);
   }
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     ByteBuffer filenameEncoded = stack.ASCII(filename);
     return nstbi_info(memAddress(filenameEncoded), x, y, comp);
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #14
0
 /** Array version of: {@link #glGetPerfQueryIdByNameINTEL GetPerfQueryIdByNameINTEL} */
 public static void glGetPerfQueryIdByNameINTEL(CharSequence queryName, int[] queryId) {
   long __functionAddress = GLES.getCapabilities().glGetPerfQueryIdByNameINTEL;
   if (CHECKS) {
     checkFunctionAddress(__functionAddress);
     checkBuffer(queryId, 1);
   }
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     ByteBuffer queryNameEncoded = stack.ASCII(queryName);
     callPPV(__functionAddress, memAddress(queryNameEncoded), queryId);
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #15
0
ファイル: STBImage.java プロジェクト: stkromm/vine-engine
 /**
  * ZLIB client - used by PNG, available for other purposes
  *
  * @param buffer
  * @param initial_size
  * @param parse_header
  */
 public static ByteBuffer stbi_zlib_decode_malloc_guesssize_headerflag(
     ByteBuffer buffer, int initial_size, int parse_header) {
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     IntBuffer outlen = stack.callocInt(1);
     long __result =
         nstbi_zlib_decode_malloc_guesssize_headerflag(
             memAddress(buffer),
             buffer.remaining(),
             initial_size,
             memAddress(outlen),
             parse_header);
     return memByteBuffer(__result, outlen.get(0));
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #16
0
ファイル: GLFWUtil.java プロジェクト: Noviv/lwjgl3
  /**
   * Invokes the specified callbacks using the current window and framebuffer sizes of the specified
   * GLFW window.
   *
   * @param window the GLFW window
   * @param windowSizeCB the window size callback, may be null
   * @param framebufferSizeCB the framebuffer size callback, may be null
   */
  public static void glfwInvoke(
      long window,
      GLFWWindowSizeCallbackI windowSizeCB,
      GLFWFramebufferSizeCallbackI framebufferSizeCB) {
    try (MemoryStack stack = stackPush()) {
      IntBuffer w = stack.mallocInt(1);
      IntBuffer h = stack.mallocInt(1);

      if (windowSizeCB != null) {
        glfwGetWindowSize(window, w, h);
        windowSizeCB.invoke(window, w.get(0), h.get(0));
      }

      if (framebufferSizeCB != null) {
        glfwGetFramebufferSize(window, w, h);
        framebufferSizeCB.invoke(window, w.get(0), h.get(0));
      }
    }
  }
コード例 #17
0
ファイル: Mandelbrot.java プロジェクト: SilverTiger/lwjgl3
  private static long getDevice(long platform, CLCapabilities platformCaps, int deviceType) {
    MemoryStack stack = stackPush();

    try {
      IntBuffer pi = stack.mallocInt(1);
      checkCLError(clGetDeviceIDs(platform, deviceType, null, pi));

      PointerBuffer devices = stack.mallocPointer(pi.get(0));
      checkCLError(clGetDeviceIDs(platform, deviceType, devices, null));

      for (int i = 0; i < devices.capacity(); i++) {
        long device = devices.get(i);

        CLCapabilities caps = CL.createDeviceCapabilities(device, platformCaps);
        if (!(caps.cl_khr_gl_sharing || caps.cl_APPLE_gl_sharing)) continue;

        return device;
      }
    } finally {
      stack.pop();
    }

    return NULL;
  }
コード例 #18
0
ファイル: STBImage.java プロジェクト: stkromm/vine-engine
 /**
  * Floating-point version of {@link #stbi_load load}.
  *
  * @param filename the file name
  * @param x outputs the image width in pixels
  * @param y outputs the image height in pixels
  * @param comp outputs number of components in image
  * @param req_comp 0 or 1..4 to force that many components per pixel. One of:<br>
  *     <table><tr><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td></tr></table>
  */
 public static FloatBuffer stbi_loadf(
     CharSequence filename, IntBuffer x, IntBuffer y, IntBuffer comp, int req_comp) {
   if (CHECKS) {
     checkBuffer(x, 1);
     checkBuffer(y, 1);
     checkBuffer(comp, 1);
   }
   MemoryStack stack = stackGet();
   int stackPointer = stack.getPointer();
   try {
     ByteBuffer filenameEncoded = stack.ASCII(filename);
     long __result =
         nstbi_loadf(
             memAddress(filenameEncoded),
             memAddress(x),
             memAddress(y),
             memAddress(comp),
             req_comp);
     return memFloatBuffer(
         __result, x.get(x.position()) * y.get(y.position()) * comp.get(comp.position()));
   } finally {
     stack.setPointer(stackPointer);
   }
 }
コード例 #19
0
ファイル: AbstractGears.java プロジェクト: SilverTiger/lwjgl3
  public void initGLState() {
    System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR));
    System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER));
    System.err.println("GL_VERSION: " + glGetString(GL_VERSION));

    MemoryStack s = stackPush();

    // setup ogl
    glLightfv(GL_LIGHT0, GL_POSITION, s.floats(5.0f, 5.0f, 10.0f, 0.0f));
    glEnable(GL_CULL_FACE);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_DEPTH_TEST);

    /* make the gears */
    gear1 = glGenLists(1);
    glNewList(gear1, GL_COMPILE);
    glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, s.floats(0.8f, 0.1f, 0.0f, 1.0f));
    gear(1.0f, 4.0f, 1.0f, 20, 0.7f);
    glEndList();

    gear2 = glGenLists(1);
    glNewList(gear2, GL_COMPILE);
    glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, s.floats(0.0f, 0.8f, 0.2f, 1.0f));
    gear(0.5f, 2.0f, 2.0f, 10, 0.7f);
    glEndList();

    gear3 = glGenLists(1);
    glNewList(gear3, GL_COMPILE);
    glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, s.floats(0.2f, 0.2f, 1.0f, 1.0f));
    gear(1.3f, 2.0f, 0.5f, 10, 0.7f);
    glEndList();

    s.pop();

    glEnable(GL_NORMALIZE);

    glMatrixMode(GL_PROJECTION);

    float h = (float) 300 / (float) 300;
    glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glTranslatef(0.0f, 0.0f, -40.0f);
  }
コード例 #20
0
 /**
  * Returns a new {@link VkImageSubresourceRange} instance allocated on the specified {@link
  * MemoryStack} and initializes all its bits to zero.
  *
  * @param stack the stack from which to allocate
  */
 public static VkImageSubresourceRange callocStack(MemoryStack stack) {
   return create(stack.ncalloc(ALIGNOF, 1, SIZEOF));
 }
コード例 #21
0
 /**
  * Returns a new {@link VkImageSubresourceRange.Buffer} instance allocated on the specified {@link
  * MemoryStack} and initializes all its bits to zero.
  *
  * @param stack the stack from which to allocate
  * @param capacity the buffer capacity
  */
 public static Buffer callocStack(int capacity, MemoryStack stack) {
   return create(stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
 }