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

androidoglcontextfactory.hpp « opengl « mapswithme « com « jni « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a8fb32bd9692f644c3dd8dfe1dc742fedf5cbe9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#pragma once

#include "../core/jni_helper.hpp"
#include "androidoglcontext.hpp"
#include "drape/oglcontextfactory.hpp"

namespace android
{

class AndroidOGLContextFactory : public dp::OGLContextFactory
{
public:
  AndroidOGLContextFactory(JNIEnv * env, jobject jsurface);
  ~AndroidOGLContextFactory();

  bool IsValid() const;

  virtual dp::OGLContext * getDrawContext();
  virtual dp::OGLContext * getResourcesUploadContext();
  virtual bool isDrawContextCreated() const;
  virtual bool isUploadContextCreated() const;

  void SetSurface(JNIEnv * env, jobject jsurface);
  void ResetSurface();

  int GetWidth() const;
  int GetHeight() const;
  void UpdateSurfaceSize();

private:
  bool QuerySurfaceSize();

private:
  bool createWindowSurface();
  bool createPixelbufferSurface();

  AndroidOGLContext * m_drawContext;
  AndroidOGLContext * m_uploadContext;

  EGLSurface m_windowSurface;
  EGLSurface m_pixelbufferSurface;
  EGLConfig  m_config;

  ANativeWindow * m_nativeWindow;
  EGLDisplay m_display;

  int m_surfaceWidth;
  int m_surfaceHeight;

  bool m_windowSurfaceValid;
};

}  // namespace android