gray scale image

65c6277c91fae06e80a574be3c8440db
0
udvat 101 Jun 13, 2007 at 07:23

I want to create an image in openGL where only black, gray and white colors are used to express the details. I tried RGB in openGL but many details are hidden. I think I have to implement HSV color model. Am I right?

I know how to convert from rgb to hsv but dont know how to use hsv in openGL. Please help me.

7 Replies

Please log in or register to post a reply.

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jun 13, 2007 at 07:31

What kind of detail is missing in RGB ? And why isn’t GL_LUMINANCE enough ? GL_LUMINANCE uses a single value and internally replaces it for the RGB components of the resulting color value.

65c6277c91fae06e80a574be3c8440db
0
udvat 101 Jun 13, 2007 at 08:16

In my image there are many branches, but many of these branches are hidden because of improper color setting. If I can make different shades in gray scale, I think these branches will be visible.

Searching through internet I saw that GL_Luminance is used with texture. But there is no texture in my code. Would u plz give me an example of using GL_LUMINANCE.

3c5be51fdeec526e1f232d6b68cc0954
0
Sol_HSA 119 Jun 13, 2007 at 08:56

Ah, you want to implement some sort of grayscale dithering in OpenGL. That should be relatively easy using shaders, but no, there’s no automatic mode for that.

A9102969e779768e6f0b8cb87e864c94
0
dave_ 101 Jun 13, 2007 at 09:33

Can you show us a screenshot of what you’ve got and a mock up of what you are trying to achieve?

65c6277c91fae06e80a574be3c8440db
0
udvat 101 Jun 13, 2007 at 09:56

yes I can. but here is no option to paste image,I think.

A9102969e779768e6f0b8cb87e864c94
0
dave_ 101 Jun 13, 2007 at 10:05

This:

[img]http://www.devmaster.net/logo.gif[/img]

displays this:

logo.gif

or use the go advanced button

and you’ll also need an image hosting service

6837d514b487de395be51432d9cdd078
0
TheNut 179 Jun 13, 2007 at 10:54

What’s wrong with just using vertex colours or even the glMaterial() calls? That would be the easiest way to get your scene to look grayscale. You need to have a nicely detailed model for this to work though. Simply throwing in to few polygons and the flat shading will just kill the scene.

As Sol mentioned, if you have access to shaders you can maintain your RGB renders, but modify the pixel values in a fragment shader to simulate your grayscale. This is a more “portable” way for your code.