From d2a8da890f5577493723f12dc8af51a671e64e9e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 28 Mar 2013 11:36:41 -0700 Subject: [PATCH 1/3] don't make the eye sphere a global object --- interface/src/Head.cpp | 6 +++--- interface/src/Head.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index adcec11297..029efe507e 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -38,8 +38,6 @@ vector iris_texture; unsigned int iris_texture_width = 512; unsigned int iris_texture_height = 256; -GLUquadric *sphere = gluNewQuadric(); - Head::Head() { position = glm::vec3(0,0,0); @@ -80,6 +78,8 @@ Head::Head() browAudioLift = 0.0; noise = 0; + sphere = NULL; + hand = new Hand(glm::vec3(skinColor[0], skinColor[1], skinColor[2])); if (iris_texture.size() == 0) { @@ -140,7 +140,7 @@ Head::Head(const Head &otherHead) { } Head::~Head() { - if (sphere) { + if (sphere != NULL) { gluDeleteQuadric(sphere); } } diff --git a/interface/src/Head.h b/interface/src/Head.h index 6ab4368d82..abde89deea 100644 --- a/interface/src/Head.h +++ b/interface/src/Head.h @@ -130,6 +130,8 @@ class Head : public AgentData { int eyeContact; eyeContactTargets eyeContactTarget; + GLUquadric *sphere; + void readSensors(); float renderYaw, renderPitch; // Pitch from view frustum when this is own head. From 084b77be50e5f44a26a53b9b6517b97acc2cd175 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 28 Mar 2013 11:37:49 -0700 Subject: [PATCH 2/3] NULL sphere pointer on Head copy --- interface/src/Head.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 029efe507e..acb52f2189 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -135,6 +135,8 @@ Head::Head(const Head &otherHead) { browAudioLift = otherHead.browAudioLift; noise = otherHead.noise; + sphere = NULL; + Hand newHand = Hand(*otherHead.hand); hand = &newHand; } From a41b00358256978763b0cd9ced59d982bbb12b8d Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 28 Mar 2013 11:47:23 -0700 Subject: [PATCH 3/3] perform proper verification for creation of new sphere --- interface/src/Head.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index acb52f2189..8cf831d426 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -456,7 +456,7 @@ void Head::render(int faceToFace, int isMine) glPopMatrix(); // Right Pupil - if (!sphere) { + if (sphere == NULL) { sphere = gluNewQuadric(); gluQuadricTexture(sphere, GL_TRUE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);