summaryrefslogtreecommitdiffstats
path: root/src/graphics/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics/opengl')
-rw-r--r--src/graphics/opengl/gldevice.cpp17
-rw-r--r--src/graphics/opengl/gldevice.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp
index 9f64fab..57738a6 100644
--- a/src/graphics/opengl/gldevice.cpp
+++ b/src/graphics/opengl/gldevice.cpp
@@ -1791,6 +1791,23 @@ FillMode CGLDevice::GetFillMode()
return FILL_POINT;
}
+void* CGLDevice::GetFrameBufferPixels()const{
+
+ SDL_Surface* surface = SDL_GetVideoSurface();
+
+ assert(surface != nullptr);
+
+ GLubyte* pixels = new GLubyte [4 * surface->h * surface->w];
+
+ glReadPixels(0,0,surface->w,surface->h,GL_RGBA,GL_UNSIGNED_BYTE,pixels);
+
+ unsigned int* p = static_cast<unsigned int*> ( static_cast<void*>(pixels) );
+
+ for (int i = 0; i < surface->h * surface->w; ++i)
+ p[i] |= 0xFF000000;
+
+ return static_cast<void*>(p);
+}
} // namespace Gfx
diff --git a/src/graphics/opengl/gldevice.h b/src/graphics/opengl/gldevice.h
index c648161..267ee73 100644
--- a/src/graphics/opengl/gldevice.h
+++ b/src/graphics/opengl/gldevice.h
@@ -188,6 +188,8 @@ public:
virtual void SetFillMode(FillMode mode) ;
virtual FillMode GetFillMode();
+ virtual void* GetFrameBufferPixels()const;
+
private:
//! Updates internal modelview matrix
void UpdateModelviewMatrix();