Incbin fails for Pixmaps and DX driver

Archives Forums/BlitzMax Bug Reports/Incbin fails for Pixmaps and DX driver

AdamRedwoods(Posted 2011) [#1]
Strange little error, frustrating: (Bmax 1.38, win7x64) (also Bmax 1.42)


SuperStrict

SetGraphicsDriver D3D7Max2DDriver()
'SetGraphicsDriver GLMax2DDriver()
Graphics( 640,480 )

Incbin "icon_folder_sm.jpg"

Local p1:TPixmap = LoadPixmap("incbin::icon_folder_sm.jpg")
'Local p1:TImage = LoadImage("incbin::icon_folder_sm.jpg")

Print p1.width
Repeat
	Cls
	SetColor 255,255,255
	'DrawImage p1,10,10
	DrawPixmap p1,10,10
	
	DrawRect 50,50,5,5
	
	Flip
	
	WaitEvent()
	If AppTerminate() Then End
Forever


This won't display the Pixmap on my system, unless I use either a) GL drivers or b) TImage.

Last edited 2011

Last edited 2011


GfK(Posted 2011) [#2]
Your main loop is odd. repeat...until appterminate() would be more sensible plus you wouldn't need waitevent.

Try that. on my phone atm so can't check it out myself.


GfK(Posted 2011) [#3]
Just managed to get on me PC for a few minutes - getting the same behaviour here.

But it gets weirder still. If I change to DX9 instead of DX7 I get this in debug output:
D3DERR: Unable to lock render target surface

I've done a little digging and get the same problem even if I don't use Incbin, so it seems there is a problem with DrawPixmap.
SuperStrict

SetGraphicsDriver D3D9Max2DDriver()
'SetGraphicsDriver D3D7Max2DDriver()
'SetGraphicsDriver GLMax2DDriver()
Graphics( 640,480 )

Local p1:TPixmap = LoadPixmap("icon_folder_sm.jpg")

Print p1.width
Repeat
	Cls
	SetColor 255,255,255
	'DrawImage p1,10,10
	DrawPixmap p1,10,10
	
	DrawRect 50,50,5,5
	
	Flip
Until AppTerminate()



SLotman(Posted 2011) [#4]
No problem here - but I'm on bmax 1.28 (extremely modded everything superstrict by me version hehehe).

On all 3 drivers (dx9, dx7 and ogl) no error at all. With or without incbin.

Are you loading images with power of 2? Maybe that's the problem...

Edit: hmmm, no. Trying image with 57x59 and it still worked. Maybe you guys should download older versions and try them one by one to see where the problem appears?

Last edited 2011


GfK(Posted 2011) [#5]
No problem here - but I'm on bmax 1.28 (extremely modded everything superstrict by me version hehehe).

On all 3 drivers (dx9, dx7 and ogl) no error at all. With or without incbin.
...that sort of reinforces what I was already thinking; that the introduction of BRL's native DX9 module could be where the problem started - its just that folks don't normally use DrawPixmap so that's why nobody noticed for so long.

If you've tested on DX9 in Blitzmax 1.28 then you must be using Doug Stastny's DX9 module, as the official one didn't appear til 1.35.

Are you loading images with power of 2? Maybe that's the problem...
I tested it with as 512x512 image.


Zeke(Posted 2011) [#6]
works fine if image is smaller than window. like 512x512 image and Graphics 640,480 =>crash, but using Graphics 800,600 works fine.
[EDIT] thats not all. DX9 crash if you try to draw out of window area. like DrawPixmap pixmap,-10,0, dx7 works out of area draws. but crash(not drawn) if image is larger than window)

Last edited 2011