42 std::vector<EGLint> attributes;
47 attributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
48 attributes.push_back(2);
51 attributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
52 attributes.push_back(3);
56 attributes.push_back(EGL_NONE);
58 auto context = ::eglCreateContext(
61 share_context !=
nullptr ? share_context->
GetHandle() :
nullptr,
65 if (context == EGL_NO_CONTEXT) {
70 return std::unique_ptr<Context>(
new Context(display_, context));
78 std::vector<EGLint> attributes;
81 attributes.push_back(EGL_RENDERABLE_TYPE);
84 attributes.push_back(EGL_OPENGL_BIT);
87 attributes.push_back(EGL_OPENGL_ES2_BIT);
90 attributes.push_back(EGL_OPENGL_ES3_BIT);
96 attributes.push_back(EGL_SURFACE_TYPE);
99 attributes.push_back(EGL_WINDOW_BIT);
102 attributes.push_back(EGL_PBUFFER_BIT);
110 attributes.push_back(EGL_RED_SIZE);
111 attributes.push_back(8);
112 attributes.push_back(EGL_GREEN_SIZE);
113 attributes.push_back(8);
114 attributes.push_back(EGL_BLUE_SIZE);
115 attributes.push_back(8);
116 attributes.push_back(EGL_ALPHA_SIZE);
117 attributes.push_back(8);
120 attributes.push_back(EGL_RED_SIZE);
121 attributes.push_back(5);
122 attributes.push_back(EGL_GREEN_SIZE);
123 attributes.push_back(6);
124 attributes.push_back(EGL_BLUE_SIZE);
125 attributes.push_back(5);
131 attributes.push_back(EGL_DEPTH_SIZE);
132 attributes.push_back(
static_cast<EGLint
>(config.
depth_bits));
136 attributes.push_back(EGL_STENCIL_SIZE);
137 attributes.push_back(
static_cast<EGLint
>(config.
stencil_bits));
141 const auto sample_count =
static_cast<EGLint
>(config.
samples);
142 if (sample_count > 1) {
143 attributes.push_back(EGL_SAMPLE_BUFFERS);
144 attributes.push_back(1);
145 attributes.push_back(EGL_SAMPLES);
146 attributes.push_back(sample_count);
151 attributes.push_back(EGL_NONE);
153 EGLConfig config_out =
nullptr;
154 EGLint config_count_out = 0;
155 if (::eglChooseConfig(display_,
165 if (config_count_out < 1) {
169 return std::make_unique<Config>(config, config_out);
An instance of an EGL context.
const EGLContext & GetHandle() const
Get the underlying handle to the EGL context.
virtual std::unique_ptr< Surface > CreatePixelBufferSurface(const Config &config, size_t width, size_t height)
Create an offscreen pixelbuffer surface. These are of limited use except in the context where applica...