diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2006-02-13 08:45:32 +0300 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2006-02-13 08:45:32 +0300 |
commit | e4790aef46f7ca0b4ab01c34f043be9e7b1fa7f1 (patch) | |
tree | 0d83145e454cc7b5947ec657dbd9e415aac9d809 /source/gameengine/BlenderRoutines | |
parent | 6c325d74f534d259820c2b2d94d5b73b3acf0a35 (diff) |
Improved OpenGL Shader Language support for game engine. The python interface is much simplified. Drawback is that scripts need to be updated next release. Testfiles:
http://www.continuousphysics.com/ftp/pub/test/index.php?dir=blender/&file=demos-2.42.zip
patch by Charlie Carley (snailrose @ elysiun.com)
Diffstat (limited to 'source/gameengine/BlenderRoutines')
-rw-r--r-- | source/gameengine/BlenderRoutines/KX_BlenderGL.cpp | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index 50751be7c7d..af367f1797e 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -48,6 +48,17 @@ #include "BMF_Api.h" +#ifdef __APPLE__ +#define GL_GLEXT_LEGACY 1 +#include <OpenGL/gl.h> +#include <OpenGL/glu.h> +#else +#include <GL/gl.h> +#include <GL/glu.h> +#endif +#include "RAS_OpenGLRasterizer/RAS_GLExtensionManager.h" +#include "RAS_OpenGLRasterizer/ARB_multitexture.h" +#include "BL_Material.h" // MAXTEX /* Data types encoding the game world: */ #include "DNA_object_types.h" @@ -166,10 +177,39 @@ void BL_RenderText(int mode,const char* textstr,int textlen,struct TFace* tface, } +void DisableForText() +{ + if(glIsEnabled(GL_BLEND)) + glDisable(GL_BLEND); + + if(glIsEnabled(GL_LIGHTING)) { + glDisable(GL_LIGHTING); + glDisable(GL_COLOR_MATERIAL); + } +#ifdef GL_ARB_multitexture + for(int i=0; i<MAXTEX; i++) { + if(bgl::RAS_EXT_support._ARB_multitexture) + bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i); +#ifdef GL_ARB_texture_cube_map + if(bgl::RAS_EXT_support._ARB_texture_cube_map) + if(glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB)) + glDisable(GL_TEXTURE_CUBE_MAP_ARB); +#endif + if(glIsEnabled(GL_TEXTURE_2D)) + glDisable(GL_TEXTURE_2D); + } +#else//GL_ARB_multitexture + if(glIsEnabled(GL_TEXTURE_2D)) + glDisable(GL_TEXTURE_2D); +#endif +} + + void BL_print_gamedebug_line(char* text, int xco, int yco, int width, int height) { /* gl prepping */ - glDisable(GL_TEXTURE_2D); + DisableForText(); + //glDisable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -204,7 +244,8 @@ void BL_print_gamedebug_line_padded(char* text, int xco, int yco, int width, int /* This is a rather important line :( The gl-mode hasn't been left * behind quite as neatly as we'd have wanted to. I don't know * what cause it, though :/ .*/ - glDisable(GL_TEXTURE_2D); + DisableForText(); + //glDisable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); glPushMatrix(); |