Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

cr0w

translucent rotating cubeness

This topic is 5635 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m doing a game project which requires a spaceship with a sheild. I done the sheild, but i thought it would be useful to have a visual representation of the sheild. I want a cube starting green (healthy) then gradually changing to red when it is damaged. I''m fine implementing the cube but am confused about the transparency. I also have a background texture behind the cube. This is the code i have at the mo: gl.glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); gl.glEnable(GL_BLEND); gl.glBegin(GL_QUADS); // Front Face gl.glColor3f (0.0f, 1.0f, 0.0f); gl.glVertex3f(-0.1f, -0.1f, 0.1f); gl.glVertex3f( 0.1f, -0.1f, 0.1f); gl.glVertex3f( 0.1f, 0.1f, 0.1f); gl.glVertex3f(-0.1f, 0.1f, 0.1f); // Back Face gl.glColor3f (0.0f, 0.0f, 0.0f); gl.glVertex3f(-0.1f, -0.1f, -0.1f); gl.glVertex3f(-0.1f, 0.1f, -0.1f); gl.glVertex3f( 0.1f, 0.1f, -0.1f); gl.glVertex3f( 0.1f, -0.1f, -0.1f); // Top Face gl.glColor3f (1.0f, 1.0f, 1.0f); gl.glVertex3f(-0.1f, 0.1f, -0.1f); gl.glVertex3f(-0.1f, 0.1f, 0.1f); gl.glVertex3f( 0.1f, 0.1f, 0.1f); gl.glVertex3f( 0.1f, 0.1f, -0.1f); // Bottom Face gl.glColor3f (0.0f, 1.0f, 0.0f); gl.glVertex3f(-0.1f, -0.1f, -0.1f); gl.glVertex3f( 0.1f, -0.1f, -0.1f); gl.glVertex3f( 0.1f, -0.1f, 0.1f); gl.glVertex3f(-0.1f, -0.1f, 0.1f); // Right face gl.glColor3f (0.0f, 1.0f, 1.0f); gl.glVertex3f( 0.1f, -0.1f, -0.1f); gl.glVertex3f( 0.1f, 0.1f, -0.1f); gl.glVertex3f( 0.1f, 0.1f, 0.1f); gl.glVertex3f( 0.1f, -0.1f, 0.1f); // Left Face gl.glColor3f (1.0f, 1.0f, 0.0f); gl.glVertex3f(-0.1f, -0.1f, -0.1f); gl.glVertex3f(-0.1f, -0.1f, 0.1f); gl.glVertex3f(-0.1f, 0.1f, 0.1f); gl.glVertex3f(-0.1f, 0.1f, -0.1f); gl.glEnd(); gl.glDisable(GL_BLEND); What''s wrong with it?!

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!