/** * Returns the token name of the specified {@code errcode}. * * @param errcode the {@code errcode} * * @return the {@code errcode} token name */ public static String getErrcodeName(int errcode) { String errname = CL_ERROR_TOKENS.get(errcode); if (errname == null) { errname = apiUnknownToken(errcode); } return errname; }
private static boolean checkExtension(String extension, boolean supported) { if (supported) { return true; } apiLog("[WGL] " + extension + " was reported as available but an entry point is missing."); return false; }
public static void glTransformFeedbackVaryingsEXT(@NativeType("GLuint") int program, @NativeType("GLchar const * const *") CharSequence[] varyings, @NativeType("GLenum") int bufferMode) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { long varyingsAddress = org.lwjgl.system.APIUtil.apiArray(stack, MemoryUtil::memASCII, varyings); nglTransformFeedbackVaryingsEXT(program, varyings.length, varyingsAddress, bufferMode); org.lwjgl.system.APIUtil.apiArrayFree(varyingsAddress, varyings.length); } finally { stack.setPointer(stackPointer); } }
apiLog(String.format("An OpenGL ES context was in an error state before the creation of its capabilities instance. Error: [0x%X]", errorCode)); APIVersion version = apiParseVersion(versionString, "OpenGL ES"); long GetStringi = apiGetFunctionAddress(functionProvider, "glGetStringi"); for (int i = 0; i < extensionCount; i++) { supportedExtensions.add(memASCII(callP(GetStringi, GL_EXTENSIONS, i)));
@Nullable private static SharedLibrary loadNativeFromSystem(String libName) { SharedLibrary lib; try { lib = apiCreateLibrary(libName); String path = lib.getPath(); apiLog(path == null ? "\tLoaded from system paths" : "\tLoaded from system paths: " + path); } catch (UnsatisfiedLinkError e) { lib = null; apiLog(String.format("\t%s not found in system paths", libName)); } return lib; }
/** <a target="_blank" href="http://docs.gl/es3/glShaderSource">Reference Page</a> */ public static void glShaderSource(@NativeType("GLuint") int shader, @NativeType("GLchar const * const *") CharSequence... string) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { long stringAddress = org.lwjgl.system.APIUtil.apiArrayi(stack, MemoryUtil::memUTF8, string); nglShaderSource(shader, string.length, stringAddress, stringAddress - (string.length << 2)); org.lwjgl.system.APIUtil.apiArrayFree(stringAddress, string.length); } finally { stack.setPointer(stackPointer); } }
@Nullable @NativeType("void *") public static ByteBuffer glMapNamedBufferEXT(@NativeType("GLuint") int buffer, @NativeType("GLenum") int access, long length, @Nullable ByteBuffer old_buffer) { long __result = nglMapNamedBufferEXT(buffer, access); return apiGetMappedBuffer(old_buffer, __result, (int)length); }
/** * Parses a version string. The version string must have the format {@code MAJOR.MINOR.REVISION IMPL}, where {@code MAJOR} is the major version (integer), * {@code MINOR} is the minor version (integer), {@code REVISION} is the revision version (string, optional) and {@code IMPL} is implementation-specific * information (string, optional). * * @param version the API version string * * @return the parsed {@link APIVersion} */ public static APIVersion apiParseVersion(String version) { return apiParseVersion(version, null); }
RegisterClassEx = apiGetFunctionAddress(USER32, "RegisterClassExW"), UnregisterClass = apiGetFunctionAddress(USER32, "UnregisterClassW"), CreateWindowEx = apiGetFunctionAddress(USER32, "CreateWindowExW"), DestroyWindow = apiGetFunctionAddress(USER32, "DestroyWindow"), DefWindowProc = apiGetFunctionAddress(USER32, "DefWindowProcW"), CallWindowProc = apiGetFunctionAddress(USER32, "CallWindowProcW"), ShowWindow = apiGetFunctionAddress(USER32, "ShowWindow"), UpdateWindow = apiGetFunctionAddress(USER32, "UpdateWindow"), SetWindowPos = apiGetFunctionAddress(USER32, "SetWindowPos"), SetWindowText = apiGetFunctionAddress(USER32, "SetWindowTextW"), GetMessage = apiGetFunctionAddress(USER32, "GetMessageW"), PeekMessage = apiGetFunctionAddress(USER32, "PeekMessageW"), TranslateMessage = apiGetFunctionAddress(USER32, "TranslateMessage"), WaitMessage = apiGetFunctionAddress(USER32, "WaitMessage"), DispatchMessage = apiGetFunctionAddress(USER32, "DispatchMessageW"), PostMessage = apiGetFunctionAddress(USER32, "PostMessageW"), SendMessage = apiGetFunctionAddress(USER32, "SendMessageW"), AdjustWindowRectEx = apiGetFunctionAddress(USER32, "AdjustWindowRectEx"), GetWindowRect = apiGetFunctionAddress(USER32, "GetWindowRect"), MoveWindow = apiGetFunctionAddress(USER32, "MoveWindow"), GetWindowPlacement = apiGetFunctionAddress(USER32, "GetWindowPlacement"), SetWindowPlacement = apiGetFunctionAddress(USER32, "SetWindowPlacement"), IsWindowVisible = apiGetFunctionAddress(USER32, "IsWindowVisible"), IsIconic = apiGetFunctionAddress(USER32, "IsIconic"), IsZoomed = apiGetFunctionAddress(USER32, "IsZoomed"), BringWindowToTop = apiGetFunctionAddress(USER32, "BringWindowToTop"), SetWindowLongPtr = apiGetFunctionAddress(USER32, Pointer.BITS64 ? "SetWindowLongPtrW" : "SetWindowLongW"), GetWindowLongPtr = apiGetFunctionAddress(USER32, Pointer.BITS64 ? "GetWindowLongPtrW" : "GetWindowLongW"), SetClassLongPtr = apiGetFunctionAddress(USER32, Pointer.BITS64 ? "SetClassLongPtrW" : "SetClassLongW"),
/** * Stores the addresses of the specified array of buffers on the specified {@link MemoryStack}. A second array that contains the buffer remaining bytes is * stored immediately after the pointer array. Length values are pointer-sized integers. * * @param stack the stack to use * @param buffers the buffers to store * * @return the pointer array address on the stack */ public static long apiArrayp(MemoryStack stack, ByteBuffer... buffers) { long pointers = apiArray(stack, buffers); PointerBuffer lengths = stack.mallocPointer(buffers.length); for (ByteBuffer buffer : buffers) { lengths.put(buffer.remaining()); } return pointers; }
private static boolean checkExtension(String extension, boolean supported) { if (supported) { return true; } apiLog("[GLX] " + extension + " was reported as available but an entry point is missing."); return false; }
public static void glTransformFeedbackVaryingsEXT(@NativeType("GLuint") int program, @NativeType("GLchar const * const *") CharSequence varying, @NativeType("GLenum") int bufferMode) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { long varyingsAddress = org.lwjgl.system.APIUtil.apiArray(stack, MemoryUtil::memASCII, varying); nglTransformFeedbackVaryingsEXT(program, 1, varyingsAddress, bufferMode); org.lwjgl.system.APIUtil.apiArrayFree(varyingsAddress, 1); } finally { stack.setPointer(stackPointer); } }
apiLog(String.format("An OpenGL context was in an error state before the creation of its capabilities instance. Error: 0x%X", errorCode)); APIVersion apiVersion = apiParseVersion(versionString); int extensionCount = pi.get(0); long GetStringi = apiGetFunctionAddress(functionProvider, "glGetStringi"); for (int i = 0; i < extensionCount; i++) { supportedExtensions.add(memASCII(callP(GetStringi, GL_EXTENSIONS, i)));
@Nullable private static SharedLibrary loadNative(Class<?> context, String libName, String property, String paths) { Path libFile = findLibrary(paths, libName); if (libFile == null) { apiLog(String.format("\t%s not found in %s=%s", libName, property, paths)); return null; } SharedLibrary lib = apiCreateLibrary(libFile.toString()); apiLog(String.format("\tLoaded from %s: %s", property, libFile)); checkHash(context, libFile); return lib; }
/** <a target="_blank" href="http://docs.gl/es3/glShaderSource">Reference Page</a> */ public static void glShaderSource(@NativeType("GLuint") int shader, @NativeType("GLchar const * const *") CharSequence string) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { long stringAddress = org.lwjgl.system.APIUtil.apiArrayi(stack, MemoryUtil::memUTF8, string); nglShaderSource(shader, 1, stringAddress, stringAddress - 4); org.lwjgl.system.APIUtil.apiArrayFree(stringAddress, 1); } finally { stack.setPointer(stackPointer); } }
@Nullable @NativeType("void *") public static ByteBuffer glMapBufferOES(@NativeType("GLenum") int target, @NativeType("GLenum") int access, long length, @Nullable ByteBuffer old_buffer) { long __result = nglMapBufferOES(target, access); return apiGetMappedBuffer(old_buffer, __result, (int)length); }
/** * Returns the {@link APIVersion} value of the specified option. * * @param option the option to query */ @Nullable public static APIVersion apiParseVersion(Configuration<?> option) { APIVersion version; Object state = option.get(); if (state instanceof String) { version = apiParseVersion((String)state, null); } else if (state instanceof APIVersion) { version = (APIVersion)state; } else { version = null; } return version; }
private static boolean checkExtension(String extension, boolean supported) { if (supported) { return true; } apiLog("[AL] " + extension + " was reported as available but an entry point is missing."); return false; }
private static String getSeverityAMD(int severity) { switch (severity) { case GL_DEBUG_SEVERITY_HIGH_AMD: return "HIGH"; case GL_DEBUG_SEVERITY_MEDIUM_AMD: return "MEDIUM"; case GL_DEBUG_SEVERITY_LOW_AMD: return "LOW"; default: return apiUnknownToken(severity); } }
@NativeType("GLuint") public static int glCreateShaderProgramvEXT(@NativeType("GLenum") int type, @NativeType("GLchar const **") CharSequence... strings) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { long stringsAddress = org.lwjgl.system.APIUtil.apiArray(stack, MemoryUtil::memUTF8, strings); int __result = nglCreateShaderProgramvEXT(type, strings.length, stringsAddress); org.lwjgl.system.APIUtil.apiArrayFree(stringsAddress, strings.length); return __result; } finally { stack.setPointer(stackPointer); } }