# error in OpenGL ES 1.1 context on SGX profile

**URL:** <https://forums.imgtec.com/t/error-in-opengl-es-1-1-context-on-sgx-profile/929>\
**Category:** PowerVR Insider\
**Tags:** pvrvframe\
**Created:** [November 29, 2010, 9:55am UTC](https://forums.imgtec.com/t/error-in-opengl-es-1-1-context-on-sgx-profile/929 "2010-11-29T09:55:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pencyot3](https://avatars.discourse-cdn.com/v4/letter/p/b3f665/32.png) [@pencyot3](https://forums.imgtec.com/u/pencyot3)\
**Post date:** [November 29, 2010, 9:55am UTC](https://forums.imgtec.com/t/error-in-opengl-es-1-1-context-on-sgx-profile/929/1 "2010-11-29T09:55:04Z")

</div>

I am using OGLES2\_WINDOWS\_PCEMULATION\_2.07.27.0484.  
  
I chose an SGX profile in PVRVFrameSetup.  
  
And I created OpenGL ES context as follows.  
  
&nbsp; // Create context  
&nbsp; EGLint cfg\_attribs[] = {  
&nbsp;&nbsp;&nbsp;&nbsp; EGL\_LEVEL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,  
&nbsp;&nbsp;&nbsp;&nbsp; EGL\_SURFACE\_TYPE,&nbsp;&nbsp;&nbsp;&nbsp; EGL\_WINDOW\_BIT,  
&nbsp;&nbsp;&nbsp;&nbsp; EGL\_RENDERABLE\_TYPE,&nbsp; EGL\_OPENGL\_ES\_BIT,  
&nbsp;&nbsp;&nbsp;&nbsp; EGL\_RED\_SIZE,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5,  
&nbsp;&nbsp;&nbsp;&nbsp; EGL\_GREEN\_SIZE,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5,  
&nbsp;&nbsp;&nbsp;&nbsp; EGL\_BLUE\_SIZE,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5,  
&nbsp;&nbsp;&nbsp;&nbsp; EGL\_NONE  
&nbsp; };  
&nbsp; eglChooseConfig( g\_display, cfg\_attribs, &config, 1, &num\_config );  
&nbsp; eglBindAPI( EGL\_OPENGL\_ES\_API );  
&nbsp; EGLint ctx\_attribs[] = {  
&nbsp;&nbsp;&nbsp;&nbsp; EGL\_CONTEXT\_CLIENT\_VERSION, 1,  
&nbsp;&nbsp;&nbsp;&nbsp; EGL\_NONE  
&nbsp; };  
&nbsp; eglCreateContext( g\_display, config, 0, ctx\_attribs );  
  
  
glGetString() gave back the following character string in this context.  
  
&nbsp; GL\_VERSION: “OpenGL ES-CM 1.1”  
&nbsp; GL\_VENDOR: “Imagination Technologies (Host GL: `NVIDIA Corporation`)”  
&nbsp; GL\_RENDERER: “PowerVR PVRVFrame 7.2 SGX (Host GL: `GeForce 9800 GT/PCI/SSE2`) SDK Build: 2.07.27.0297”  
&nbsp; GL\_EXTENSIONS: "GL\_OES\_byte\_coordinates GL\_OES\_fixed\_point GL\_OES\_query\_matrix GL\_OES\_single\_precision GL\_OES\_matrix\_get GL\_OES\_read\_format GL\_IMG\_read\_format GL\_OES\_point\_sprite GL\_OES\_query\_matrix GL\_OES\_texture\_env\_crossbar GL\_OES\_texture\_mirrored\_repeat GL\_OES\_blend\_substract GL\_OES\_blend\_func\_separate GL\_OES\_blend\_equation\_separate GL\_OES\_stencil\_wrap GL\_OES\_extended\_matrix\_palette GL\_OES\_vertex\_half\_float GL\_OES\_compressed\_ETC1\_RGB8\_texture GL\_OES\_compressed\_paletted\_texture GL\_OES\_depth24 GL\_OES\_depth\_texture GL\_OES\_texture\_float GL\_OES\_texture\_half\_float GL\_OES\_texture\_cube\_map GL\_OES\_rgb8\_rgba8 GL\_OES\_stencil8 GL\_OES\_fragment\_precision\_high GL\_OES\_element\_index\_uint GL\_IMG\_texture\_compression\_pvrtc GL\_OES\_framebuffer\_object GL\_OES\_mapbuffer GL\_OES\_matrix\_palette GL\_OES\_point\_size\_array GL\_OES\_draw\_texture GL\_EXT\_multi\_draw\_arrays GL\_IMG\_texture\_format\_BGRA8888"  
  
  
“GL\_OES\_texture\_cube\_map” was included in glGetString(GL\_EXTENSIONS), but a GL\_INVALID\_ENUM error occurred by a call of glGetIntegerv(GL\_MAX\_CUBE\_MAP\_TEXTURE\_SIZE\_OES, &size).  
  
“GL\_OES\_depth\_texture” was included in glGetString(GL\_EXTENSIONS), but a GL\_INVALID\_VALUE error occurred by a call of glTexImage2D(GL\_TEXTURE\_2D, 0, GL\_DEPTH\_COMPONENT, 1, 1, 0, GL\_DEPTH\_COMPONENT, GL\_UNSIGNED\_SHORT, NULL).

---

<div class="post-metadata">

**Author:** ![pencyot3](https://avatars.discourse-cdn.com/v4/letter/p/b3f665/32.png) [@pencyot3](https://forums.imgtec.com/u/pencyot3)\
**Post date:** [November 29, 2010, 10:02am UTC](https://forums.imgtec.com/t/error-in-opengl-es-1-1-context-on-sgx-profile/929/2 "2010-11-29T10:02:48Z")

</div>

// The error occur by the following program.  
  
#include \<EGL/egl.h\>  
#include \<GLES/gl.h\>  
#include \<GLES/glext.h\>  
#include \<windows.h\>  
#include \<iostream\>  
  
const char WINDOW\_CLASS\_NAME[] = “E638D50F-0641-4215-9F7F-110FC38A5E54”;  
  
HDC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g\_win\_dc;  
EGLDisplay g\_display;  
EGLSurface g\_surface;  
EGLContext g\_context;  
  
#ifndef GL\_DEPTH\_COMPONENT  
#define GL\_DEPTH\_COMPONENT 0x1902  
#endif  
  
void  
PrintGLError() {  
&nbsp;&nbsp; &nbsp;const char\* msg;  
&nbsp;&nbsp; &nbsp;switch ( glGetError() ) {  
&nbsp;&nbsp; &nbsp;case GL\_NO\_ERROR:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;  
&nbsp;&nbsp; &nbsp;case GL\_INVALID\_ENUM:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msg = “GL\_INVALID\_ENUM”;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;  
&nbsp;&nbsp; &nbsp;case GL\_INVALID\_VALUE:&nbsp;&nbsp;&nbsp;&nbsp; msg = “GL\_INVALID\_VALUE”;&nbsp;&nbsp;&nbsp;&nbsp; break;  
&nbsp;&nbsp; &nbsp;case GL\_INVALID\_OPERATION: msg = “GL\_INVALID\_OPERATION”; break;  
&nbsp;&nbsp; &nbsp;case GL\_STACK\_OVERFLOW:&nbsp;&nbsp;&nbsp; msg = “GL\_STACK\_OVERFLOW”;&nbsp;&nbsp;&nbsp; break;  
&nbsp;&nbsp; &nbsp;case GL\_STACK\_UNDERFLOW:&nbsp;&nbsp; msg = “GL\_STACK\_UNDERFLOW”;&nbsp;&nbsp; break;  
&nbsp;&nbsp; &nbsp;case GL\_OUT\_OF\_MEMORY:&nbsp;&nbsp;&nbsp;&nbsp; msg = “GL\_OUT\_OF\_MEMORY”;&nbsp;&nbsp;&nbsp;&nbsp; break;  
&nbsp;&nbsp; &nbsp;default:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msg = “Unknown Error”;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;  
&nbsp;&nbsp; &nbsp;}  
&nbsp;&nbsp; &nbsp;std::cerr \<\< "GL Error: " \<\< msg \<\< std::endl;  
}  
  
/\* WM\_CREATE _/  
LRESULT  
OnCreate( HWND hwnd ) {_  
  
_&nbsp;&nbsp; &nbsp;// Initialize EGL  
&nbsp;&nbsp; &nbsp;g\_win\_dc&nbsp; = GetDC( hwnd );  
&nbsp;&nbsp; &nbsp;g\_display = eglGetDisplay( g\_win\_dc );_  
  
_&nbsp;&nbsp; &nbsp;EGLint major, minor;  
&nbsp;&nbsp; &nbsp;if ( !eglInitialize( g\_display, &major, &minor ) )  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return 1;_  
  
_&nbsp;&nbsp; &nbsp;// Choose config  
&nbsp;&nbsp; &nbsp;const EGLint cfg\_attribs[] = {  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;EGL\_LEVEL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;EGL\_SURFACE\_TYPE,&nbsp;&nbsp;&nbsp;&nbsp; EGL\_WINDOW\_BIT,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;EGL\_RENDERABLE\_TYPE,&nbsp; EGL\_OPENGL\_ES\_BIT,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;EGL\_RED\_SIZE,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;EGL\_GREEN\_SIZE,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;EGL\_BLUE\_SIZE,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;EGL\_NONE  
&nbsp;&nbsp; &nbsp;};  
&nbsp;&nbsp; &nbsp;EGLConfig config = 0;  
&nbsp;&nbsp; &nbsp;int&nbsp;&nbsp; num\_config;  
&nbsp;&nbsp; &nbsp;if ( !eglChooseConfig( g\_display, cfg\_attribs, &config, 1, &num\_config ) || (num\_config \< 1) )  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return 1;_  
  
_&nbsp;&nbsp; &nbsp;// Create surface  
&nbsp;&nbsp; &nbsp;const EGLint surf\_attribs[] = {  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;EGL\_NONE  
&nbsp;&nbsp; &nbsp;};  
&nbsp;&nbsp; &nbsp;g\_surface = eglCreateWindowSurface( g\_display, config, hwnd, surf\_attribs );_  
  
_&nbsp;&nbsp; &nbsp;// Create context  
&nbsp;&nbsp; &nbsp;eglBindAPI( EGL\_OPENGL\_ES\_API );  
&nbsp;&nbsp; &nbsp;const EGLint ctx\_attribs[] = {  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;EGL\_CONTEXT\_CLIENT\_VERSION, 1,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;EGL\_NONE  
&nbsp;&nbsp; &nbsp;};  
&nbsp;&nbsp; &nbsp;g\_context = eglCreateContext( g\_display, config, 0, ctx\_attribs );_  
  
_&nbsp;&nbsp; &nbsp;eglMakeCurrent( g\_display, g\_surface, g\_surface, g\_context );_  
  
_&nbsp;&nbsp; &nbsp;// GL\_OES\_texture\_cube\_map  
&nbsp;&nbsp; &nbsp;GLint size;  
&nbsp;&nbsp; &nbsp;glGetError();  
&nbsp;&nbsp; &nbsp;glGetIntegerv( GL\_MAX\_CUBE\_MAP\_TEXTURE\_SIZE\_OES, &size );&nbsp; // GL\_INVALID\_ENUM  
&nbsp;&nbsp; &nbsp;PrintGLError();_  
  
_&nbsp;&nbsp; &nbsp;// GL\_OES\_depth\_texture  
&nbsp;&nbsp; &nbsp;GLuint tex\_id;  
&nbsp;&nbsp; &nbsp;glGenTextures( 1, &tex\_id );  
&nbsp;&nbsp; &nbsp;glBindTexture( GL\_TEXTURE\_2D, tex\_id );  
&nbsp;&nbsp; &nbsp;glGetError();  
&nbsp;&nbsp; &nbsp;glTexImage2D( GL\_TEXTURE\_2D, 0, GL\_DEPTH\_COMPONENT, 1, 1, 0,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; GL\_DEPTH\_COMPONENT, GL\_UNSIGNED\_SHORT, NULL );&nbsp; // GL\_INVALID\_VALUE  
&nbsp;&nbsp; &nbsp;PrintGLError();_  
  
_&nbsp;&nbsp; &nbsp;eglMakeCurrent( g\_display, EGL\_NO\_SURFACE, EGL\_NO\_SURFACE, EGL\_NO\_CONTEXT );_  
  
_&nbsp;&nbsp; &nbsp;return 0;  
}_  
  
_/_ WM\_CLOSE _/  
LRESULT  
OnClose( HWND hwnd ) {  
&nbsp;&nbsp; &nbsp;eglDestroyContext( g\_display, g\_context );  
&nbsp;&nbsp; &nbsp;eglDestroySurface( g\_display, g\_surface );  
&nbsp;&nbsp; &nbsp;eglTerminate( g\_display );  
&nbsp;&nbsp; &nbsp;ReleaseDC( hwnd, g\_win\_dc );  
&nbsp;&nbsp; &nbsp;DestroyWindow( hwnd );  
&nbsp;&nbsp; &nbsp;return 0;  
}_  
  
_/_ WM\_DESTROY _/  
LRESULT  
OnDestroy() {  
&nbsp;&nbsp; &nbsp;PostQuitMessage( 0 );  
&nbsp;&nbsp; &nbsp;return 0;  
}_  
  
_/_ WM\_PAINT _/  
LRESULT  
OnPaint() {  
&nbsp;&nbsp; &nbsp;eglMakeCurrent( g\_display, g\_surface, g\_surface, g\_context );  
&nbsp;&nbsp; &nbsp;glClear( GL\_COLOR\_BUFFER\_BIT );  
&nbsp;&nbsp; &nbsp;eglSwapBuffers( g\_display, g\_surface );  
&nbsp;&nbsp; &nbsp;eglMakeCurrent( g\_display, EGL\_NO\_SURFACE, EGL\_NO\_SURFACE, EGL\_NO\_CONTEXT );  
&nbsp;&nbsp; &nbsp;return 0;  
}_  
  
_LRESULT CALLBACK  
WindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) {  
&nbsp;&nbsp; &nbsp;switch ( message ) {  
&nbsp;&nbsp; &nbsp;case WM\_CREATE:&nbsp; return OnCreate( hWnd );  
&nbsp;&nbsp; &nbsp;case WM\_CLOSE:&nbsp;&nbsp; return OnClose( hWnd );  
&nbsp;&nbsp; &nbsp;case WM\_DESTROY: return OnDestroy();  
&nbsp;&nbsp; &nbsp;case WM\_PAINT: {  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;PAINTSTRUCT ps;  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;BeginPaint( hWnd, &ps );  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;const LRESULT result = OnPaint();  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;EndPaint( hWnd, &ps );  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return result;  
&nbsp;&nbsp; &nbsp;}  
&nbsp;&nbsp; &nbsp;}_  
  
_&nbsp;&nbsp; &nbsp;return DefWindowProc( hWnd, message, wParam, lParam );  
}_  
  
_ATOM  
RegisterWindowClass() {  
&nbsp;&nbsp; &nbsp;WNDCLASSEX wcex = { (UINT)sizeof( WNDCLASSEX ) };_  
  
_&nbsp;&nbsp; &nbsp;wcex.style&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;= CS\_HREDRAW | CS\_VREDRAW;  
&nbsp;&nbsp; &nbsp;wcex.lpfnWndProc&nbsp;&nbsp; &nbsp;= &WindowProc;  
&nbsp;&nbsp; &nbsp;wcex.hInstance&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;= GetModuleHandle( NULL );  
&nbsp;&nbsp; &nbsp;wcex.hCursor&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;= LoadCursor( NULL, IDC\_ARROW );  
&nbsp;&nbsp; &nbsp;wcex.lpszClassName&nbsp;&nbsp; &nbsp;= WINDOW\_CLASS\_NAME;_  
  
_&nbsp;&nbsp; &nbsp;return RegisterClassEx( &wcex );  
}_  
  
_int  
main( int, char_[] ) {  
  
&nbsp;&nbsp; &nbsp;RegisterWindowClass();  
  
&nbsp;&nbsp; &nbsp;const HWND hwnd = CreateWindow( WINDOW\_CLASS\_NAME,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;“PowerVR Emurator Test”,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WS\_OVERLAPPEDWINDOW,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;CW\_USEDEFAULT, 0,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;320, 240,  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;NULL, NULL, GetModuleHandle( NULL ), NULL );  
&nbsp;&nbsp; &nbsp;ShowWindow( hwnd, SW\_SHOW );  
&nbsp;&nbsp; &nbsp;UpdateWindow( hwnd );  
  
&nbsp;&nbsp; &nbsp;MSG msg;  
&nbsp;&nbsp; &nbsp;while ( GetMessage( &msg, NULL, 0, 0 ) ) {  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;TranslateMessage( &msg );  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;DispatchMessage( &msg );  
&nbsp;&nbsp; &nbsp;}  
  
&nbsp;&nbsp; &nbsp;return (int)msg.wParam;  
}

---

<div class="post-metadata">

**Author:** ![jacekc](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@jacekc](https://forums.imgtec.com/u/jacekc)\
**Post date:** [November 29, 2010, 1:08pm UTC](https://forums.imgtec.com/t/error-in-opengl-es-1-1-context-on-sgx-profile/929/3 "2010-11-29T13:08:01Z")

</div>

Thank you for your report. We were able to reproduce the issue (BRN31932) and we will have it fixed for a next release
