Esempio n. 1
0
 private void InitGL() {
   GL.createCapabilities();
   System.out.println("OpenGL: " + glGetString(GL_VERSION));
   glEnable(GL13.GL_MULTISAMPLE);
   glEnable(GL_DEPTH_TEST);
   glViewport(0, 0, pix_width, pix_height);
 }
Esempio n. 2
0
  static GL15 create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("OpenGL15")) return null;

    GL15 funcs = new GL15(provider);

    boolean supported =
        checkFunctions(
            funcs.BindBuffer,
            funcs.DeleteBuffers,
            funcs.GenBuffers,
            funcs.IsBuffer,
            funcs.BufferData,
            funcs.BufferSubData,
            funcs.GetBufferSubData,
            funcs.MapBuffer,
            funcs.UnmapBuffer,
            funcs.GetBufferParameteriv,
            funcs.GetBufferPointerv,
            funcs.GenQueries,
            funcs.DeleteQueries,
            funcs.IsQuery,
            funcs.BeginQuery,
            funcs.EndQuery,
            funcs.GetQueryiv,
            funcs.GetQueryObjectiv,
            funcs.GetQueryObjectuiv);

    return GL.checkExtension("OpenGL15", funcs, supported);
  }
Esempio n. 3
0
  static WGLARBMakeCurrentRead create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("WGL_ARB_make_current_read")) return null;

    WGLARBMakeCurrentRead funcs = new WGLARBMakeCurrentRead(provider);

    boolean supported = checkFunctions(funcs.MakeContextCurrentARB, funcs.GetCurrentReadDCARB);

    return GL.checkExtension("WGL_ARB_make_current_read", funcs, supported);
  }
  static ARBCopyImage create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("GL_ARB_copy_image")) return null;

    ARBCopyImage funcs = new ARBCopyImage(provider);

    boolean supported = checkFunctions(funcs.CopyImageSubData);

    return GL.checkExtension("GL_ARB_copy_image", funcs, supported);
  }
Esempio n. 5
0
  static ARBTextureBarrier create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("GL_ARB_texture_barrier")) return null;

    ARBTextureBarrier funcs = new ARBTextureBarrier(provider);

    boolean supported = checkFunctions(funcs.TextureBarrier);

    return GL.checkExtension("GL_ARB_texture_barrier", funcs, supported);
  }
Esempio n. 6
0
  static GLX11 create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("GLX_11")) return null;

    GLX11 funcs = new GLX11(provider);

    boolean supported =
        checkFunctions(funcs.QueryExtensionsString, funcs.GetClientString, funcs.QueryServerString);

    return GL.checkExtension("GLX_11", funcs, supported);
  }
  static NVBindlessMultiDrawIndirectCount create(
      java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("GL_NV_bindless_multi_draw_indirect_count")) return null;

    NVBindlessMultiDrawIndirectCount funcs = new NVBindlessMultiDrawIndirectCount(provider);

    boolean supported =
        checkFunctions(
            funcs.MultiDrawArraysIndirectBindlessCountNV,
            funcs.MultiDrawElementsIndirectBindlessCountNV);

    return GL.checkExtension("GL_NV_bindless_multi_draw_indirect_count", funcs, supported);
  }
Esempio n. 8
0
  static GL12 create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("OpenGL12")) return null;

    GL12 funcs = new GL12(provider);

    boolean supported =
        checkFunctions(
            funcs.TexImage3D,
            funcs.TexSubImage3D,
            funcs.CopyTexSubImage3D,
            funcs.DrawRangeElements);

    return GL.checkExtension("OpenGL12", funcs, supported);
  }
Esempio n. 9
0
  static WGLNVGPUAffinity create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("WGL_NV_gpu_affinity")) return null;

    WGLNVGPUAffinity funcs = new WGLNVGPUAffinity(provider);

    boolean supported =
        checkFunctions(
            funcs.EnumGpusNV,
            funcs.EnumGpuDevicesNV,
            funcs.CreateAffinityDCNV,
            funcs.EnumGpusFromAffinityDCNV,
            funcs.DeleteDCNV);

    return GL.checkExtension("WGL_NV_gpu_affinity", funcs, supported);
  }
  static GLXEXTImportContext create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("GLX_EXT_import_context")) return null;

    GLXEXTImportContext funcs = new GLXEXTImportContext(provider);

    boolean supported =
        checkFunctions(
            funcs.GetCurrentDisplayEXT,
            funcs.QueryContextInfoEXT,
            funcs.GetContextIDEXT,
            funcs.ImportContextEXT,
            funcs.FreeContextEXT);

    return GL.checkExtension("GLX_EXT_import_context", funcs, supported);
  }
  static EXTTextureInteger create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("GL_EXT_texture_integer")) return null;

    EXTTextureInteger funcs = new EXTTextureInteger(provider);

    boolean supported =
        checkFunctions(
            funcs.ClearColorIiEXT,
            funcs.ClearColorIuiEXT,
            funcs.TexParameterIivEXT,
            funcs.TexParameterIuivEXT,
            funcs.GetTexParameterIivEXT,
            funcs.GetTexParameterIuivEXT);

    return GL.checkExtension("GL_EXT_texture_integer", funcs, supported);
  }
