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:

 
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:


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:


  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

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 :stuck_out_tongue:

Giacomo

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.