I want to change the some texels in a OpenGL texture for a given location. Can anyone help me with this pls ?
This is the functionnality that I want,
void ChangeTexelColor(int x, int y, GLuint id, int texW, int texH, GLenum format)
{
//What is here ?
}
This will use to maintain the minimap of my game (if anyone have a better idea of maintaining a dynamic map-texture-). Btw, this must done fast. Thanks.
OpenGL has the
glTexSubImage2D
function, which is exactly for your purpose.Here's a functions that changes the color of one texel:
Performance-wise, you may be better to store the map locally as your own array and draw it to the screen as a set of untextured quads.
Rendering primitives is heavily optimised, especially compared to creating or modifying textures.