Problem with DrawPixmap

Archives Forums/BlitzMax Bug Reports/Problem with DrawPixmap

TomToad(Posted 2012) [#1]
Version 1.48

Graphics 800,600

Local Pixmap:TPixmap = LoadPixmap(RequestFile("Pixmap"))

While Not KeyHit(KEY_ESCAPE)
	DrawPixmap Pixmap,10,10
	Flip
Wend

Sometimes when I run the above, I get this error at the DrawPixmap line
D3DERR: Unable to lock render target surface

Other times it works fine, even when selecting the exact same image.

Windows 7 home Premiuim 64 bit SP 1
NVidia GeForce 8800 GT
AMD Phenom 9550 Quad Core 2.20 GHz
6 gig memory
All drivers up to date.

Last edited 2012


Midimaster(Posted 2012) [#2]
As I remember... the graphic screen has to be bigger than a PIXMAP.
You do not have such problems with IMAGE instead of PIXMAP


TomToad(Posted 2012) [#3]
ok, it seems if the image extends beyond the edge of the graphics screen, one of 3 things happen. In DirectX 9, the call will either fail or succeed depending on some unknown force. In DirectX 7, nothing is drawn, but no error is produced. In OpenGL, the function works as expected with the portion of the image outside the screen being cut off.
When the image is completely within the borders of the screen, one of two things happen. OpenGL and DirectX 9 draws as expected. DirectX 7 still produces a blank screen.

'SetGraphicsDriver GLMax2DDriver()
SetGraphicsDriver D3D7Max2DDriver()
'SetGraphicsDriver D3D9Max2DDriver()
Graphics 800,600

Local Pixmap:TPixmap = CreatePixmap(64,64,PF_RGBA8888)

For Local x:Int = 0 To 63
	For Local y:Int = 0 To 63
		WritePixel(Pixmap,x,y,$ff000000+(Int(Sin(x)*255) Shl 16)+(Int(Sin(y)*255) Shl 8)+(Int(Sin(x+y)*255)))
	Next
Next

While Not KeyHit(KEY_ESCAPE)
	DrawPixmap Pixmap,10,10
	Flip
Wend