error in OpenGL ES 1.1 context on SGX profile

This topic contains 2 replies, has 2 voices, and was last updated by  jacekc 6 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30376

    PenCyot3
    Member

    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.

      // Create context
      EGLint cfg_attribs[] = {
         EGL_LEVEL,            0,
         EGL_SURFACE_TYPE,     EGL_WINDOW_BIT,
         EGL_RENDERABLE_TYPE,  EGL_OPENGL_ES_BIT,
         EGL_RED_SIZE,         5,
         EGL_GREEN_SIZE,       5,
         EGL_BLUE_SIZE,        5,
         EGL_NONE
      };
      eglChooseConfig( g_display, cfg_attribs, &config, 1, &num_config );
      eglBindAPI( EGL_OPENGL_ES_API );
      EGLint ctx_attribs[] = {
         EGL_CONTEXT_CLIENT_VERSION, 1,
         EGL_NONE
      };
      eglCreateContext( g_display, config, 0, ctx_attribs );


    glGetString() gave back the following character string in this context.

      GL_VERSION: “OpenGL ES-CM 1.1”
      GL_VENDOR: “Imagination Technologies (Host GL: `NVIDIA Corporation`)”
      GL_RENDERER: “PowerVR PVRVFrame 7.2 SGX (Host GL: `GeForce 9800 GT/PCI/SSE2`) SDK Build: 2.07.27.0297”
      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).

    #34564

    PenCyot3
    Member

    // 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        g_win_dc;
    EGLDisplay g_display;
    EGLSurface g_surface;
    EGLContext g_context;

    #ifndef GL_DEPTH_COMPONENT
    #define GL_DEPTH_COMPONENT 0x1902
    #endif

    void
    PrintGLError() {
        const char* msg;
        switch ( glGetError() ) {
        case GL_NO_ERROR:                                        return;
        case GL_INVALID_ENUM:      msg = “GL_INVALID_ENUM”;      break;
        case GL_INVALID_VALUE:     msg = “GL_INVALID_VALUE”;     break;
        case GL_INVALID_OPERATION: msg = “GL_INVALID_OPERATION”; break;
        case GL_STACK_OVERFLOW:    msg = “GL_STACK_OVERFLOW”;    break;
        case GL_STACK_UNDERFLOW:   msg = “GL_STACK_UNDERFLOW”;   break;
        case GL_OUT_OF_MEMORY:     msg = “GL_OUT_OF_MEMORY”;     break;
        default:                   msg = “Unknown Error”;        break;
        }
        std::cerr << “GL Error: ” << msg << std::endl;
    }

    /* WM_CREATE */
    LRESULT
    OnCreate( HWND hwnd ) {

        // Initialize EGL
        g_win_dc  = GetDC( hwnd );
        g_display = eglGetDisplay( g_win_dc );

        EGLint major, minor;
        if ( !eglInitialize( g_display, &major, &minor ) )
            return 1;

        // Choose config
        const EGLint cfg_attribs[] = {
            EGL_LEVEL,            0,
            EGL_SURFACE_TYPE,     EGL_WINDOW_BIT,
            EGL_RENDERABLE_TYPE,  EGL_OPENGL_ES_BIT,
            EGL_RED_SIZE,         5,
            EGL_GREEN_SIZE,       5,
            EGL_BLUE_SIZE,        5,
            EGL_NONE
        };
        EGLConfig config = 0;
        int   num_config;
        if ( !eglChooseConfig( g_display, cfg_attribs, &config, 1, &num_config ) || (num_config < 1) )
            return 1;

        // Create surface
        const EGLint surf_attribs[] = {
            EGL_NONE
        };
        g_surface = eglCreateWindowSurface( g_display, config, hwnd, surf_attribs );

        // Create context
        eglBindAPI( EGL_OPENGL_ES_API );
        const EGLint ctx_attribs[] = {
            EGL_CONTEXT_CLIENT_VERSION, 1,
            EGL_NONE
        };
        g_context = eglCreateContext( g_display, config, 0, ctx_attribs );

        eglMakeCurrent( g_display, g_surface, g_surface, g_context );

        // GL_OES_texture_cube_map
        GLint size;
        glGetError();
        glGetIntegerv( GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES, &size );  // GL_INVALID_ENUM
        PrintGLError();

        // GL_OES_depth_texture
        GLuint tex_id;
        glGenTextures( 1, &tex_id );
        glBindTexture( GL_TEXTURE_2D, tex_id );
        glGetError();
        glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 1, 1, 0,
                      GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL );  // GL_INVALID_VALUE
        PrintGLError();

        eglMakeCurrent( g_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );

        return 0;
    }

    /* WM_CLOSE */
    LRESULT
    OnClose( HWND hwnd ) {
        eglDestroyContext( g_display, g_context );
        eglDestroySurface( g_display, g_surface );
        eglTerminate( g_display );
        ReleaseDC( hwnd, g_win_dc );
        DestroyWindow( hwnd );
        return 0;
    }

    /* WM_DESTROY */
    LRESULT
    OnDestroy() {
        PostQuitMessage( 0 );
        return 0;
    }

    /* WM_PAINT */
    LRESULT
    OnPaint() {
        eglMakeCurrent( g_display, g_surface, g_surface, g_context );
        glClear( GL_COLOR_BUFFER_BIT );
        eglSwapBuffers( g_display, g_surface );
        eglMakeCurrent( g_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
        return 0;
    }

    LRESULT CALLBACK
    WindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) {
        switch ( message ) {
        case WM_CREATE:  return OnCreate( hWnd );
        case WM_CLOSE:   return OnClose( hWnd );
        case WM_DESTROY: return OnDestroy();
        case WM_PAINT: {
            PAINTSTRUCT ps;
            BeginPaint( hWnd, &ps );
            const LRESULT result = OnPaint();
            EndPaint( hWnd, &ps );
            return result;
        }
        }

        return DefWindowProc( hWnd, message, wParam, lParam );
    }

    ATOM
    RegisterWindowClass() {
        WNDCLASSEX wcex = { (UINT)sizeof( WNDCLASSEX ) };

        wcex.style            = CS_HREDRAW | CS_VREDRAW;
        wcex.lpfnWndProc    = &WindowProc;
        wcex.hInstance        = GetModuleHandle( NULL );
        wcex.hCursor        = LoadCursor( NULL, IDC_ARROW );
        wcex.lpszClassName    = WINDOW_CLASS_NAME;

        return RegisterClassEx( &wcex );
    }

    int
    main( int, char*[] ) {

        RegisterWindowClass();

        const HWND hwnd = CreateWindow( WINDOW_CLASS_NAME,
                                        “PowerVR Emurator Test”,
                                        WS_OVERLAPPEDWINDOW,
                                        CW_USEDEFAULT, 0,
                                        320, 240,
                                        NULL, NULL, GetModuleHandle( NULL ), NULL );
        ShowWindow( hwnd, SW_SHOW );
        UpdateWindow( hwnd );

        MSG msg;
        while ( GetMessage( &msg, NULL, 0, 0 ) ) {
            TranslateMessage( &msg );
            DispatchMessage( &msg );
        }

        return (int)msg.wParam;
    }

    #34565

    jacekc
    Member

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

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.