Package icyllis.arc3d.opengl
Class GLUtil
java.lang.Object
icyllis.arc3d.opengl.GLUtil
Provides OpenGL utilities.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumKnown drivers.static enumKnown vendors. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GLUtil.GLDriverfindDriver(GLUtil.GLVendor vendor, String vendorString, String versionString) static GLUtil.GLVendorfindVendor(String vendorString) static @NonNull StringgetCategoryAMD(int category) static @NonNull StringgetDebugSeverity(int severity) static @NonNull StringgetDebugSource(int source) static @NonNull StringgetDebugType(int type) static @NonNull StringgetSeverityAMD(int severity) static @NonNull StringgetSeverityARB(int severity) static @NonNull StringgetSourceARB(int source) static @NonNull StringgetTypeARB(int type) static intglCompileShader(GLDevice device, int shaderType, ByteBuffer glsl, GlobalResourceCache.Stats stats) static intglFormatBytesPerBlock(int format) static intglFormatChannels(int format) static intglFormatCompressionType(int format) static intglFormatDepthBits(int format) static booleanglFormatIsCompressed(int format) static booleanglFormatIsPackedDepthStencil(int format) static booleanglFormatIsSRGB(int format) static booleanglFormatIsSupported(int format) Consistent withglFormatToIndex(int)static StringglFormatName(int format) static intglFormatStencilBits(int format) static intglFormatToIndex(int format) Lists all supported OpenGL texture formats and converts to table index.static intglIndexToFormat(int index) Reverse ofglFormatToIndex(int).static intglSpecializeShader(GLDevice device, int shaderType, ByteBuffer spirv, String entryPoint, GlobalResourceCache.Stats stats) static voidhandleCompileError(org.slf4j.Logger logger, String source, String errors) static voidhandleLinkError(org.slf4j.Logger logger, String[] headers, String[] sources, String errors) static @Nullable ImmediateContextCreates a DirectContext for a backend context, using default context options.static @Nullable ImmediateContextmakeOpenGL(@NonNull ContextOptions options) static @Nullable ImmediateContextmakeOpenGL(@NonNull Object capabilities, @NonNull ContextOptions options) Creates a DirectContext for a backend context, using specified context options.static inttoGLBlendEquation(byte equation) static inttoGLBlendFactor(byte factor) static inttoGLCompareFunc(byte compareOp) static inttoGLMagFilter(int filter) static inttoGLMinFilter(int filter, int mipmapMode) static inttoGLPrimitiveType(byte primitiveType) static inttoGLStencilOp(byte stencilOp) static inttoGLWrapMode(int addressMode)
-
Field Details
-
LAST_COLOR_FORMAT_INDEX
public static final int LAST_COLOR_FORMAT_INDEX- See Also:
-
LAST_FORMAT_INDEX
public static final int LAST_FORMAT_INDEX- See Also:
-
-
Constructor Details
-
GLUtil
public GLUtil()
-
-
Method Details
-
makeOpenGL
Creates a DirectContext for a backend context, using default context options.- Returns:
- context or null if failed to create
- See Also:
-
makeOpenGL
-
makeOpenGL
public static @Nullable ImmediateContext makeOpenGL(@NonNull Object capabilities, @NonNull ContextOptions options) Creates a DirectContext for a backend context, using specified context options.Example with GLFW:
public static void main(String[] args) { System.setProperty("java.awt.headless", Boolean.TRUE.toString()); if (!glfwInit()) { throw new IllegalStateException(); } // default hints use highest OpenGL version and native API glfwDefaultWindowHints(); long window = glfwCreateWindow(1280, 720, "Example Window", NULL, NULL); if (window == NULL) { throw new IllegalStateException(); } // you can make a thread a render thread glfwMakeContextCurrent(window); DirectContext direct = DirectContext.makeOpenGL( GL.createCapabilities() ); if (direct == null) { throw new IllegalStateException(); } ... // destroy and close direct.discard(); direct.unref(); GL.setCapabilities(null); glfwDestroyWindow(window); glfwTerminate(); }- Returns:
- context or null if failed to create
-
findVendor
-
findDriver
public static GLUtil.GLDriver findDriver(GLUtil.GLVendor vendor, String vendorString, String versionString) -
glFormatToIndex
public static int glFormatToIndex(int format) Lists all supported OpenGL texture formats and converts to table index. 0 is reserved for unsupported formats.- See Also:
-
glIndexToFormat
public static int glIndexToFormat(int index) Reverse ofglFormatToIndex(int). -
glFormatChannels
public static int glFormatChannels(int format) - See Also:
-
glFormatIsSupported
public static boolean glFormatIsSupported(int format) Consistent withglFormatToIndex(int) -
glFormatCompressionType
public static int glFormatCompressionType(int format) - See Also:
-
glFormatBytesPerBlock
public static int glFormatBytesPerBlock(int format) -
glFormatDepthBits
public static int glFormatDepthBits(int format) -
glFormatStencilBits
public static int glFormatStencilBits(int format) -
glFormatIsPackedDepthStencil
public static boolean glFormatIsPackedDepthStencil(int format) -
glFormatIsSRGB
public static boolean glFormatIsSRGB(int format) -
glFormatIsCompressed
public static boolean glFormatIsCompressed(int format) -
glFormatName
-
getDebugSource
-
getDebugType
-
getDebugSeverity
-
getSourceARB
-
getTypeARB
-
getSeverityARB
-
getCategoryAMD
-
getSeverityAMD
-
glCompileShader
public static int glCompileShader(GLDevice device, int shaderType, ByteBuffer glsl, GlobalResourceCache.Stats stats) -
glSpecializeShader
public static int glSpecializeShader(GLDevice device, int shaderType, ByteBuffer spirv, String entryPoint, GlobalResourceCache.Stats stats) -
handleCompileError
-
handleLinkError
-
toGLMagFilter
public static int toGLMagFilter(int filter) -
toGLMinFilter
public static int toGLMinFilter(int filter, int mipmapMode) -
toGLWrapMode
public static int toGLWrapMode(int addressMode) -
toGLBlendEquation
public static int toGLBlendEquation(byte equation) -
toGLBlendFactor
public static int toGLBlendFactor(byte factor) -
toGLCompareFunc
public static int toGLCompareFunc(byte compareOp) -
toGLStencilOp
public static int toGLStencilOp(byte stencilOp) -
toGLPrimitiveType
public static int toGLPrimitiveType(byte primitiveType)
-