Pixmap Difficulties

Archives Forums/BlitzMax Bug Reports/Pixmap Difficulties

Mordax_Praetorian(Posted 2008) [#1]
I've been having difficulties with Pixmaps in my game engine, so I decided to try isolating different parts of the code to figure out what was causing it

the following does nothing (I get a black window):
Graphics(800,600,0,0)
TestPix:TPixmap=CreatePixmap(15,15,PF_RGBA8888)
White% = (255 Shl 24)|(255 Shl 16)|(255 Shl 8)|255
Black% = (0 Shl 24)|(0 Shl 16)|(0 Shl 8)|0
For X = 0 To 14
	For Y = 0 To 14
		WritePixel(TestPix,X,Y,Black)
	Next
Next
WritePixel(TestPix,0,0,White)
WritePixel(TestPix,0,14,White)
WritePixel(TestPix,14,0,White)
WritePixel(TestPix,14,14,White)
DrawPixmap(TestPix,200,200)
Flip
Delay(4000)


This makes no sense to me, there should be 4 white pixels there and there arent

The documentation is as always, utterly useless

What is the deal with pixmaps? how do I get them to actually show up? what is the mysterious command that I'm somehow missing here?


Jesse(Posted 2008) [#2]
it works fine here:
windows xp sp2
AMD Athlon 64 x2 dual 4200+
Nvidia GeForce 7300GT
Bmax 1.28

what is your system specs?


Mordax_Praetorian(Posted 2008) [#3]
I'm on:

Windows Vista Sp1 (No I don't like it and I'm saving up for an XP CD)
Intel Core2 Duo
NVIDIA GeForce 8600M
Bmax 1.28


Jesse(Posted 2008) [#4]
to be honest, I think, even though I don't like it either, BRL needs to do something about this or we will be programming a dinosaur pretty soon. :-).
And I don't think the next operating system is going to make it any easier either.


Mordax_Praetorian(Posted 2008) [#5]
Ok, so Pixmaps don't work on Vista?

Can I get around this by making them into images after construction?


Jesse(Posted 2008) [#6]
.


Jesse(Posted 2008) [#7]
you can allways try.
image:timage = loadimage(pixmap:tpixmap)


Mordax_Praetorian(Posted 2008) [#8]
I suppose, thankyou for the help

I envy other countries where XP is still the norm, but its nearly impossible to get a new comp with it in this country anymore

Sadly since I'm mostly programming with other people in my country and will likely have an initial player base comming mostly from here, I must keep Vista in mind


Azathoth(Posted 2008) [#9]
Using PF_BGRA8888 gets it working here


TomToad(Posted 2008) [#10]
Interesting. Azathoth, what OS are you using?
I'm using Vista sp1 and PF_RGBA8888 isn't working but PF_BGRA8888 is working.
But I am also using a GeForce 8800 GT. I've noticed that those who are not getting it to work are all using 8000 series GeForce cards.
Fact is, BMax is still using DirectX 7, possibly 8000+ cards are not fully compatible with it.
The only way to tell is to try it on Vista machines with other cards (ATI and < 8000 NVidias) and also try it on non-vista machines with 8000+ cards.


grable(Posted 2008) [#11]
I have an 8800GT and using XP SP2, both pixel formats work for me.


SebHoll(Posted 2008) [#12]
I've just tried on my Vista x86 PC, which has a nVidia 7600GTS Go graphics card. Works perfectly when using OpenGL, but DirectX doesn't work - it seems as though the pixmap isn't drawn.


dawlane(Posted 2008) [#13]
PF_RGBA8888 doesn't work here, but PF_BGRA8888 does. But using GLMax2DDriver with PF_RGBA8888 works.
It could be a DirectX/Driver issue.

Fact is, BMax is still using DirectX 7, possibly 8000+ cards are not fully compatible with it.

I had a game quite a few years ago that worked well with DX5/6 but screwed the sound up something terrible when used with DX7. MS have a habbit of breaking Directx once in a while.

OS Vista Ultimate 32bit
nVidia 8800 Ultra
Current Driver is 175.16
DirextX 10


SebHoll(Posted 2008) [#14]
I've stepped through the code and it's the...

surf.GetDC(srcdc)
...in d3d7max2d.bmx which seems to be causing the trouble as it is giving simply 0 as the DC for alpha pixmaps.

Although it seems that Microsoft have removed a lot of their DirectX 7 docs from MSDN, the following page refers to the DirectX 9 equivalent:

http://msdn.microsoft.com/en-us/library/bb205894(VS.85).aspx

This might be our problem:
Formats that contain Alpha are not supported because the GDI implementations don't have a well-defined behavior on the alpha channel.

Although, that doesn't really explain why it's working on Windows XP but not Vista.


Mordax_Praetorian(Posted 2008) [#15]
Perhapse something to do with DX10 which XP (as far as I'm aware) doesn't support?


Yahfree(Posted 2008) [#16]
works for me..

NVIDIA 9600 GT Video card, windows XP OS, P4 3GHz processer


impixi(Posted 2009) [#17]
I've just encountered this bug myself (or something similar). Vista (64bit), Nvidia GeForce GTS 250, latest certified drivers. BlitzMax 133rc5.

DrawPixmap fails to display anything in DirectX but works as expected in OpenGL.

Example:



The workaround is to load the pixmap into an image and use drawimage instead of drawpixmap.


_Skully(Posted 2009) [#18]
or...

Graphics(800,600,0,0)
Global img:TImage=CreateImage(15,15,,DynamicIMAGE|maskedimage)   
TestPix:TPixmap=CreatePixmap(15,15,PF_RGBA8888)
White% = (255 Shl 24)|(255 Shl 16)|(255 Shl 8)|255
Black% = (0 Shl 24)|(0 Shl 16)|(0 Shl 8)|0
For X = 0 To 14
	For Y = 0 To 14
		WritePixel(TestPix,X,Y,black)
	Next
Next
WritePixel(TestPix,0,0,White)
WritePixel(TestPix,0,14,White)
WritePixel(TestPix,14,0,White)
WritePixel(TestPix,14,14,White)

DrawPixmap(TestPix,200,200)
img.SetPixmap(0,testpix)
DrawImage img,216,200

Flip
Delay(4000)


setpixmap might be faster than loadimage...

I only get the right hand box... vista


Brucey(Posted 2009) [#19]
I don't recommend using DrawPixmap anyway. It's generally very slow in OpenGL because of the way drivers implement glDrawPixels.

DrawImage FTW :-p


impixi(Posted 2009) [#20]
I agree Brucey, but DrawPixmap is a BlitzMax command and it should perform error-free in all cases. Personally, I'd never use it for performance-critical applications, either. :)


Brucey(Posted 2009) [#21]
I google search reveals people have all kinds of issues using glDrawPixels() on different hardware. The same code will work on one card, but not on another...

eg.

http://stackoverflow.com/questions/25646/what-could-prevent-opengl-gldrawpixels-from-working-on-some-video-cards