Package com.avrix.ui
Class NanoContext
java.lang.Object
com.avrix.ui.NanoContext
The NanoContext class encapsulates a NanoVG context and provides utility methods for managing
and rendering with the context in an OpenGL environment.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeginFrame(int windowWidth, int windowHeight) Begins a new frame for rendering using NanoVG.voidbeginFrame(int windowWidth, int windowHeight, float pxRatio) Begins a new frame for rendering using NanoVG with a specified pixel ratio.voiddispose()Disposes this NanoVG context.voidendFrame()Ends the current frame of rendering (nvgEndFrame(context))longget()boolean
-
Constructor Details
-
NanoContext
public NanoContext()Initializes a NanoVG context and returns this object.
-
-
Method Details
-
beginFrame
public void beginFrame(int windowWidth, int windowHeight) Begins a new frame for rendering using NanoVG. This method calculates the pixel ratio based on the given window dimensions.- Parameters:
windowWidth- the width of the window in pixelswindowHeight- the height of the window in pixels
-
beginFrame
public void beginFrame(int windowWidth, int windowHeight, float pxRatio) Begins a new frame for rendering using NanoVG with a specified pixel ratio. This method should be called at the start of each frame before any drawing operations.- Parameters:
windowWidth- the width of the window in pixelswindowHeight- the height of the window in pixelspxRatio- the pixel ratio, which is typically the ratio of the framebuffer size to the window size
-
endFrame
public void endFrame()Ends the current frame of rendering (nvgEndFrame(context)) -
isModernOpenGL
public boolean isModernOpenGL()- Returns:
- true if the machine this program is running on supports modern OpenGL (Version 3 and above)
-
get
public long get()- Returns:
- the NanoVG context long ID.
-
dispose
public void dispose()Disposes this NanoVG context.
-