org.lwjgl.nanovg.NanoVGGL2 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 2.0. */
public class NanoVGGL2 {
/**
* 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 NanoVGGL2() {
throw new UnsupportedOperationException();
}
// --- [ nvglCreateImageFromHandle ] ---
/** Unsafe version of: {@link #nvglCreateImageFromHandle lCreateImageFromHandle} */
public static native int nnvglCreateImageFromHandleGL2(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 nnvglCreateImageFromHandleGL2(ctx, textureId, w, h, flags);
}
// --- [ nvglImageHandle ] ---
/** Unsafe version of: {@link #nvglImageHandle lImageHandle} */
public static native int nnvglImageHandleGL2(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 nnvglImageHandleGL2(ctx, image);
}
// --- [ nvgCreate ] ---
/** Unsafe version of: {@link #nvgCreate Create} */
public static native long nnvgCreateGL2(int flags);
/**
* Creates a NanoVG context with an OpenGL 2.0 rendering back-end.
*
* An OpenGL 2.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 nnvgCreateGL2(flags);
}
// --- [ nvgDelete ] ---
/** Unsafe version of: {@link #nvgDelete Delete} */
public static native void nnvgDeleteGL2(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);
}
nnvgDeleteGL2(ctx);
}
// --- [ nvgluCreateFramebuffer ] ---
/** Unsafe version of: {@link #nvgluCreateFramebuffer luCreateFramebuffer} */
public static native long nnvgluCreateFramebufferGL2(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 = nnvgluCreateFramebufferGL2(ctx, w, h, imageFlags);
return NVGLUFramebuffer.createSafe(__result);
}
// --- [ nvgluBindFramebuffer ] ---
/** Unsafe version of: {@link #nvgluBindFramebuffer luBindFramebuffer} */
public static native void nnvgluBindFramebufferGL2(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);
}
nnvgluBindFramebufferGL2(ctx, memAddressSafe(fb));
}
// --- [ nvgluDeleteFramebuffer ] ---
/** Unsafe version of: {@link #nvgluDeleteFramebuffer luDeleteFramebuffer} */
public static native void nnvgluDeleteFramebufferGL2(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);
}
nnvgluDeleteFramebufferGL2(ctx, fb.address());
}
}