PDA

View Full Version : Overlaying texture on already rendered surfaces



Optimus Prime
04-03-2009, 10:05 AM
Hy to everyone. I'm developing an application that draws texture over surfaces. I have various tile.
Each tile has vertexes, triangles, colors and a texture associated.
Once that my render phase is finished , since I know all the tile s to fill completely the screen, I have the screen filled correctly and my scene is drawn.

Now let's suppose that I want to overlay over my rendered tiles another texture and I want to put it over the same vertexes I used for my textures. I want to do it before swapping buffer, and the next texture is not related at all with my tiles. So it can be that it covers more than one tile and some of them are not covered completely.

Is there a opengl function that permits to do it automatically?

Just to explain better....google earth does it. If you run it and you select the feature "texture overlay" it is possible to choose
the Z value for that. And with a slider it is possible to reach the Z = "Drape on land" and istantly the texture is draped on the 3D relief. Too quickly to think that complex operation are performed to obtain it.

Do anyone knows how it is obtained?

P.S.: I'm using opengl 1.0, perhaps 1.1 because I develop embedded applications. So I cannot use extensions or advanced features.

zeoverlord
04-04-2009, 06:56 AM
glBlendFunc and maybe glAlphaFunc will do that for you

First take a look here (http://www.opengl.org/sdk/docs/man/) and look up these funcs.

next take a look here (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=08) for an example on how blending works, alpha testing works in a similar way.