use texture as alpha, not vertex colors!

Started by
14 comments, last by uncutno 21 years ago
quote:Original post by Raduprv
Oh, sorry, GL_SRC_ALPHA works both on source and dest, it is GL_SRC_COLOR which doesn't work on source...
GL_SRC_COLOR works on source. It was added to the core spec in 1.4. There's currently only one function that doesn't work on both source and dest: GL_ALPHA_SATURATE (source-only)
Advertisement
created a flexible converter (inside my engine), and it works just perfectly!!!
tkanks to all of you, and if anybody wants it, ill post the source!
-Anders-Oredsson-Norway-
quote:Original post by Myopic Rhino
GL_SRC_COLOR works on source. It was added to the core spec in 1.4. There''s currently only one function that doesn''t work on both source and dest: GL_ALPHA_SATURATE (source-only)


I know, I was refering to 1.1, which is, for me, the ''standard'' version, since even crappy boards support it.



Height Map Editor | Eternal Lands | Fast User Directory
Ok, last question in a long line of questions... once i get this right, i promis to ansver all questions i read about alpha and blending...

now i got my GL_ALPHA texture, witch is one byte texture, and
i want to render a quad with color (1.f,1.f,1.f,1.f) witch uses the alpha texture for sort of mask!
(should result in a white version of the alpha texture)

do i still use blending? or alpha testing? what is the blending states?? how do i do it?

tried the
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
but got nothing from it....
am i using it right?

searched the web, and gamedev, and the opengl specs (witch i need some time to get into)

im sorry for not getting this, but im tierd, and my brain is hurting, and im almost done with my "use the rest of my life" opengl texture system...

thanks to all of you for your previous posts!
-Anders-Oredsson-Norway-

Ok, here we go

glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

This is since because we want the final result on screen to be alpha blended the usual way. Now the question is where does the color and the alpha come from?

glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );

Since we use a texture with base internal format GL_ALPHA, this will calculate:

to_screen_color = fragment_color
to_screen_alpha = fragment_alpha * texture_alpha

Look into section 3.8.13 of the OpenGL bible. It explained there with all the tables.
It did not work, but i gues that it have to be me! :-)
will try it out tomorow...
probably something wrong with my convertion code, but i got
alot of new understanding from this thread...
i guess game1 is 0.03% closer :-)

thanks again for your time!
going to put my head into the bible the next time...
understanding that i have alot to learn about opengl...
-Anders-Oredsson-Norway-

This topic is closed to new replies.

Advertisement