org.lwjgl.nanovg.NanoVGGL3 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lwjgl-nanovg Show documentation
Show all versions of lwjgl-nanovg Show documentation
A small antialiased vector graphics rendering library for OpenGL. Also includes NanoSVG, a simple SVG parser.
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.nanovg;
import javax.annotation.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.MemoryUtil.*;
/** Implementation of the NanoVG API using OpenGL 3.0. */
public class NanoVGGL3 {
/**
* Create flags.
*
* Enum values:
*
*
* - {@link #NVG_ANTIALIAS ANTIALIAS} - Flag indicating if geometry based anti-aliasing is used (may not be needed when using MSAA).
* - {@link #NVG_STENCIL_STROKES STENCIL_STROKES} -
* Flag indicating if strokes should be drawn using stencil buffer. The rendering will be a little slower, but path overlaps (i.e. self-intersecting
* or sharp turns) will be drawn just once.
*
* - {@link #NVG_DEBUG DEBUG} - Flag indicating that additional debug checks are done.
*
*/
public static final int
NVG_ANTIALIAS = 1<<0,
NVG_STENCIL_STROKES = 1<<1,
NVG_DEBUG = 1<<2;
/**
* These are additional flags on top of NVGimageFlags.
*
* Enum values:
*
*
* - {@link #NVG_IMAGE_NODELETE IMAGE_NODELETE} - Do not delete GL texture handle.
*
*/
public static final int NVG_IMAGE_NODELETE = 1<<16;
static { LibNanoVG.initialize(); }
protected NanoVGGL3() {
throw new UnsupportedOperationException();
}
// --- [ nvglCreateImageFromHandle ] ---
/** Unsafe version of: {@link #nvglCreateImageFromHandle lCreateImageFromHandle} */
public static native int nnvglCreateImageFromHandleGL3(long ctx, int textureId, int w, int h, int flags);
/**
* Creates a NanoVG image from an OpenGL texture.
*
* @param ctx the NanoVG context
* @param textureId the OpenGL texture id
* @param w the image width
* @param h the image height
* @param flags the image flags
*
* @return a handle to the image
*/
public static int nvglCreateImageFromHandle(@NativeType("NVGcontext *") long ctx, @NativeType("GLuint") int textureId, int w, int h, int flags) {
if (CHECKS) {
check(ctx);
}
return nnvglCreateImageFromHandleGL3(ctx, textureId, w, h, flags);
}
// --- [ nvglImageHandle ] ---
/** Unsafe version of: {@link #nvglImageHandle lImageHandle} */
public static native int nnvglImageHandleGL3(long ctx, int image);
/**
* Returns the OpenGL texture id associated with a NanoVG image.
*
* @param ctx the NanoVG context
* @param image the image handle
*/
@NativeType("GLuint")
public static int nvglImageHandle(@NativeType("NVGcontext *") long ctx, int image) {
if (CHECKS) {
check(ctx);
}
return nnvglImageHandleGL3(ctx, image);
}
// --- [ nvgCreate ] ---
/** Unsafe version of: {@link #nvgCreate Create} */
public static native long nnvgCreateGL3(int flags);
/**
* Creates a NanoVG context with an OpenGL 3.0 rendering back-end.
*
* An OpenGL 3.0+ context must be current in the current thread when this function is called and the returned NanoVG context may only be used in the
* thread in which that OpenGL context is current.
*
* @param flags the context flags. One of:
{@link #NVG_ANTIALIAS ANTIALIAS} {@link #NVG_STENCIL_STROKES STENCIL_STROKES} {@link #NVG_DEBUG DEBUG}
*/
@NativeType("NVGcontext *")
public static long nvgCreate(int flags) {
return nnvgCreateGL3(flags);
}
// --- [ nvgDelete ] ---
/** Unsafe version of: {@link #nvgDelete Delete} */
public static native void nnvgDeleteGL3(long ctx);
/**
* Deletes a NanoVG context created with {@link #nvgCreate Create}.
*
* @param ctx the NanoVG context
*/
public static void nvgDelete(@NativeType("NVGcontext *") long ctx) {
if (CHECKS) {
check(ctx);
}
nnvgDeleteGL3(ctx);
}
// --- [ nvgluCreateFramebuffer ] ---
/** Unsafe version of: {@link #nvgluCreateFramebuffer luCreateFramebuffer} */
public static native long nnvgluCreateFramebufferGL3(long ctx, int w, int h, int imageFlags);
/**
* Creates a framebuffer object to render to.
*
* @param ctx the NanoVG context
* @param w the framebuffer width
* @param h the framebuffer height
* @param imageFlags the image flags
*/
@Nullable
@NativeType("NVGLUframebuffer *")
public static NVGLUFramebuffer nvgluCreateFramebuffer(@NativeType("NVGcontext *") long ctx, int w, int h, int imageFlags) {
if (CHECKS) {
check(ctx);
}
long __result = nnvgluCreateFramebufferGL3(ctx, w, h, imageFlags);
return NVGLUFramebuffer.createSafe(__result);
}
// --- [ nvgluBindFramebuffer ] ---
/** Unsafe version of: {@link #nvgluBindFramebuffer luBindFramebuffer} */
public static native void nnvgluBindFramebufferGL3(long ctx, long fb);
/**
* Binds the framebuffer object associated with the specified {@link NVGLUFramebuffer}.
*
* @param ctx the NanoVG context
* @param fb the framebuffer to bind
*/
public static void nvgluBindFramebuffer(@NativeType("NVGcontext *") long ctx, @Nullable @NativeType("NVGLUframebuffer *") NVGLUFramebuffer fb) {
if (CHECKS) {
check(ctx);
}
nnvgluBindFramebufferGL3(ctx, memAddressSafe(fb));
}
// --- [ nvgluDeleteFramebuffer ] ---
/** Unsafe version of: {@link #nvgluDeleteFramebuffer luDeleteFramebuffer} */
public static native void nnvgluDeleteFramebufferGL3(long ctx, long fb);
/**
* Deletes an {@link NVGLUFramebuffer}.
*
* @param ctx the NanoVG context
* @param fb the framebuffer to delete
*/
public static void nvgluDeleteFramebuffer(@NativeType("NVGcontext *") long ctx, @NativeType("NVGLUframebuffer *") NVGLUFramebuffer fb) {
if (CHECKS) {
check(ctx);
}
nnvgluDeleteFramebufferGL3(ctx, fb.address());
}
}