I play with OGL mix. I have a white background. I draw a quad bike on this background. The square is tied to a white and black texture. An array of colors is filled with color and alpha values:
for (i = 0; i < IMAGE_WIDTH; i++) {
for (j = 0; j < MAGE_HEIGHT; j++) {
c = ((((i&0x8)==0)^((j&0x8))==0))*255;
Image[i][j][0] = (GLubyte) c;
Image[i][j][1] = (GLubyte) c;
Image[i][j][2] = (GLubyte) c;
Image[i][j][3] = (GLubyte) 255;
};
Textured square display:
glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE);
glDisable (GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texCheck);
glLoadIdentity();
glTranslatef (0.0f, 0.0f, -9.0f);
glBegin (GL_QUADS);
glColor3f (1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0, 0.0); glVertex3f(-5.0f, -5.0f, 0.0f);
glTexCoord2f(0.0, 1.0); glVertex3f( 5.0f, -5.0f, 0.0f);
glTexCoord2f(1.0, 1.0); glVertex3f( 5.0f, 5.0f, 0.0f);
glTexCoord2f(1.0, 0.0); glVertex3f(-5.0f, 5.0f, 0.0f);
glEnd();
glDisable(GL_TEXTURE_2D);
glEnable (GL_DEPTH_TEST);
glDisable (GL_BLEND);
The black color of the tethered texture on the ATV is invisible and works great. What should I do so that the white color of the connected texture is transparent and the black color of the connected text is not transparent.
source
share