Skip to main content
GameDev.net gamedev.net
🔒 Locked

Using P-Buffer in OpenGL ES

Started by bennyW Jan 15, 2006 at 11:51 AM 0 replies 7.8k views
Original Post
bennyW
bennyW
Anyone have a good resources or tutorials on how to render to a pbuffer in using OpenGL ES 1.1? I found so examples on how to do with with regular OpenGL, unfortunately OpenGL ES has a slightly different interface in some cases. In my little demo, I'm just trying to clear the texture, then render it on a quad as a starting point. However, the texture instead contains the contents of the frame-buffer. Any ideas? I guess posting some of my code would be helpful, which I can tomorrow if needed. Thanks, BennyW
bennyW
bennyW
Ok, so here's that code. OpenGL ES looks a little different, but I figure the problem may still stand out to some of yall.

So here I'm allocating a pbuffer surface and a texture that I plan to use it with:

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 pbuffer to be the current render target, clear it to red (just to see if it works), then switch it 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);


Finally, I just want to render a quad with my new texture (which should be red):

eglBindTexImage(platformBase->gEglDisplay, g_PBuffer, pbufferTexture); glBindTexture(GL_TEXTURE_2D, pbufferTexture);


If anyone could tell me where (or if) I've screwed up, I'd much appreciate it.

Thanks,
BennyW

edit:Added source tags

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.