LWJGL Forum

Programming => OpenGL => Topic started by: cookiedragon234 on January 06, 2020, 12:26:07

Title: Drawing an HSB color wheel with OpenGL
Post by: cookiedragon234 on January 06, 2020, 12:26:07
Hi,

I am trying to draw a HSV color picker as a GUI component similar to this:
(https://yui.github.io/yui2/docs/yui_2.9.0_full/docs/assets/colorpicker.jpg)

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):
(https://cdn.discordapp.com/attachments/658373639137132601/663448365501251627/unknown.png)

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?
Title: Re: Drawing an HSB color wheel with OpenGL
Post by: KaiHH 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.