Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/device')
-rw-r--r--intern/cycles/device/device.cpp10
-rw-r--r--intern/cycles/device/device.h2
-rw-r--r--intern/cycles/device/device_cuda.cpp14
-rw-r--r--intern/cycles/device/device_multi.cpp4
4 files changed, 23 insertions, 7 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index cd0d64f37dd..2f2d34dcef2 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -86,10 +86,15 @@ void Device::pixels_free(device_memory& mem)
mem_free(mem);
}
-void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int width, int height)
+void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int width, int height, bool transparent)
{
pixels_copy_from(rgba, y, w, h);
+ if(transparent) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ }
+
glPixelZoom((float)width/(float)w, (float)height/(float)h);
glRasterPos2f(0, y);
@@ -97,6 +102,9 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int width, in
glRasterPos2f(0.0f, 0.0f);
glPixelZoom(1.0f, 1.0f);
+
+ if(transparent)
+ glDisable(GL_BLEND);
}
Device *Device::create(DeviceType type, bool background, int threads)
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 8006eea1a5f..87683ae4719 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -115,7 +115,7 @@ public:
/* opengl drawing */
virtual void draw_pixels(device_memory& mem, int y, int w, int h,
- int width, int height);
+ int width, int height, bool transparent);
#ifdef WITH_NETWORK
/* networking */
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 0537e231f44..cc1c1275bf4 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -607,7 +607,7 @@ public:
}
}
- void draw_pixels(device_memory& mem, int y, int w, int h, int width, int height)
+ void draw_pixels(device_memory& mem, int y, int w, int h, int width, int height, bool transparent)
{
if(!background) {
PixelMem pmem = pixel_mem_map[mem.device_pointer];
@@ -621,11 +621,16 @@ public:
glEnable(GL_TEXTURE_2D);
+ if(transparent) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ }
+
glColor3f(1.0f, 1.0f, 1.0f);
glPushMatrix();
glTranslatef(0.0f, (float)y, 0.0f);
-
+
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
@@ -640,6 +645,9 @@ public:
glEnd();
glPopMatrix();
+
+ if(transparent)
+ glDisable(GL_BLEND);
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
@@ -649,7 +657,7 @@ public:
return;
}
- Device::draw_pixels(mem, y, w, h, width, height);
+ Device::draw_pixels(mem, y, w, h, width, height, transparent);
}
void task_add(DeviceTask& task)
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index e48df93737d..cae63596d3b 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -244,7 +244,7 @@ public:
mem.device_pointer = tmp;
}
- void draw_pixels(device_memory& rgba, int y, int w, int h, int width, int height)
+ void draw_pixels(device_memory& rgba, int y, int w, int h, int width, int height, bool transparent)
{
device_ptr tmp = rgba.device_pointer;
int i = 0, sub_h = h/devices.size();
@@ -255,7 +255,7 @@ public:
/* adjust math for w/width */
rgba.device_pointer = sub.ptr_map[tmp];
- sub.device->draw_pixels(rgba, sy, w, sh, width, height);
+ sub.device->draw_pixels(rgba, sy, w, sh, width, height, transparent);
i++;
}