An update will be applied December 9th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit f29a28a9 authored by H. Cole Wiley's avatar H. Cole Wiley
Browse files

applied fixes that allow Android to bind to current EGL context

parent ec3c7a4e
...@@ -30,11 +30,10 @@ ...@@ -30,11 +30,10 @@
#include <sstream> #include <sstream>
#include <EGL/egl.h> #include <EGL/egl.h>
#if ANDROID #ifdef ANDROID
#include <android/native_window.h> #include <android/native_window.h>
#endif #endif
namespace namespace
{ {
typedef void* EGLDeviceEXT; typedef void* EGLDeviceEXT;
...@@ -143,9 +142,11 @@ vtkEGLRenderWindow::vtkEGLRenderWindow() ...@@ -143,9 +142,11 @@ vtkEGLRenderWindow::vtkEGLRenderWindow()
this->ScreenSize[1] = 1080; this->ScreenSize[1] = 1080;
// this is initialized in vtkRenderWindow // this is initialized in vtkRenderWindow
// so we don't need to initialize on else // so we don't need to initialize on else
#ifdef VTK_USE_OFFSCREEN_EGL
this->DeviceIndex = VTK_DEFAULT_EGL_DEVICE_INDEX; this->DeviceIndex = VTK_DEFAULT_EGL_DEVICE_INDEX;
#endif
#if ANDROID #ifdef ANDROID
this->OffScreenRendering = false; this->OffScreenRendering = false;
#else #else
// this is an offscreen-only window otherwise. // this is an offscreen-only window otherwise.
...@@ -420,9 +421,15 @@ void vtkEGLRenderWindow::DestroyWindow() ...@@ -420,9 +421,15 @@ void vtkEGLRenderWindow::DestroyWindow()
// Initialize the window for rendering. // Initialize the window for rendering.
void vtkEGLRenderWindow::WindowInitialize (void) void vtkEGLRenderWindow::WindowInitialize (void)
{ {
vtkInternals* impl = this->Internals;
if (this->OwnWindow) if (this->OwnWindow)
{ {
this->CreateAWindow(); this->CreateAWindow();
}
else if (impl->Context == EGL_NO_CONTEXT)
{
// Get our current context from the EGL current context
impl->Context = eglGetCurrentContext();
} }
this->MakeCurrent(); this->MakeCurrent();
...@@ -455,8 +462,9 @@ void vtkEGLRenderWindow::Initialize (void) ...@@ -455,8 +462,9 @@ void vtkEGLRenderWindow::Initialize (void)
{ {
this->WindowInitialize(); this->WindowInitialize();
} }
else else if( this->OwnWindow )
{ {
// We only need to resize the window if we own it
int w, h; int w, h;
this->GetEGLSurfaceSize(&w, &h); this->GetEGLSurfaceSize(&w, &h);
if (w != this->Size[0] || h != this->Size[1]) if (w != this->Size[0] || h != this->Size[1])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment