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 @@
#include <sstream>
#include <EGL/egl.h>
#if ANDROID
#ifdef ANDROID
#include <android/native_window.h>
#endif
namespace
{
typedef void* EGLDeviceEXT;
......@@ -143,9 +142,11 @@ vtkEGLRenderWindow::vtkEGLRenderWindow()
this->ScreenSize[1] = 1080;
// this is initialized in vtkRenderWindow
// so we don't need to initialize on else
#ifdef VTK_USE_OFFSCREEN_EGL
this->DeviceIndex = VTK_DEFAULT_EGL_DEVICE_INDEX;
#endif
#if ANDROID
#ifdef ANDROID
this->OffScreenRendering = false;
#else
// this is an offscreen-only window otherwise.
......@@ -420,9 +421,15 @@ void vtkEGLRenderWindow::DestroyWindow()
// Initialize the window for rendering.
void vtkEGLRenderWindow::WindowInitialize (void)
{
vtkInternals* impl = this->Internals;
if (this->OwnWindow)
{
this->CreateAWindow();
}
else if (impl->Context == EGL_NO_CONTEXT)
{
// Get our current context from the EGL current context
impl->Context = eglGetCurrentContext();
}
this->MakeCurrent();
......@@ -455,8 +462,9 @@ void vtkEGLRenderWindow::Initialize (void)
{
this->WindowInitialize();
}
else
else if( this->OwnWindow )
{
// We only need to resize the window if we own it
int w, h;
this->GetEGLSurfaceSize(&w, &h);
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