Index: source/blender/gpu/intern/gpu_extensions.c =================================================================== --- source/blender/gpu/intern/gpu_extensions.c (revision 28151) +++ source/blender/gpu/intern/gpu_extensions.c (working copy) @@ -71,7 +71,7 @@ GLuint currentfb; int glslsupport; int extdisabled; - int color24bit; + int screenDepth; GPUDeviceType device; GPUOSType os; GPUDriverType driver; @@ -109,8 +109,10 @@ if (!GLEW_ARB_fragment_shader) GG.glslsupport = 0; glGetIntegerv(GL_RED_BITS, &bits); - GG.color24bit = (bits >= 8); - + /* three colour channels all at the same depth seems feesible + or should we get all three to be exact?? */ + GG.screenDepth = bits * 3; + vendor = (const char*)glGetString(GL_VENDOR); renderer = (const char*)glGetString(GL_RENDERER); @@ -177,9 +179,14 @@ int GPU_24bit_color_support() { - return GG.color24bit; + return GG.screenDepth==24; } +int GPU_screen_depth() +{ + return GG.screenDepth; +} + int GPU_print_error(char *str) { GLenum errCode; Index: source/blender/gpu/GPU_extensions.h =================================================================== --- source/blender/gpu/GPU_extensions.h (revision 28151) +++ source/blender/gpu/GPU_extensions.h (working copy) @@ -62,6 +62,7 @@ int GPU_glsl_support(void); int GPU_non_power_of_two_support(void); int GPU_24bit_color_support(void); +int GPU_screen_depth(void); /* GPU Types */ Index: source/blender/windowmanager/intern/wm_subwindow.c =================================================================== --- source/blender/windowmanager/intern/wm_subwindow.c (revision 28151) +++ source/blender/windowmanager/intern/wm_subwindow.c (working copy) @@ -49,6 +49,13 @@ #include "wm_subwindow.h" #include "wm_window.h" +/* the following prototypes are added as extern only to prevent changing + header search paths - this should probably be done and the following used + to replace these two prototypes. + #include "GPU_extensions.h" */ +extern void GPU_extensions_init(void); /* call this before running any of the functions below */ +extern int GPU_screen_depth(void); + /* wmSubWindow stored in wmWindow... but not exposed outside this C file */ /* it seems a bit redundant (area regions can store it too, but we keep it because we can store all kind of future opengl fanciness here */ @@ -306,15 +313,17 @@ static int mainwin_color_depth= 0; if(mainwin_color_depth==0) { - GLint r, g, b; + /*GPU_extensions_init(); + comments say this should be called before the following + but it causes a crash if called here - second glewInit() call maybe?? + I guess we can safely assume that at this point the GPUGlobals struct + is initialised and available */ + mainwin_color_depth = GPU_screen_depth(); - glGetIntegerv(GL_RED_BITS, &r); - glGetIntegerv(GL_GREEN_BITS, &g); - glGetIntegerv(GL_BLUE_BITS, &b); - - mainwin_color_depth= r + g + b; if(G.f & G_DEBUG) { - printf("Color depth r %d g %d b %d\n", (int)r, (int)g, (int)b); + GLint r; + printf("Color depth %d\n", mainwin_color_depth); + /* not sure if GL_AUX_BUFFERS will work here either */ glGetIntegerv(GL_AUX_BUFFERS, &r); printf("Aux buffers: %d\n", (int)r); }