Skip to main content
GameDev.net gamedev.net
🔒 Locked

how do i texture this?

Started by FreJa Jan 18, 2007 at 4:50 PM 4 replies 550+ views
Original Post
FreJa
FreJa
Hey, Take a look at this texture: Texture It has a white background... How can I make that only the grids are visible, removing the white? Thanks
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."
Funkymunky
Funkymunky
Do you mean using something like photoshop to make the white parts transparent? (if so, use the magic wand to select everything that isn't white, make a new image with a transparent background and paste the stuff to that image)

Or do you mean using a shader? (do a test to see if the color value is white and if so set the alpha to 0)
Ezbez
Ezbez
You could set white as a color key if your graphics API can do that (makes the keyed color not drawn). Alternatively, you could open up the image in your favorite Photoshop-like program and flood-fill the background to transparent then save and use blending when you're drawing it.
FreJa
FreJa
No. I mean in OpenGL, using some kind of texture option, like one would use GL_LUMINANCE OR GL_RGB...
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."
Symphonic
Symphonic
Simple answer is no.

It is probably easiest to use the GIMP or Photoshop to add an alpha layer (there are tools in those programs that will automatically convert white regions to transparency.

If you're using shaders, you could write a shader that would go transparent on white texels, or have alpha proportional to 1-(texel brightness).

Since you're using color, this next idea isn't really feasible, but you could re-do the image as two grayscale images (one for the grid, the other for the text) and pass in the format type GL_ALPHA to glTexImage2D(), but then white would mean visible and black would mean invisible ~ YMMV with this approach.

Geordi
George D. Filiotis
Ezbez
Ezbez
Quote:
Original post by FreJa
No. I mean in OpenGL, using some kind of texture option, like one would use GL_LUMINANCE OR GL_RGB...


glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Should give transparency based on the alpha value of the vertices.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.