Mercurial > hg > Game > Cerium
changeset 930:b58861019a28 draft
GL drawing speed up
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 30 Jul 2010 21:46:04 +0900 |
parents | 21be2f7e13ff |
children | ec1b15cdfee0 53ad3a61b40b |
files | Renderer/Engine/SceneGraph.cc Renderer/Engine/SceneGraph.h Renderer/Engine/viewerGL.cc |
diffstat | 3 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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; }
--- 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;
--- 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);