Hi,
I'm using Adreno SDK 3.6 on Windows 7.
I want to render stuff on two different native windows, so I call eglCreateWindowSurface twice, with the same parameters except for the NativeWindowType parameters:
EGLDisplay eglDisplay = ...;
EGLConfig config = ...;
HWND hWnd1 = CreateWindow(..);
NativeWindowType nativeWindow1 = (NativeWindowType)hWnd1;
EGLSurface eglSurface1 = eglCreateWindowSurface(eglDisplay, config, nativeWindow1, NULL);
HWND hWnd2 = CreateWindow(..);
NativeWindowType nativeWindow2 = (NativeWindowType)hWnd2;
EGLSurface eglSurface2 = eglCreateWindowSurface(eglDisplay, config, nativeWindow2, NULL);
I expected eglCreateWindowSurface to return different surface values for different nativeWindow values, but it does not, so all my drawing is done in only one window.
Can you tell me if I'm doing something wrong?
Creating the surface does not being its actually going to get rendered into...the process is exactly how you explained it..ie. you created a surface. Are you associating the said surface with the OpenGL context ? ( I'm assuming you are using OpenGL ). If not, how do you expect to render into the surface ?
Yes, I'm using OpenGL ES 3.0 and I'm creating the context, but if those two variables for surfaces have the same value, then all drawing will be done in one window.
I've tried this with one context, making it current for each surface before drawing. If I try to create two contexts, one for each surface, with the first one being share_context for the second one, I get an assertion mesage:
File: ..\..\src\EGLEntry.cpp
Line: 502
Expression: err != EGL_BAD_CONTEXT
Ok.now it make sense..if both handle refer to the same surface. So maybe there is a limitation in the SDK restricting you to only one window surface. Do you mind me asking about your exact use case ? Does your application required multiple windows or are you just looking for another surface to render to that is not the primary surface ?
Unfortunately the emulator in the Adreno SDK does not support more than 1 context, so this will be possible to test.
@[email protected]
I'm working on a visual interface for a "shader editor" that allows loading a model and observe how changes made to it's shaders using this interface affects the model. For DirectX we're using swap chains and I'm looking for a way to make this work with OpenGL.
@mhfeldma
That's not a big deal, one context would be enough (as I already posted). The real problem is that it doesn't seem to support more than one surface...
Thanks for the description. If this is not going to be on a mobile device, then I would suggest using regular desktop GL. If it is for mobile, you could use viewports and scissoring to accomplish the multi-window effect.