# Can't render multiple windows?

**URL:** <https://forums.imgtec.com/t/cant-render-multiple-windows/428>\
**Category:** PowerVR Insider\
**Created:** [July 31, 2009, 9:28pm UTC](https://forums.imgtec.com/t/cant-render-multiple-windows/428 "2009-07-31T21:28:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixelshader](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@pixelshader](https://forums.imgtec.com/u/pixelshader)\
**Post date:** [July 31, 2009, 9:28pm UTC](https://forums.imgtec.com/t/cant-render-multiple-windows/428/1 "2009-07-31T21:28:08Z")

</div>

Mistral OMAP35x EVM
  

PowerVR SGX
  

Windows CE 6.0
  

&nbsp;
  

Shouldn't it be possible to render multiple windows from one context?&nbsp; I can open multiple processes (each with a window), but I can't open multiple windows in a single process.&nbsp; The first window renders but the second remains black:
  

&nbsp;
  

&nbsp;&nbsp;&nbsp; //   
&nbsp;&nbsp;&nbsp; // Create a single display, config, context, shader program and texture  
&nbsp;&nbsp;&nbsp; //  
&nbsp;&nbsp;&nbsp; ...
  

&nbsp;&nbsp;&nbsp; //  
&nbsp;&nbsp;&nbsp; // Create two native windows: g\_HostWindowA and g\_HostWindowB  
&nbsp;&nbsp;&nbsp; //  
&nbsp;&nbsp;&nbsp; ...
  

&nbsp;&nbsp;&nbsp; //  
&nbsp;&nbsp;&nbsp; // Create an EGL surface for each window  
&nbsp;&nbsp;&nbsp; //  
&nbsp;&nbsp;&nbsp; g\_surfaceA = eglCreateWindowSurface( g\_eglDisplay, g\_eglActiveConfig, (NativeWindowType)(g\_HostWindowA) , NULL);  
&nbsp;&nbsp;&nbsp; g\_surfaceB = eglCreateWindowSurface( g\_eglDisplay, g\_eglActiveConfig, (NativeWindowType)(g\_HostWindowB) , NULL);
  

  
&nbsp;&nbsp;&nbsp; //  
&nbsp;&nbsp;&nbsp; // Render windows sequentially  
&nbsp;&nbsp;&nbsp; //  
&nbsp;&nbsp;&nbsp; eglMakeCurrent( g\_eglDisplay, g\_surfaceA, g\_surfaceA, g\_eglContext );  
&nbsp;&nbsp;&nbsp; Render();  
&nbsp;&nbsp;&nbsp; eglSwapBuffers( g\_eglDisplay, g\_surfaceA );
  

&nbsp;&nbsp;&nbsp; eglMakeCurrent( g\_eglDisplay, g\_surfaceB, g\_surfaceB, g\_eglContext );  
&nbsp;&nbsp;&nbsp; Render();  
&nbsp;&nbsp;&nbsp; eglSwapBuffers( g\_eglDisplay, g\_surfaceB );
  

  
void Render(void)  
{  
&nbsp;&nbsp;&nbsp; static const VERTEX verts[] = { ... }
  

  
&nbsp;&nbsp;&nbsp; glClearColor (0.0, 0.0, 0.0, 1.0);  
&nbsp;&nbsp;&nbsp; glClear&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (GL\_COLOR\_BUFFER\_BIT);
  

&nbsp;&nbsp;&nbsp; glVertexAttribPointer(VERTEX\_POSITION,&nbsp;&nbsp;&nbsp; 3, GL\_FLOAT,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GL\_FALSE,&nbsp;&nbsp; sizeof(VERTEX), &verts[0].x);  
&nbsp;&nbsp;&nbsp; glVertexAttribPointer(VERTEX\_DIFFUSE,&nbsp;&nbsp;&nbsp;&nbsp; 4, GL\_UNSIGNED\_BYTE,&nbsp;&nbsp;&nbsp; GL\_TRUE,&nbsp;&nbsp;&nbsp; sizeof(VERTEX), &verts[0].color);  
&nbsp;&nbsp;&nbsp; glVertexAttribPointer(TEXTURE\_COORD,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2, GL\_FLOAT,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GL\_FALSE,&nbsp;&nbsp; sizeof(VERTEX), &verts[0].u);
  

&nbsp;&nbsp;&nbsp; glActiveTexture( GL\_TEXTURE0 );  
&nbsp;&nbsp;&nbsp; glBindTexture&nbsp; ( GL\_TEXTURE\_2D, g\_TextureIDs[0] );  
&nbsp;&nbsp;&nbsp; GLint sampler1 = glGetUniformLocation ( g\_uiProgramObject, "inTexture1" );  
&nbsp;&nbsp;&nbsp; glUniform1i ( sampler1, 0 );
  

&nbsp;&nbsp;&nbsp; glDrawArrays(GL\_TRIANGLES, 0, 6);  
}
  

&nbsp;
  

Thanks!
  

Sean

---

<div class="post-metadata">

**Author:** ![pixelshader](https://avatars.discourse-cdn.com/v4/letter/p/ba8739/32.png) [@pixelshader](https://forums.imgtec.com/u/pixelshader)\
**Post date:** [August 3, 2009, 8:00pm UTC](https://forums.imgtec.com/t/cant-render-multiple-windows/428/2 "2009-08-03T20:00:31Z")

</div>

Update: I've verified this code works as expected on two other OpenGL ES 2.0 implementations.&nbsp; So I think this is a bug in the PowerVR&nbsp;SGX drivers for Windows CE.

  

  

&nbsp;

---

<div class="post-metadata">

**Author:** ![GordonMaclachlan](https://avatars.discourse-cdn.com/v4/letter/g/c68b51/32.png) [@GordonMaclachlan](https://forums.imgtec.com/u/GordonMaclachlan)\
**Post date:** [November 17, 2009, 3:54pm UTC](https://forums.imgtec.com/t/cant-render-multiple-windows/428/3 "2009-11-17T15:54:08Z")

</div>

Sorry for the very late reply to this - we’ve not made much progress on this issue. We haven’t been able to reproduce the problem on any system we have and we don’t have the actual board you’re running on here.  
  
  
  
  
  
I’m afraid the best I can suggest is talking to TI about this issue.
