generate solit texture

Hi,

i need your help again.
I read in a file that contains all information (.msh) But maybe my 3D object does not have UVs or an texture file. In that case i thought, i put for all vertex the UV to 1,0 and use a solid (red) texture.


// if texture && open ok, then
	TextureTGA tempTex(TEXTURE_NAME);
	glTexImage2D(GL_TEXTURE_2D, 0, tempTex.hasAlpha() ? GL_RGBA : GL_RGB, tempTex.getWidth(), tempTex.getHeight(), 0, tempTex.hasAlpha() ? GL_BGRA : GL_BGR, GL_UNSIGNED_BYTE, tempTex.getData().data());
// else
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1,0, GL_RGB, GL_UNSIGNED_BYTE, {Red color});

how would i tell the last glTexImage2D to use just red Color instead of a texture data?? I want to avoid to change the code at many parts (to use different shaders, init other variables,…) and i think this is the best way.
Or do you have a different idea??


GLubyte red[4] = {255,0,0,255};

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid*) red);

works, thank you very much :wink: