Jump to content
  • Advertisement
Sign in to follow this  
Lprogster

OpenGL OpenGL Texture Interpolation

This topic is 3883 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone :) Before I post my problem I want to say hi to everyone. I've been meaning to get a GameDev account for a while now but this problem searching your many posts hasn't answered. For the record, I am using C for my game engine which is reasonably advanced so far. It is programmed with SDL, OpenGL and OpenAL (and some multithreading libraries). My problem is really quite basic: simply interpolate four textures, each to a different vertice of a square. I can do this with a multipass alogithm but I would like to learn how to do it with multitexturing. Multitexturing I found quite easy actually and can do the basics but I can't work out how to do that. So really, any links or documentation, explanations or code examples would all be greatly appreciated. Thank you Lster

Share this post


Link to post
Share on other sites
Advertisement
Hello,

With multitexturing you can apply different coordinate sets for each primitive, but you want the same coordinates with different contributions (if I understood correctly). I don't think you can do this with multitexturing w/ fixed pipeline, but you can do it in a shader in a single pass, if you have the necessary info.

Share this post


Link to post
Share on other sites
Also for four textures, you could use masks, but then you would need as many textures as :

0) First texture
1) Mask 2
2) Texture 2
3) Mask 3
4) Texture 3
5) Mask 4
6) Texture 4

Might be a bit heavy, but should work. Anyway, the idea of this is to : render first one texture, then render the second texture top on it using it's mask (area where it is only rendered), etc.

Share this post


Link to post
Share on other sites
OK, thank you guys. I have another quick question which is: could I change the color for a texture at a vertex. Basically, is it possible to change individual texture's color information at a vertex?

Thanks :)

Share this post


Link to post
Share on other sites
Quote:
Original post by LprogsterI have another quick question which is: could I change the color for a texture at a vertex. Basically, is it possible to change individual texture's color information at a vertex?

Texture have their color information specified by texture coordinates, with no vertices involved, while vertices in texture-mapped geometry have texture coordinates, not color information; what do you mean? What are you trying to do beyond straightforward texture mapping?

Share this post


Link to post
Share on other sites
I mean when drawing, say, a quad could I choose the color associated with a texture and a vertex. I think I mean something like glColor4f but that only changes one texture's color?

Share this post


Link to post
Share on other sites
You can easily interpolate the textures using multitexturing.

Just specify the same uv-coordinates to all the different textures to get the same placement, then specify how you want the textures interpolated using glTexEnv with pname set to GL_TEXTURE_ENV_MODE. You can find all the equations for the different modes in the specification.

//Johan

Share this post


Link to post
Share on other sites
Quote:
Original post by gardin
You can easily interpolate the textures using multitexturing.

Just specify the same uv-coordinates to all the different textures to get the same placement, then specify how you want the textures interpolated using glTexEnv with pname set to GL_TEXTURE_ENV_MODE. You can find all the equations for the different modes in the specification.

//Johan


What are uv-coordinates?

That sounds great, could you post a link to this specification?

Thank you
Lster

Share this post


Link to post
Share on other sites
Quote:
Original post by Lprogster
I mean when drawing, say, a quad could I choose the color associated with a texture and a vertex. I think I mean something like glColor4f but that only changes one texture's color?


You can't change the colors of the texture by changing the vertice color attributes. If you want to blend the texture with the color of the faces, you need to use glTexEnv and GL_BLEND as the mode. Then either have an alpha channel of the texture that makes it transparent or set GL_TEXTURE_ENV_COLOR to a color to be use as a blending factor (again, see the specification)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!