Hi,
I'm working with opengl texturing in 2D, but I need help :) first of all, I'm new at OpenGL, so try not to be so technical in your explanation, i will thank you so much :)
To explain my problem, look at this picture:
as you can see, the ship and the asteroids are quads textured, but i want to "not print" the "black" parts of the quads.
I try to use BLENDING, and although the black parts disappear, the colors blend with the background.
This is how i am blending
glMatrixMode(GL_MODELVIEW);
glPushMatrix(); // guardamos la matriz actual
glTranslatef(centro.x, centro.y, 0.0);
glRotatef(theta, 0.0, 0.0, 1.0);
glTranslatef(-centro.x, -centro.y, 0.0);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture(GL_TEXTURE_2D, texture.TexName());
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex3f(centro.x - dx, centro.y + dy, 0.0);
glTexCoord2f(0.0, 1.0); glVertex3f(centro.x + dx, centro.y + dy, 0.0);
glTexCoord2f(1.0, 1.0); glVertex3f(centro.x + dx, centro.y - dy, 0.0);
glTexCoord2f(1.0, 0.0); glVertex3f(centro.x - dx, centro.y - dy, 0.0);
glEnd();
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glPopMatrix(); // restablecemos la matriz original
Any ideas?
Thank you!!