Jump to content
  • Advertisement
Sign in to follow this  
ErikPeeters

Masking a textured sphere question

This topic is 4149 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

Hi All, I'm masking using the following code:
GLUquadricObj *quadric;

m_List = glGenLists(1);
glNewList(List, GL_COMPILE);

    glPushMatrix();

    glBindTexture(GL_TEXTURE_2D, m_unTextures[9]);
    glEnable(GL_TEXTURE_2D);

    glEnable(GL_BLEND);
    glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);

    quadric = gluNewQuadric();
    gluQuadricDrawStyle(quadric, GLU_FILL);
    gluQuadricNormals(quadric, GLU_SMOOTH);
    gluQuadricTexture(quadric, GL_TRUE);
    glPushMatrix();
        glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
        glTranslatef(0.0f, 0.4f, 0.0f);
        gluSphere(quadric, 4.0f, 32, 32);
    glPopMatrix();

    /////////////////////////////////////////////////

    glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
    glBindTexture(GL_TEXTURE_2D, m_unTextures[10]);

    glPushMatrix();
        glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
        glTranslatef(0.0f, 0.4f, 0.0f);
        gluSphere(quadric, 4.0f, 32, 32);
    glPopMatrix();
    gluDeleteQuadric(quadric);

    glDisable(GL_BLEND);
    glDisable(GL_TEXTURE_2D);

    glPopMatrix();

    glEndList();

My texture is covering half of the sphere and the other half is invisible. But when I rotate the sphere and I look upon the the texture from behind I connot see the theture. It is only visible from the front of the sphere. How can I make my half-a-sphere viewable from each side (front and back)?

Share this post


Link to post
Share on other sites
Advertisement
Thanks for the reply Jerax!

But it did not work. I was still not able to see through the 'invisible' masked part of the texture and see the back of the texture on the sphere.


-----


BTW I have disabled the depth buffer, drawn the sphere and enabled the depth buffer again. This had the wanted result of viewing the texture from all angles. But when I draw an object above it the object becomes transparent because of the disabled depth buffer and blends with the sphere texture.

[Edited by - ErikPeeters on June 13, 2007 2:32:05 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!