# HG changeset patch # User koba # Date 1280493964 -32400 # Node ID 35efda39c2d9ba2a4b19912e4a98ffb3b2350a70 # Parent 0f4ae8246dc3e37eea32acbd6eb0546b23e52e69 GL drawing speed up diff -r 0f4ae8246dc3 -r 35efda39c2d9 Renderer/Engine/SceneGraph.cc --- a/Renderer/Engine/SceneGraph.cc Fri Jul 30 21:14:53 2010 +0900 +++ b/Renderer/Engine/SceneGraph.cc Fri Jul 30 21:46:04 2010 +0900 @@ -215,6 +215,7 @@ flag_drawable = 1; sgid = -1; gid = -1; + gl_tex = NULL; frame = 0; } @@ -464,7 +465,7 @@ texture_image = converted; } - this->texture_image = texture_image; + this->gl_tex = SDL_GL_LoadTexture(texture_image); return texture_image; } diff -r 0f4ae8246dc3 -r 35efda39c2d9 Renderer/Engine/SceneGraph.h --- a/Renderer/Engine/SceneGraph.h Fri Jul 30 21:14:53 2010 +0900 +++ b/Renderer/Engine/SceneGraph.h Fri Jul 30 21:46:04 2010 +0900 @@ -4,6 +4,7 @@ #include "polygon.h" #include "Pad.h" #include "TaskManager.h" +#include "texture.h" class SceneGraph; //typedef void (*move_func)(SceneGraph* node, int screen_w, int screen_h); @@ -69,6 +70,9 @@ // Group ID int gid; + // GL ID + GLuint gl_tex; + // 関数ポインタ move_func move; collision_func collision; diff -r 0f4ae8246dc3 -r 35efda39c2d9 Renderer/Engine/viewerGL.cc --- a/Renderer/Engine/viewerGL.cc Fri Jul 30 21:14:53 2010 +0900 +++ b/Renderer/Engine/viewerGL.cc Fri Jul 30 21:46:04 2010 +0900 @@ -170,21 +170,18 @@ void cViewerGL::pickup_vertex() { - SDL_Surface* texture; float xyz1[4], xyz2[4], xyz3[4]; float tex_xy1[2], tex_xy2[2], tex_xy3[2]; float normal1[4],normal2[4],normal3[4]; - GLuint image; + GLuint texture; SceneGraphPtr sg_top = sgroot->getDrawSceneGraph(); SceneGraphPtr sg = sg_top; while (sg) { if (sg->flag_drawable) { - texture = sg->texture_image; - image = SDL_GL_LoadTexture(texture); - - glBindTexture(GL_TEXTURE_2D, image); + texture = sg->gl_tex; + glBindTexture(GL_TEXTURE_2D, texture); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_TEXTURE_2D);