PDA

View Full Version : Question on Texture



JeremyLiu
11-22-2011, 01:30 AM
I am a undergrad student just becoming familiar with OpenGL. I have some very basic question on OpenGL. I want to know about texture. Can I derive the RGB value from a texture and then use it for coloring a polygon? Will it give the same output like original texture?

BionicBytes
11-22-2011, 04:03 AM
Can I derive the RGB value from a texture and then use it for coloring a polygon
I'm not 100% sure what you're asking here.
Are you saying that you want to sample the texture and then manipulate it in some way and then output the results of that calculation? Yes you can do that. It's called a fragment shader - you can do what ever you want in one of those.

Will it give the same output like original texture
The frament shader will give the same output results like basic texturing if you want it to. it's up to you really.

JeremyLiu
11-22-2011, 07:21 PM
Thank you for answer. Can you please tell me how fragment shader can be used? Is any tutorial on it available?

BionicBytes
11-23-2011, 03:39 AM
You could try this site. There are many tutorial sies on the net - just search.
HeNe offer OpenGl tutorials as well, as does LightHouse3d...

http://arcsynthesis.org/gltut/

JeremyLiu
11-24-2011, 01:12 AM
Thanks for the link provided. I want to do something like this. In my texture, there are some white portions. I want to separate them from the rest of the colored part. Can't I do it without fragment shader?