Esempio n. 12
0
  static WGLNVDXInterop create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("WGL_NV_DX_interop")) return null;

    WGLNVDXInterop funcs = new WGLNVDXInterop(provider);

    boolean supported =
        checkFunctions(
            funcs.DXSetResourceShareHandleNV,
            funcs.DXOpenDeviceNV,
            funcs.DXCloseDeviceNV,
            funcs.DXRegisterObjectNV,
            funcs.DXUnregisterObjectNV,
            funcs.DXObjectAccessNV,
            funcs.DXLockObjectsNV,
            funcs.DXUnlockObjectsNV);

    return GL.checkExtension("WGL_NV_DX_interop", funcs, supported);
  }
  static ARBShaderSubroutine create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("GL_ARB_shader_subroutine")) return null;

    ARBShaderSubroutine funcs = new ARBShaderSubroutine(provider);

    boolean supported =
        checkFunctions(
            funcs.GetSubroutineUniformLocation,
            funcs.GetSubroutineIndex,
            funcs.GetActiveSubroutineUniformiv,
            funcs.GetActiveSubroutineUniformName,
            funcs.GetActiveSubroutineName,
            funcs.UniformSubroutinesuiv,
            funcs.GetUniformSubroutineuiv,
            funcs.GetProgramStageiv);

    return GL.checkExtension("GL_ARB_shader_subroutine", funcs, supported);
  }
  static GLXAMDGPUAssociation create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("GLX_AMD_gpu_association")) return null;

    GLXAMDGPUAssociation funcs = new GLXAMDGPUAssociation(provider);

    boolean supported =
        checkFunctions(
            funcs.BlitContextFramebufferAMD,
            funcs.CreateAssociatedContextAMD,
            funcs.CreateAssociatedContextAttribsAMD,
            funcs.DeleteAssociatedContextAMD,
            funcs.GetContextGPUIDAMD,
            funcs.GetCurrentAssociatedContextAMD,
            funcs.GetGPUIDsAMD,
            funcs.GetGPUInfoAMD,
            funcs.MakeAssociatedContextCurrentAMD);

    return GL.checkExtension("GLX_AMD_gpu_association", funcs, supported);
  }
  static ARBViewportArray create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("GL_ARB_viewport_array")) return null;

    ARBViewportArray funcs = new ARBViewportArray(provider);

    boolean supported =
        checkFunctions(
            funcs.ViewportArrayv,
            funcs.ViewportIndexedf,
            funcs.ViewportIndexedfv,
            funcs.ScissorArrayv,
            funcs.ScissorIndexed,
            funcs.ScissorIndexedv,
            funcs.DepthRangeArrayv,
            funcs.DepthRangeIndexed,
            funcs.GetFloati_v,
            funcs.GetDoublei_v);

    return GL.checkExtension("GL_ARB_viewport_array", funcs, supported);
  }
  static ARBUniformBufferObject create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("GL_ARB_uniform_buffer_object")) return null;

    ARBUniformBufferObject funcs = new ARBUniformBufferObject(provider);

    boolean supported =
        checkFunctions(
            funcs.GetUniformIndices,
            funcs.GetActiveUniformsiv,
            funcs.GetActiveUniformName,
            funcs.GetUniformBlockIndex,
            funcs.GetActiveUniformBlockiv,
            funcs.GetActiveUniformBlockName,
            funcs.BindBufferRange,
            funcs.BindBufferBase,
            funcs.GetIntegeri_v,
            funcs.UniformBlockBinding);

    return GL.checkExtension("GL_ARB_uniform_buffer_object", funcs, supported);
  }
  static AMDPerformanceMonitor create(java.util.Set<String> ext, FunctionProvider provider) {
    if (!ext.contains("GL_AMD_performance_monitor")) return null;

    AMDPerformanceMonitor funcs = new AMDPerformanceMonitor(provider);

    boolean supported =
        checkFunctions(
            funcs.GetPerfMonitorGroupsAMD,
            funcs.GetPerfMonitorCountersAMD,
            funcs.GetPerfMonitorGroupStringAMD,
            funcs.GetPerfMonitorCounterStringAMD,
            funcs.GetPerfMonitorCounterInfoAMD,
            funcs.GenPerfMonitorsAMD,
            funcs.DeletePerfMonitorsAMD,
            funcs.SelectPerfMonitorCountersAMD,
            funcs.BeginPerfMonitorAMD,
            funcs.EndPerfMonitorAMD,
            funcs.GetPerfMonitorCounterDataAMD);

    return GL.checkExtension("GL_AMD_performance_monitor", funcs, supported);
  }
