Hello Guest

Drawing an HSB color wheel with OpenGL

  • 1 Replies
Drawing an HSB color wheel with OpenGL
« on: January 06, 2020, 12:26:07 »

I am trying to draw a HSV color picker as a GUI component similar to this:

I have tried using GL_POINTS and marking each pixel with the colour that is required, however due to the fact that there isnt a one to one ration between pixels in opengl and those rendered on the screen this creates a weird affect like so (And I dont even think the colors are properly rendering):

At the moment I have created a buffered image with the correct rgb values, but I am not sure how to render a buffered image to the screen when it is potentially changing every tick. I normally would simply allocate it once as an opengl texture, but I am not sure if that would work as it has been changed, and I also do not want to continuously allocate new textures for performance.

Does anyone know who to render a buffered image dynamically to the screen, or have any examples of color picker implementations in LWJGL/OpenGL?


Offline KaiHH

  • ****
  • 228
Re: Drawing an HSB color wheel with OpenGL
« Reply #1 on: January 06, 2020, 16:27:23 »
You can perfectly render a quad and just use a fragment shader to do the color interpolation in order to render the current hue value interpolated over value and saturation from 0 to 1.
You most definitely don't need and don't want to render a BufferedImage.