Applying ANGLE is explained as if it were very simple,
but it doesn't seem to be as easy as I thought.
Whether it's because of the lack of relevant data or just the name,
it's not easy to find reference, so I'm asking here.
(If I search for ANGLE, it's all about rotation or degrees. lol)
I'm working on connecting ANGLE to a C# app on Windows.
At the end of twists and turns, ANGLE seems to load properly, but it doesn't work.
The only code on the C# side is hWnd = CreateWindowEx( ... ).
Below is the CPP code.
void angleTest(HWND hWnd) {
EGLint error;
EGLint major;
EGLint minor;
GLenum err;
EGLNativeDisplayType hDC = (EGLNativeDisplayType) GetDC(hWnd);
EGLint dispAttr[] = {
EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE,
EGL_NONE
};
EGLDisplay display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, hDC, dispAttr);
error = eglGetError(); // EGL_SUCCESS
eglInitialize(display, &major, &minor); // major = 1, minor = 5
error = eglGetError(); // EGL_SUCCESS
hinstEgl = LoadLibrary(L"libEGL.dll");
gladLoadEGLLoader((GLADloadproc) GetProcAddressWithFallback);
EGLint configAttr[] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, EGL_DONT_CARE,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE
};
EGLConfig configs;
EGLint numConfig = 0;
eglChooseConfig(display, configAttr, &configs, 1, &numConfig); // numConfig = 1
error = eglGetError(); // EGL_SUCCESS
eglBindAPI(EGL_OPENGL_ES_API);
error = eglGetError(); // EGL_SUCCESS
EGLint contextAttr[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_CONTEXT_MAJOR_VERSION, 2,
EGL_CONTEXT_MINOR_VERSION, 0,
EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE, EGL_FALSE,
EGL_NONE
};
EGLContext context = eglCreateContext(display, configs, EGL_NO_CONTEXT, contextAttr);
error = eglGetError(); // EGL_SUCCESS
EGLint surfaceAttr[] = {
EGL_RENDER_BUFFER, EGL_BACK_BUFFER,
EGL_NONE
};
EGLSurface surface = eglCreateWindowSurface(display, configs, hWnd, surfaceAttr);
error = eglGetError(); // EGL_SUCCESS
eglMakeCurrent(display, surface, surface, context);
error = eglGetError(); // EGL_SUCCESS
hinstGles = LoadLibrary(L"libGLESv2.dll");
gladLoadGLES2Loader((GLADloadproc) GetProcAddressWithFallback);
const GLubyte* ven = glGetString(GL_VENDOR); // Google Inc. (NVIDIA)
const GLubyte* ren = glGetString(GL_RENDERER); // ANGLE (NVIDIA, NVIDIA GeForce GTX 1050 Direct3D11 vs_5_0 ps_5_0, D3D11-31.0.15.3640)
const GLubyte* ver = glGetString(GL_VERSION); // OpenGL ES 2.0.0 (ANGLE 2.1.21199 git hash: b0e9bbd79fb6)
glViewport(0, 0, 400, 400);
err = glGetError(); // 0
glClearColor(1.f, 0.f, 0.f, 1.f);
err = glGetError(); // 0
glClear(GL_COLOR_BUFFER_BIT);
err = glGetError(); // 0
// glFlush();
// err = glGetError(); // 0
eglSwapBuffers(display, surface); // EGL_SUCCESS
}
But no color changes...
It's originally a separate code, but it's running in the same thread anyway.
If I change the settings related to ANGLE,
there is a difference between the screen coming out in blue or gray,
so it doesn't seem to be working completely separately.
(If it comes out in blue, if I move the window or change the window size,
it will be erased in gray.)
Any kind of help would be appreciated.
ps. Sorry, I'm not good at English.