Mistral OMAP35x EVM
PowerVR SGX
Windows CE 6.0
Shouldn't it be possible to render multiple windows from one context? I can open multiple processes (each with a window), but I can't open multiple windows in a single process. The first window renders but the second remains black:
//
// Create a single display, config, context, shader program and texture
//
...
// Create a single display, config, context, shader program and texture
//
...
//
// Create two native windows: g_HostWindowA and g_HostWindowB
//
...
// Create two native windows: g_HostWindowA and g_HostWindowB
//
...
//
// Create an EGL surface for each window
//
g_surfaceA = eglCreateWindowSurface( g_eglDisplay, g_eglActiveConfig, (NativeWindowType)(g_HostWindowA) , NULL);
g_surfaceB = eglCreateWindowSurface( g_eglDisplay, g_eglActiveConfig, (NativeWindowType)(g_HostWindowB) , NULL);
// Create an EGL surface for each window
//
g_surfaceA = eglCreateWindowSurface( g_eglDisplay, g_eglActiveConfig, (NativeWindowType)(g_HostWindowA) , NULL);
g_surfaceB = eglCreateWindowSurface( g_eglDisplay, g_eglActiveConfig, (NativeWindowType)(g_HostWindowB) , NULL);
//
// Render windows sequentially
//
eglMakeCurrent( g_eglDisplay, g_surfaceA, g_surfaceA, g_eglContext );
Render();
eglSwapBuffers( g_eglDisplay, g_surfaceA );
eglMakeCurrent( g_eglDisplay, g_surfaceB, g_surfaceB, g_eglContext );
Render();
eglSwapBuffers( g_eglDisplay, g_surfaceB );
Render();
eglSwapBuffers( g_eglDisplay, g_surfaceB );
void Render(void)
{
static const VERTEX verts[] = { ... }
glClearColor (0.0, 0.0, 0.0, 1.0);
glClear (GL_COLOR_BUFFER_BIT);
glVertexAttribPointer(VERTEX_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(VERTEX), &verts[0].x);
glVertexAttribPointer(VERTEX_DIFFUSE, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(VERTEX), &verts[0].color);
glVertexAttribPointer(TEXTURE_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(VERTEX), &verts[0].u);
glVertexAttribPointer(VERTEX_DIFFUSE, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(VERTEX), &verts[0].color);
glVertexAttribPointer(TEXTURE_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(VERTEX), &verts[0].u);
glActiveTexture( GL_TEXTURE0 );
glBindTexture ( GL_TEXTURE_2D, g_TextureIDs[0] );
GLint sampler1 = glGetUniformLocation ( g_uiProgramObject, "inTexture1" );
glUniform1i ( sampler1, 0 );
glBindTexture ( GL_TEXTURE_2D, g_TextureIDs[0] );
GLint sampler1 = glGetUniformLocation ( g_uiProgramObject, "inTexture1" );
glUniform1i ( sampler1, 0 );
glDrawArrays(GL_TRIANGLES, 0, 6);
}
}
Thanks!
Sean