Re: Possible to use vertex shader without vbo?
Posted by
elect on
Sep 15, 2015; 11:22am
URL: https://forum.jogamp.org/Possible-to-use-vertex-shader-without-vbo-tp4034532p4035318.html
sirus20x6 wrote
static final short lattice_size_x = 678;
static final short lattice_size_y = 524;
2 polys per cell
public void map_color_pre_calc(float height, Model.Vec3 color){
float t = (height - COLOR_MIN_HEIGHT) / (COLOR_MAX_HEIGHT - COLOR_MIN_HEIGHT);
// Clamp to range, just in case
if (t < 0.0) t = 0.0f;
if (t > 1.0) t = 1.0f;
// Brown yellow map
color.x = 0.906f + (t - 0.5f) * 0.180f;
color.y = 0.640f + (t - 0.5f) * 0.680f;
color.z = 0.180f + (t - 0.5f) * 0.773f;
}
I think the height ranges from 0 - 1800f or so
If VBOs look slow to you, glBegin/glEnd are even worst.
Move the color calculation on the gpu and use a round robin VBO pool, 3 VBOs should be enough.
The idea is that each frame you upload and render from a different VBO.
You trade basically memory for speed.
You can take inspirantion from
here, he uses 6 ones, but as McDonald at Nvidia said, 3 should be more than enough. Anyway you should profile it in any case.