Package com.avrix.ui

Class NanoContext

java.lang.Object
com.avrix.ui.NanoContext

public class NanoContext extends Object
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
    Constructor
    Description
    Initializes a NanoVG context and returns this object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    beginFrame(int windowWidth, int windowHeight)
    Begins a new frame for rendering using NanoVG.
    void
    beginFrame(int windowWidth, int windowHeight, float pxRatio)
    Begins a new frame for rendering using NanoVG with a specified pixel ratio.
    void
    Disposes this NanoVG context.
    void
    Ends the current frame of rendering (nvgEndFrame(context))
    long
    get()
     
    boolean
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 pixels
      windowHeight - 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 pixels
      windowHeight - the height of the window in pixels
      pxRatio - 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.