mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:47:11 +02:00
set texture binding of first render call only
This commit is contained in:
parent
0b81ef5565
commit
3b3ab9f68f
1 changed files with 12 additions and 8 deletions
|
@ -33,10 +33,12 @@ const float DECAY = 0.1;
|
||||||
|
|
||||||
char iris_texture_file[] = "interface.app/Contents/Resources/images/green_eye.png";
|
char iris_texture_file[] = "interface.app/Contents/Resources/images/green_eye.png";
|
||||||
|
|
||||||
static vector<unsigned char> iris_texture;
|
vector<unsigned char> iris_texture;
|
||||||
unsigned int iris_texture_width = 512;
|
unsigned int iris_texture_width = 512;
|
||||||
unsigned int iris_texture_height = 256;
|
unsigned int iris_texture_height = 256;
|
||||||
|
|
||||||
|
GLUquadric *sphere = gluNewQuadric();
|
||||||
|
|
||||||
Head::Head()
|
Head::Head()
|
||||||
{
|
{
|
||||||
position.x = position.y = position.z = 0;
|
position.x = position.y = position.z = 0;
|
||||||
|
@ -79,6 +81,7 @@ Head::Head()
|
||||||
|
|
||||||
Head::~Head() {
|
Head::~Head() {
|
||||||
// all data is primitive, do nothing
|
// all data is primitive, do nothing
|
||||||
|
gluDeleteQuadric(sphere);
|
||||||
}
|
}
|
||||||
|
|
||||||
Head* Head::clone() const {
|
Head* Head::clone() const {
|
||||||
|
@ -345,12 +348,14 @@ void Head::render(int faceToFace, float * myLocation)
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
// Right Pupil
|
// Right Pupil
|
||||||
GLUquadric *sphere = gluNewQuadric();
|
if (!sphere) {
|
||||||
gluQuadricTexture(sphere, GL_TRUE);
|
sphere = gluNewQuadric();
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
gluQuadricTexture(sphere, GL_TRUE);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
gluQuadricOrientation(sphere, GLU_OUTSIDE);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, iris_texture_width, iris_texture_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &iris_texture[0]);
|
gluQuadricOrientation(sphere, GLU_OUTSIDE);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, iris_texture_width, iris_texture_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &iris_texture[0]);
|
||||||
|
}
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
{
|
{
|
||||||
|
@ -391,7 +396,6 @@ void Head::render(int faceToFace, float * myLocation)
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
gluDeleteQuadric(sphere);
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue