Hey peeps, just registered cos it seems to be pretty useful this forum. Anyway to the point.
I am currently having a problem with the fact that when i blend my texture it will blend but will blend with white and not the background.
Here is a sample of the code i am using
public void RenderShipTexture(){
gl.glEnable(GL_BLEND);
gl.glColor4d( 1, 1, 1, 0.5 );
gl.glBindTexture(GL_TEXTURE_2D, texture[2]);
gl.glEnable(GL_TEXTURE_2D);
gl.glBegin(GL_QUADS);
gl.glTexCoord2d(0, 0); gl.glVertex3d( backLeftOfShipX, backLeftOfShipY, -1);
gl.glTexCoord2d(1, 0); gl.glVertex3d( frontLeftOfShipX, frontLeftOfShipY, -1);
gl.glTexCoord2d(1, 1); gl.glVertex3d( frontRightOfShipX, frontRightOfShipY, -1);
gl.glTexCoord2d(0, 1); gl.glVertex3d( backRightOfShipX, backRightOfShipY, -1);
gl.glEnd();
gl.glDisable(GL_TEXTURE_2D);
gl.glDisable(GL_BLEND);
}
// draw objects
public void drawShip() {
gl.glBegin(GL_QUADS);
gl.glVertex3d(backLeftOfShipX, backLeftOfShipY, backLeftOfShipZ);
gl.glVertex3d(frontLeftOfShipX, frontLeftOfShipY, frontLeftOfShipZ);
gl.glVertex3d(frontRightOfShipX, frontRightOfShipY, frontRightOfShipZ);
gl.glVertex3d(backRightOfShipX, backRightOfShipY, backRightOfShipZ);
gl.glEnd();
RenderShipTexture();
// call circle as to draw a circle that will go around the alien for collision detection
centrePlayerX = ((backLeftOfShipX + backRightOfShipX + frontLeftOfShipX + frontRightOfShipX)/4);
centrePlayerY = ((backLeftOfShipY + backRightOfShipY + frontLeftOfShipY + frontRightOfShipY)/4);
//centrePlayerZ = ((backLeftOfShipZ + backRightOfShipZ + frontLeftOfShipZ + frontRightOfShipZ)/4);
gl.glTranslated(centrePlayerX,centrePlayerY,0);
circle();
gl.glTranslated(-centrePlayerX,-centrePlayerY,0);
}
i believe it is something to do with the color as it is set to white, but how can i get this to directly blend with the background and not care about the colours??
Oh and another thing where is it best to blend? a texture or when creating a quad? i thought it would have been the texture itself
Any help is greatly appreciated
Tim