Jump to content


gray scale image


7 replies to this topic

#1 udvat

    Valued Member

  • Members
  • PipPipPip
  • 108 posts

Posted 13 June 2007 - 07:23 AM

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.

#2 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 13 June 2007 - 07:31 AM

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.
If Prolog is the answer, what is the question ?

#3 udvat

    Valued Member

  • Members
  • PipPipPip
  • 108 posts

Posted 13 June 2007 - 08:16 AM

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.

#4 Sol_HSA

    Senior Member

  • Members
  • PipPipPipPip
  • 479 posts
  • LocationNowhere whenever

Posted 13 June 2007 - 08:56 AM

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.
http://iki.fi/sol - my schtuphh

#5 dave_

    Senior Member

  • Members
  • PipPipPipPip
  • 584 posts

Posted 13 June 2007 - 09:33 AM

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

#6 udvat

    Valued Member

  • Members
  • PipPipPip
  • 108 posts

Posted 13 June 2007 - 09:56 AM

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

#7 dave_

    Senior Member

  • Members
  • PipPipPipPip
  • 584 posts

Posted 13 June 2007 - 10:05 AM

This:

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

displays this:

Posted Image

or use the go advanced button

and you'll also need an image hosting service

#8 TheNut

    Senior Member

  • Moderators
  • 1401 posts
  • LocationThornhill, ON

Posted 13 June 2007 - 10:54 AM

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.
http://www.nutty.ca - Being a nut has its advantages.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users