Quote:Original post by DracoLacertae So, it just copies the Red channel into Luminance? Oh well, that's what I get for cheating and trying to get GL to do it for free. I wonder if the color matrix can be abused for anything...
It can. You just need to set the matrix so the red component of the output from the multiplication is the weighting of the input you want.
GLfloat weight[16] = {0};weight[0] = 0.3; // some typical RGB to G weightsweight[4] = 0.6;weight[8] = 0.1;glMatrixMode(GL_COLOR);glLoadMatrix(weight);
Be aware that the color matrix is part of the imaging subset and may not be available on all hardware, and also may be software emulated on hardware which it is available on: http://www.opengl.org/wiki/Common_Mistakes#Color_Index.2C_The_imaging_subset
Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.
on opengl es iPhone this code: glTexImage2D( GL_TEXTURE_2D, //duh 0, //no mipmaps GL_LUMINANCE, //store as luminance width, height, 0, //no border GL_RGB, //we have RGB data GL_UNSIGNED_BYTE, image_data);
just crash because opengl return erro (GL_CALL assert error),
if u change GL_RGB with LUMINANCE parameter there is some kind of grey, and most is black.
Then why don't you just preprocess the texture and actually grayscale them, instead of changing opengles states just to visualize them as grey? Do the textures change often? I havent dealt much with opengl es, only a bit, so i don't know about that error you get.
Yes i agree. I decided to preprocess the pixels. my button are small so no need to worry about perf. i think we can close this topic. (and the related one ;..)