Esempio n. 18
0
  private void loop() {
    // This line is critical for LWJGL's interoperation with GLFW's
    // OpenGL context, or any context that is managed externally.
    // LWJGL detects the context that is current in the current thread,
    // creates the GLCapabilities instance and makes the OpenGL
    // bindings available for use.
    GL.createCapabilities();

    // Set the clear color
    glClearColor(0.1f, 0.7f, 1.0f, 0.0f);

    // Run the rendering loop until the user has attempted to close
    // the window or has pressed the ESCAPE key.
    while (glfwWindowShouldClose(window) == GLFW_FALSE) {
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the framebuffer

      glfwSwapBuffers(window); // swap the color buffers

      // Poll for window events. The key callback above will only be
      // invoked during this call.
      glfwPollEvents();
    }
  }
 /** Returns the {@link ARBViewportArray} instance for the current context. */
 public static ARBViewportArray getInstance() {
   return checkFunctionality(GL.getCapabilities().__ARBViewportArray);
 }
 /** Returns the {@link org.lwjgl.opengl.WGLAMDGPUAssociation} instance for the current context. */
 public static WGLAMDGPUAssociation getInstance() {
   return GL.getCapabilities().__WGLAMDGPUAssociation;
 }
Esempio n. 21
0
 /** Returns the {@link GL15} instance for the current context. */
 public static GL15 getInstance() {
   return checkFunctionality(GL.getCapabilities().__GL15);
 }
Esempio n. 22
0
 /** Returns the {@link WGLARBMakeCurrentRead} instance for the current context. */
 public static WGLARBMakeCurrentRead getInstance() {
   return GL.getCapabilities().__WGLARBMakeCurrentRead;
 }
Esempio n. 23
0
 /** Returns the {@link GL12} instance for the current context. */
 public static GL12 getInstance() {
   return GL.getCapabilities().__GL12;
 }
Esempio n. 24
0
 /** Returns the {@link ARBTextureBarrier} instance for the current context. */
 public static ARBTextureBarrier getInstance() {
   return checkFunctionality(GL.getCapabilities().__ARBTextureBarrier);
 }
Esempio n. 25
0
 /** Returns the {@link WGLNVDXInterop} instance for the current context. */
 public static WGLNVDXInterop getInstance() {
   return GL.getCapabilities().__WGLNVDXInterop;
 }
 /** Returns the {@link ARBCopyImage} instance for the current context. */
 public static ARBCopyImage getInstance() {
   return checkFunctionality(GL.getCapabilities().__ARBCopyImage);
 }
 /** Returns the {@link NVBindlessMultiDrawIndirectCount} instance for the current context. */
 public static NVBindlessMultiDrawIndirectCount getInstance() {
   return checkFunctionality(GL.getCapabilities().__NVBindlessMultiDrawIndirectCount);
 }
 /** Returns the {@link GLXAMDGPUAssociation} instance for the current context. */
 public static GLXAMDGPUAssociation getInstance() {
   return checkFunctionality(GL.getCapabilities().__GLXAMDGPUAssociation);
 }
Esempio n. 29
0
 /** Returns the {@link WGLNVGPUAffinity} instance of the current context. */
 public static WGLNVGPUAffinity getInstance() {
   return getInstance(GL.getCapabilities());
 }
 /** Returns the {@link EXTTextureInteger} instance for the current context. */
 public static EXTTextureInteger getInstance() {
   return checkFunctionality(GL.getCapabilities().__EXTTextureInteger);
 }