Skip to main content
gamedev.net
🔒 Locked

Pixel Buffer Hell Question

Started by fathom88 0 replies 400+ views
Original Post
fathom88
fathom88
I managed to find a tutorial on pixel buffers from ATI. I want to use it to copy my rendering to a texture and then using this texture to display my scene. I think the texture creation and the p-buffer creation is OK. Here is what I do currently: RenderScene() { wglMakeCurrent(pBufDC, pBufContext); glEnable(GL_TEXTURE_2D); glClear(...); glBindTexture(GL_TEXTURE_2D, mPBuffTex); wglBindTexImageARB(pBuf, WGL_FRONT_LEFT_ARB); DrawStuff() // using simple glBegin glEnd etc to draw stuff glBindTexture(GL_TEXTURE_2D, 0); } This function renders to a p-buffer except to screen. To get to the screen, I do this. DrawToScreen() { wglMakeCurrent(windowDC, windowContext); glBindTexture(GL_TEXTURE_2D, mPBuffTex); glBegin(GL_QUADS); glTexCoord2d(0.0, 1.0); glVertex2d(-1.0 * width, height); glTexCoord2d(1.0, 1.0); glVertex2d(width, height); glTexCoord2d(1.0, 0.0); glVertex2d(width, -1.0 * height); glTexCoord2d(0.0, 0.0); glVertex2d(-1.0 * width, -1.0 * height); glEnd(); glBindTexture(GL_TEXTURE_2D, 0); SwapBuffers(windowDC); } I draw a big rectangle with the rendered image textured to it. I think my problem is in loading the texture. I've used this code to map a texture to a rectangle before. I wish I could use frame buffers :( P-Buffers really stink. I don't want to use copy pixels because I hear it's slow and window apps have problems when overlapping. Thanks for any help.
zedzeek
zedzeek
Quote:
I don't want to use copy pixels because I hear it's slow

u heard wrong
from testing updating a texture from the framebuffer ie glCopyTexSubIamge..(...)
is only ~5% slower than using FBO, this is with benchmark in a real app the difference will be even less

Topic Locked

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

Sign in to reply to this topic.