Fix #21667: smoke drawing crashes calling glTexImage3D on graphics card that do
not support it.
This commit is contained in:
@@ -240,6 +240,11 @@ void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture
|
|||||||
|
|
||||||
float size[3];
|
float size[3];
|
||||||
|
|
||||||
|
if(!tex) {
|
||||||
|
printf("Could not allocate 3D texture for 3D View smoke drawing.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tstart();
|
tstart();
|
||||||
|
|
||||||
VECSUB(size, max, min);
|
VECSUB(size, max, min);
|
||||||
@@ -365,7 +370,7 @@ void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture
|
|||||||
glProgramLocalParameter4fARB (GL_FRAGMENT_PROGRAM_ARB, 1, 7.0, 7.0, 7.0, 1.0);
|
glProgramLocalParameter4fARB (GL_FRAGMENT_PROGRAM_ARB, 1, 7.0, 7.0, 7.0, 1.0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("Your gfx card does not support 3dview smoke drawing.\n");
|
printf("Your gfx card does not support 3D View smoke drawing.\n");
|
||||||
|
|
||||||
GPU_texture_bind(tex, 0);
|
GPU_texture_bind(tex, 0);
|
||||||
if(tex_shadow)
|
if(tex_shadow)
|
||||||
|
|||||||
@@ -392,6 +392,9 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
|
|||||||
void *pixels = NULL;
|
void *pixels = NULL;
|
||||||
float vfBorderColor[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
float vfBorderColor[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
|
|
||||||
|
if(!GLEW_VERSION_1_2)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture");
|
tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture");
|
||||||
tex->w = w;
|
tex->w = w;
|
||||||
tex->h = h;
|
tex->h = h;
|
||||||
|
|||||||
Reference in New Issue
Block a user