Imagination PowerVR SDK Blog

non power of 2 pbuffer


#1

I am having problems creating a non-power of 2 pbuffer. Is this a limitation of the sgx?
I’m trying to create a 60x60 rgba texture – result BAD_MATCH.
64x64 texture works fine.



I’m running this on a beagleboard:


EGL_VERSION = 1.4 build 1.4.14.2616
EGL_VENDOR = Imagination Technologies
EGL_EXTENSIONS = EGL_KHR_image EGL_KHR_image_base EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_vg_parent_image EGL_IMG_context_priority
EGL_CLIENT_APIS = OpenGL_ES OpenVG



code:
  int i32BufferSize; // 32

  eglBindAPI(EGL_OPENGL_ES_API);

  eglQueryContext(EGLBeagleSystem::eglDisplay, ctx->eglContext, EGL_CONFIG_ID, &i32ConfigID);
  eglGetConfigAttrib(EGLBeagleSystem::eglDisplay,
               (EGLConfig) i32ConfigID,
               EGL_BUFFER_SIZE,
               &i32BufferSize);
 
  printf(“Buffer size=%i n”, i32BufferSize);


  EGLint pbufferConfigAttribs[] = {
    EGL_CONFIG_CAVEAT, EGL_NONE,
    /*
      Tell it the minimum size we want for our colour buffer and the depth size so
      eglChooseConfig will choose the config that is the closest match.
    */
    EGL_BUFFER_SIZE, i32BufferSize,
    EGL_DEPTH_SIZE, 0,
    // The PBuffer bit is the important part as it shows we want a PBuffer
    EGL_SURFACE_TYPE,         EGL_PBUFFER_BIT | EGL_PIXMAP_BIT,
    EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE,
    EGL_RENDERABLE_TYPE,      EGL_OPENGL_ES2_BIT,
    EGL_LEVEL,                0,
    EGL_NONE
  };

  EGLConfig eglPbufferConfig;

  int iConfigs;
  if (!eglChooseConfig(EGLBeagleSystem::eglDisplay,
                 pbufferConfigAttribs,
                 &eglPbufferConfig, 1, &iConfigs)){
    TestEGLError(“eglChooseConfig”);
    printf(“Error: eglChooseConfig() failed. line:%in”, LINE);
    cleanup();
    exit(1);
  }
 
  EGLint pbuf_attribs[15];
  int i = 0;

  pbuf_attribs[i++] = EGL_WIDTH;
  pbuf_attribs[i++] = width;
  pbuf_attribs[i++] = EGL_HEIGHT;
  pbuf_attribs[i++] = height;
  pbuf_attribs[i++] = EGL_TEXTURE_TARGET;
  pbuf_attribs[i++] = EGL_TEXTURE_2D;
  pbuf_attribs[i++] = EGL_TEXTURE_FORMAT;
  pbuf_attribs[i++] = EGL_TEXTURE_RGBA;
  pbuf_attribs[i++] = EGL_NONE;
 
  handle = eglCreatePbufferSurface(EGLBeagleSystem::eglDisplay, eglPbufferConfig, pbuf_attribs);

  if (!handle) {
    TestEGLError(“eglCreatePbufferSurface”);
    printf(“Error: eglCreatePbufferSurface failedn”);

    cleanup();
    exit(1);
  }