Jump to content

  • Log In with Google      Sign In   
  • Create Account


Alpha component of textures.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 smitty1276   Members   -  Reputation: 560

Like
Likes
Like

Posted 20 July 2001 - 07:52 PM

I want to draw a quad with a texture mapped onto it. I only want certain parts of the texture to be visible.... for example, an icon on the screen, where you can still see other objects behind the "empty" parts... perhaps a little sword in the corner of the screen in an RPG that the player could click on. My question is: what would the RGBA (especially the A) values need to be for the quad and the texture to make that work? Also, is this the proper/best way to do that?

Sponsor:

#2 Obelix   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 July 2001 - 05:32 AM

Yes, setting the alpha values is the first step. The most logical would be setting them to 0. The next step is to enable alpha testing and here do you also decide which alpha that will pass the test. One example
http://www.ati.com/na/pages/resource_centre/dev_rel/sdk/rage128sdk/OpenGL/Samples/Rage128AlphaTest.html

#3 smitty1276   Members   -  Reputation: 560

Like
Likes
Like

Posted 21 July 2001 - 08:55 AM

I realize that setting the alpha is the first step... what I''m wanting to know is to set the alpha for WHAT? If I set the alpha to 0.0 for every pixel on the texture, would I still see the quad behind it? OR, does the quad itself need an alpha value of 0.0 before the whole thing would disappear?

I want the non-black parts of the texture to be good and bright.

#4 Obelix   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 July 2001 - 09:41 AM

Why not look at the example?
You are thinking of the quad and the texture as two different things but both are proccessed at the same time. If you are setting the alpha values with glColor for the vertices of the quad will the values be interpolated but you want to cut out something like a sword.

You must set the alpha values for the texture this can be done using a paint program such as Paint Shop or Photoshop. The RGB values for the texture does not matter, black or white or something else. Look at the example also the red book covers alpha testing.


#5 smitty1276   Members   -  Reputation: 560

Like
Likes
Like

Posted 21 July 2001 - 05:04 PM

Okay... sorry. I should''ve looked at the example first. I just got the erroneous impression that you misunderstood my question.

Thanks.

#6 zedzeek   Members   -  Reputation: 528

Like
Likes
Like

Posted 21 July 2001 - 05:23 PM

check my site ( the most recent demo ) the leftside box is your textures pixel colour, the middle is whats alreay on the screen.
play around with the blending methods and few the final pixels colour on the righthand side of the screen

http://members.xoom.com/myBollux

#7 smitty1276   Members   -  Reputation: 560

Like
Likes
Like

Posted 21 July 2001 - 05:40 PM

This may be a dumb question...

In the example, there is this line...

glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);

What is GL_REPLACE? I thought that the only options were GL_DECAL, GL_BLEND, and GL_MODULATE. Is this a Rage specific thing?

#8 Obelix   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 July 2001 - 04:57 AM

I probably missunderstood at least part of the question but it is easier to talk about a example. You want to know how the texture data is mixed with the quads data, right?

GL_REPLACE is a standard and means that the RGBA values is from the texture only. Use replace as in the example in your code. From the red book:
"void glTexEnv{if}(GLenum target, GLenum pname, TYPEparam);
void glTexEnv{if}v(GLenum target, GLenum pname, TYPE *param);
Sets the current texturing function. target must be GL_TEXTURE_ENV. If pname is
GL_TEXTURE_ENV_MODE, param can be GL_DECAL, GL_REPLACE, GL_MODULATE, or GL_BLEND, to
specify how texture values are to be combined with the color values of the fragment being processed. If pname is
GL_TEXTURE_ENV_COLOR, param is an array of four floating-point values representing R, G, B, and A
components. These values are used only if the GL_BLEND texture function has been specified as well.
The combination of the texturing function and the base internal format determine how the textures are applied for each
component of the texture. The texturing function operates on selected components of the texture and the color values
that would be used with no texturing. (Note that the selection is performed after the pixel-transfer function has been
applied.) Recall that when you specify your texture map with glTexImage*D(), the third argument is the internal format
to be selected for each texel."

On page 268 do you have tables with the equations. You can download a pdf with the red book for OpenGL 1.1 here at gamedev.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS