Texture interpolation with vertex buffers

Hello,

is there anybody who can help me please?? I’m developing terrain engine. It uses 4 TUs for interpolating textures and finaly modulating result fragmets with primary color, which is calculated as a “slope lightning”. CLOD and culling algorithm is disabled. By normal way, rendering polygon by polygon, everything works fine.

Now i have decided for performance boost, as the power will be needed for hand gesture recognition in my project.

Vertex array with color array alone (without textures) boosted my FPS almost 3 times, as i expected. The original way how i did interpolation was setting alpha of GL_TEXTURE_ENV_COLOR and used GL_INTERPOLATE mode for TUs. But the problem is, that there is no way how to change GL_TEXTURE_ENV_COLOR with vertex arrays, one value per polygon (or even vertex).

So i have decided to render 2 triangles per one GL_TEXTURE_ENV_COLOR change, rendered by glDrawElements. I expected some performance fall - from 60 fps with arrays, without textures, to 30 fps with textures. Instead of performance fall, performance disaster came, slowing down to 3 fps.

So the question is:

Why the rendering procedure, 20 lines of code, no math, with arrays, runs at 2 fps, where rendering with 150 lines full of math (calculation of tex coords, vertex position from heightmap…) runs much faster?

Is there any way how to use arrays, or even buffer objects, together with interpolation of textures?

Thank you very much for any hints,

best regards

J. Bastek

I have no idea what are you doing and where is your problem, but my advice is a universal one: use shaders instead of that irritating texture combiner stuff :slight_smile:

The texture combiners can’t be controlled from an array:
http://www.opengl.org/sdk/docs/man/xhtml/glEnableClientState.xml
So, your only way is to use shaders.
With arrays, you can’t really set per-polygon data, btw (unless you make a geometry shader). So, get ready for a lot of vertex duplication just to change an attribute, shared between 3 vertices.

Hello Ilian Dinev,

I was afraid of this, i hoped that there is some trick. I think i still don’t have explored OGL enough to start doing with shaders.

For now i will try to optimize some other things and will hope, that implementing CLOD and culling will be enough for my project.

Thank you very much for your reply.

J. Bastek