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();
Masking a textured sphere question
Hi All,
I'm masking using the following code:
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)?
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]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement