Results 1 to 2 of 2

Thread: Rendering to PBuffer

  1. #1
    Junior Member
    Join Date
    Jan 2006
    Posts
    1

    Rendering to PBuffer

    Hello, I'm new to OpenGL ES, so please bear with me.

    I'm trying to render to a p-buffer and use it to texture the wall in the Chameleon Man demo that came with the SDK.

    So I create my p-buffer and a texture to bind it with like this:
    Code :
    EGLint conflist[] = {EGL_WIDTH, 512, EGL_HEIGHT, 512, EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA, EGL_TEXTURE_TARGET, EGL_TEXTURE_2D, 
    EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE, EGL_NONE}; 
     
     
    g_PBuffer = eglCreatePbufferSurface(platformBase->gEglDisplay, platformBase->gEglConfig, conflist); 
     
    	glGenTextures(1, &pbufferTexture);
    	glBindTexture(GL_TEXTURE_2D, pbufferTexture);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    Then I set my p-buffer as my render target like so and just clear it to red, then switch back:
    Code :
    eglMakeCurrent(platformBase->gEglDisplay, g_PBuffer, g_PBuffer,platformBase->gEglContext);
     
    myglClearColor(f2vt(1.f), f2vt(0.f), f2vt(0.5f), f2vt(0));
       eglMakeCurrent(platformBase->gEglDisplay, platformBase->gEglWindow, platformBase->gEglWindow, platformBase->gEglContext);

    And finally when I want to use it as my texture I do this:
    Code :
      eglBindTexImage(platformBase->gEglDisplay, g_PBuffer, pbufferTexture);
     
    glBindTexture(GL_TEXTURE_2D, pbufferTexture);

    I'm just getting all black for my texture, instead of the red color I cleared to. Is there anything glaringly wrong about my set-up? Or perhaps I'm missing something.

    My apologies if I'm missing something really simple, I'm new to this api and really have been having a hard time finding info. If anyone knows any good tutorials and sites, I'd love to check them out.

    Thanks,
    Benny

  2. #2
    Junior Member
    Join Date
    Sep 2006
    Posts
    4
    Hi all guys, this is an old topic but actually I have to solve a problem with pBuffer too.
    I'm testing a subset of OpenGL ES, developed for an hw used in my company. This subset offers many functions offered by OpenGL ES, like the possibility to use pBuffer, but it doesn't offer the eglBindTexImage function.
    My question is: there is another way to use the pBuffer as texture (I need this feature) without using eglBindTexImage?

    If it is not possibile, the solution proposed by bennyW is the right one? I have to write a code like the benny code to use pBuffer as texture?

    Thanks for your help guys :P

    Giacomo

Similar Threads

  1. Off screen rendering buffer - PBuffer understanding
    By meghakolombkar in forum Cross API and window system integration
    Replies: 1
    Last Post: 01-16-2011, 02:49 AM
  2. Pbuffer
    By jpsml in forum OpenGL ES general technical discussions
    Replies: 0
    Last Post: 11-10-2005, 08:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •