comparison Renderer/Engine/viewerGL.cc @ 930:35efda39c2d9

GL drawing speed up
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Fri, 30 Jul 2010 21:46:04 +0900
parents 0f4ae8246dc3
children 660e9190c40c
comparison
equal deleted inserted replaced
929:0f4ae8246dc3 930:35efda39c2d9
168 } 168 }
169 169
170 void 170 void
171 cViewerGL::pickup_vertex() 171 cViewerGL::pickup_vertex()
172 { 172 {
173 SDL_Surface* texture;
174 float xyz1[4], xyz2[4], xyz3[4]; 173 float xyz1[4], xyz2[4], xyz3[4];
175 float tex_xy1[2], tex_xy2[2], tex_xy3[2]; 174 float tex_xy1[2], tex_xy2[2], tex_xy3[2];
176 float normal1[4],normal2[4],normal3[4]; 175 float normal1[4],normal2[4],normal3[4];
177 GLuint image; 176 GLuint texture;
178 177
179 SceneGraphPtr sg_top = sgroot->getDrawSceneGraph(); 178 SceneGraphPtr sg_top = sgroot->getDrawSceneGraph();
180 SceneGraphPtr sg = sg_top; 179 SceneGraphPtr sg = sg_top;
181 180
182 while (sg) { 181 while (sg) {
183 if (sg->flag_drawable) { 182 if (sg->flag_drawable) {
184 texture = sg->texture_image; 183 texture = sg->gl_tex;
185 image = SDL_GL_LoadTexture(texture); 184 glBindTexture(GL_TEXTURE_2D, texture);
186
187 glBindTexture(GL_TEXTURE_2D, image);
188 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 185 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
189 186
190 glEnable(GL_TEXTURE_2D); 187 glEnable(GL_TEXTURE_2D);
191 glEnable(GL_BLEND); 188 glEnable(GL_BLEND);
192 glBegin( GL_TRIANGLES); 189 glBegin( GL_TRIANGLES);