(GL) Pixel Buffer Objects

Blitz3D Forums/Blitz3D Programming/(GL) Pixel Buffer Objects

AntonyWells(Posted 2004) [#1]
Strictly speaking, this is blitz related, it's being wrote in vC+/blitz for blitz...and I'm not about to sign up to another forum just to ask one question...
-

Any one here have any expiance with the gl extension pixel buffer objects? It's a brand new (nvidia/ati) extension to vertex buffer objects.
In that it lets you upload and use video/agp memory for image/pixel data, so that when you call glDrawPixels, it's renders from an offset of that. I.e, no more slow system memory to agp transfers.

HArdware accelerated 2d right? Wrong. I have coded, all working. The engine can dynamically switch between regular sys mem blits and agp memory blits.

Blitting one images with regular slow memory I get 160fps. This is to be expected as it's generally accepted 2d is slow in gl, using native methods.

Blitting the same image with vid mem/pixel buffers, I get 60fps.

Yet, vertex buffer objects are working fine, and fast.

Is it because they are a recent(march 04) addition to the drivers? I do have 60x series nvidia drivers(I know a guy who knows a guy.) and I figured it's basically going to work fine on a g5...

but is it something only really suitible for the new gpus? Seems silly if so..i mean it's only memory management..

(Btw, pixel buffers are not pbuffers)

Any ideas? I know quite a few gl programmers reside around here....

Here's the code I use to upload the image,

glGenBuffersObj(1,tempBank)
		out\pBufId=PeekInt(tempBank,0)
		
		glBindBufferObj(GL_PIXEL_PACK_BUFFER_ARB,tempBank)
		glBufferDataObj(GL_PIXEL_PACK_BUFFER_ARB,BankSize(out\rgba),out\rgba,GL_DYNAMIC_DRAW_ARB)
		glBindBufferObj(GL_PIXEL_PACK_BUFFER_ARB,0)
(The function names are slightly diff from gl because I'm calling these in blitz using a wrapper. It's linking directly to the gl func though, so that's not the cause.)

and the code to blit the image

Function glDrawImage(image,x,y)
	glFlatScreen()
	img.image=Object.image(image)
	glRasterPos2i x,GraphicsHeight()-(y+img\h)
	If img\pBufId
		glBindBufferObj(GL_PIXEL_UNPACK_BUFFER_ARB,img\pBufId)
		glDrawPixels2 img\w,img\h,GL_RGB,GL_UNSIGNED_BYTE,0
		glBindBufferObj(GL_PIXEL_UNPACK_BUFFER_ARB,0)
	Else
		glDrawPixels img\w,img\h,GL_RGB,GL_UNSIGNED_BYTE,img\rgba
	EndIf
	
	glProject()
End Function



drawpixels2 is just drawpixels1, but it accepts an integer(offset) instead of a blitz bank, like the first one. still calls drawpixels without any linking, so again that can't be the problem.


Dreamora(Posted 2004) [#2]
I have never gotten over OpenGL 1.5 but is it possible that PixelBuffer need a specific extension activated?

why should it be silly if it's only for new GPUs?
It is the same as with extended vertexbuffers which only really work on GF3 upwards. PixelBuffer sounds like even more advanced and a subsystem of pixelbuffer management