Commit acc30a5e60e9c691fb440ac85a054db408207ea1

Authored by Pavel Govyadinov
1 parent f74c9f43

Added the ability for glObj to render with blended lines

Showing 1 changed file with 28 additions and 5 deletions   Show diff stats
stim/visualization/glObj.h
... ... @@ -43,7 +43,7 @@ private:
43 43 }
44 44  
45 45 void
46   - Create(GLenum mode, bool blend = false)
  46 + Create(GLenum mode, bool blend = false, float opacity = 1.0, stim::vec3<float> point = stim::vec<float>(-10000.0, -10000.0, -10000.0))
47 47 {
48 48 // GLuint selectBuf[2048];
49 49 // GLint hits;
... ... @@ -65,7 +65,15 @@ private:
65 65 {
66 66 glLoadName(i);
67 67 }
68   - glColor3f(0.0, 1.0, 0.05);
  68 + if(blend == false)
  69 + glColor3f(0.0, 1.0, 0.05);
  70 +
  71 + else if(blend && point[0] < -9999.9)
  72 + {
  73 + glColor4f(50.0/256.0,205.0/256.0, 50.0/256.0, opacity); ///Dark Green.
  74 + } else {
  75 +// ???????
  76 + }
69 77 //glColor3ub(rand()%255, rand()%255, rand()%255);
70 78 glBegin(GL_LINE_STRIP);
71 79 for(int j = 0; j < line.size(); j++){
... ... @@ -90,11 +98,19 @@ public:
90 98 }
91 99  
92 100 void
93   - createFromSelf(GLenum mode = GL_RENDER, bool blend = false)
  101 + createFromSelf(GLenum mode = GL_RENDER, bool blend = false, float opacity = 1.0)
  102 + {
  103 + // glPopMatrix();
  104 + init();
  105 + Create(mode, blend, opacity);
  106 + // glPushMatrix();
  107 + }
  108 +
  109 + createFromSelf(GLenum mode = GL_RENDER, bool blend = false, stim::vec3<float> point)
94 110 {
95 111 // glPopMatrix();
96 112 init();
97   - Create(mode, blend);
  113 + Create(mode, blend, 1.0, point);
98 114 // glPushMatrix();
99 115 }
100 116  
... ... @@ -111,9 +127,16 @@ public:
111 127  
112 128  
113 129 void
114   - Render()
  130 + Render(bool blend = false)
115 131 {
  132 + if(blend)
  133 + {
  134 + glEnable(GL_BLEND);
  135 + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  136 + }
116 137 glCallList(dList);
  138 + if(blend)
  139 + glDisable(GL_BLEND);
117 140 CHECK_OPENGL_ERROR
118 141 }
119 142  
... ...