I imported a model from blender to a C array and displayed it with openGL (glew) under Qt.
I have an embedded resource vertex and fragment shader too. I managed to make the vertex shader work and display correctly the model, but now I’d like to give it a gradient-like effect (it’s a simple box, but I’m planning to write on it somehow, so I need to make it look decent).
How may I accomplish this? A texture with blender? Is there any better way?
For a simple linear gradient you could just add a line in your vertex shader that sets
gl_FrontColorto some (vec4) value, e.g. depending on the vertex’s Y-coordinate. And in the fragment shader you set thegl_FragColortogl_Color(or multiply it bygl_Colorif you’re also texturing the object).