Shaders Blending a colour with a Vertex Buffer


This is probably a simple thing to do but I'm just not sure how to do it.

Say I have a vertex buffer that I want draw with a tint of red, something like doing this:
But this doesn't work, I read somewhere that I would have to use a shader? I'm not sure how though, I've never used them before. I've tried playing around with a shader trying to learn how to do this, but I can't figure it out.

I don't want to just set colour information for the vertices as I would like to be able to tint the entire model on the fly. Does anyone know how to do this?


I too am venturing into this workflow. Did you ever find a solution? Similar to how a matrix can warp the shape of both a draw_self() sprite and a vertex_submit call, I'm hoping there's a similar "blend" matrix call that can be applied to both the sprite and the vbuff.

image_blend only updates the sprite blend, not the vbuff call.

Aside from shaders (something which I'm not keen on breaking my brain with just yet), I suspect the answer may lay with the GPU blend calls which I'll investigate shortly.

EDIT: Something like this I suspect might work, I just haven't had enough experience with GPU Blendmodes yet... Hoping and expert can chime in here;

    gpu_set_blendmode_ext(bm_inv_dest_colour, bm_one);
    vertex_submit(_vbuffer[0],pr_trianglestrip, -1);
The above code alters the blending of the vbuff, but I can't seem to identify the syntax to change the colour blending which would give the "tinting" effect that we're after.

EDIT: Ok, I think one shader-less method is to overlay a dynamic coloured primitive over the vbuff, the blend them appropriately that should then give the desired effect. I'll post a sample shortly.
Last edited: