Class SphereVBO

All Implemented Interfaces:
IGLBindedResource, IGLRenderer, ISortableDraw

public class SphereVBO extends DrawableVBO
Warning! Observed that the sphere will render weirdly for rare viewpoint when following GL setting is applied. gl.glDisable(GL.GL_DEPTH_TEST) This is true when Quality.setAlphaActivated(false), in other word for Quality.Advanced.
Author:
David Eck inspired this class with https://math.hws.edu/graphicsbook/source/jogl/ColorCubeOfSpheres.java, Martin Pernollet
  • Field Details

  • Constructor Details

    • SphereVBO

      public SphereVBO(Coord3d position, float radius, int stacks, int slices, Color color)
  • Method Details

    • updateBounds

      public void updateBounds()
      Overrides:
      updateBounds in class DrawableVBO
    • mount

      public void mount(IPainter painter)
      Description copied from interface: IGLBindedResource
      Mount resources to gl context
      Specified by:
      mount in interface IGLBindedResource
      Overrides:
      mount in class DrawableVBO
    • draw

      public void draw(IPainter painter)
      Description copied from class: Drawable
      Call OpenGL2 routines for rendering the object.
      Specified by:
      draw in interface IGLRenderer
      Overrides:
      draw in class DrawableVBO
    • drawSphereDirectWithDataFromArrays

      protected void drawSphereDirectWithDataFromArrays(com.jogamp.opengl.GL2 gl)
    • drawSphereWithDrawArrays

      protected void drawSphereWithDrawArrays(com.jogamp.opengl.GL2 gl, int slices, int stacks)
      Draw one sphere. The VertexPointer and NormalPointer must already be set to point to the data for the sphere, and they must be enabled.
    • getBuilder

      public static SphereVBO.VBOSphereMeshBuilder getBuilder(double radius, int stacks, int slices)
      Allows retrieving or creating a sphere builder for this combination of parameters. The goal is to share a common mesh definition - hence a single pair of array - for a sphere parameter combination.
      Parameters:
      radius - sphere radius
      stacks - number of latitudes
      slices - number of longitudes
      Returns: