• Advertisement
Sign in to follow this  

Masking a textured sphere question

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