general question - greying out RGB textures?

Posts: 321
Joined: 2004.10
Post: #1
I've got a game with colored units (textures mapped into
rectangles) which move one a game board. The user selects
them with a mouse and moves it to a new game square.

I want to create an effect where the moving unit is greyed out
over the game board squares (and maybe even fades out the
its movement points are expended.

Can anybody suggest a very general approach to such an
effect? I'd like to avoid creating another texture map for
each unit as there are quite alot of these guys.

Quote this message in a reply
Simon Schoelly
Post: #2
hope this is correct:
glTextureEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB); /* or GL_DOT3RGBA if you want to use color and alpha values for the calculation */
/* the next two lines are not in every case necesary */
Then you can use glColor4f to set how much of every color channel should be used in the calcuation and to set the brightnes of your texture.

source: the red book p. 438
Quote this message in a reply
Posts: 1,234
Joined: 2002.10
Post: #3
Define "grey out"... do you mean lowering the contrast of the image towards neutral grey? If so you can do this just by mixing the texture with 0x7f7f7fff with texture_combine.

If you mean converting the RGB texture into a luminance value ("Grayscale" in Photoshop), then you either need a fragment program or another texture. If you keep the client copy of the texture data then you can reupload it as a luminance texture, fiddling with the glPixelTransfer RGB scale to get a balanced grayscale image. Of course this is slow and eats more texture ram.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  General Questions About Old Or Limited Graphics Cards Oddity007 5 5,750 Mar 3, 2009 01:39 AM
Last Post: arekkusu
  Quick question, will glCopyTexSubImage2D with with RECT textures? TomorrowPlusX 28 14,209 Jun 8, 2006 07:04 PM
Last Post: akb825
  Question about how textures are applied to quads which are scaled unevenly TomorrowPlusX 9 5,863 Feb 9, 2006 12:12 PM
Last Post: Chris Ball
  General Texture Question.... WhatMeWorry 5 5,438 Aug 5, 2005 09:38 PM
Last Post: WhatMeWorry
  A general OpenGL Newbie question dmbyer 1 3,456 Oct 6, 2002 03:13 PM
Last Post: henryj