Graphics command and pixmaps.

BlitzMax Forums/BlitzMax Programming/Graphics command and pixmaps.

tonyg(Posted 2006) [#1]
The graphics command for DX driver seems to lead to the creation of a pixmap and then a huge number of writepixel and pixelptr commands. There are then lots
of pixelptr and pixmap jiggery-pokery that goes on.
At first I thought it was writing a pixel for each pixel i the screen res but it still has a HUGE number even for a 10*10 screen.
Does anybody know why this happens?


skidracer(Posted 2006) [#2]
You mean the CreateFrameFromPixmap method which is used to transfer an image's pixels into a dx7 texture using the rather long winded pixmap.paste command?

I'd be happy to explain further if that is indeed what you mean.

I don't see any other pixel pushing in either d3d7 driver that you could be referrring to.


ImaginaryHuman(Posted 2006) [#3]
Maybe it is resizig a pixmap which is pretty involved?


Dreamora(Posted 2006) [#4]
10x10 screen: Don't think this can even be created. There are some minimum sizes of a 3D canvas that can be created, on actual cards 640x480 or even 800x600.


tonyg(Posted 2006) [#5]
FYI, I've added simple debug statements to certain modules (Graphics, max2d, driver, d3d7max2d, d3d7graphics, dxgraphics) when a function/method is entered/exited.
@skidracer, This seems to be a createpixmap method then multiple (I many lots and lots) or writepixel/pixelptr commands.
@AngleDaniel, possibly but I haven't loaded anything at this point. All my program contains is 'Graphics 10,10'
@Dreamora, same thing happens with 800*600 or whatever. I used 10*10 incase the writepixel were related to the graphics screen created. There are more than 100 and it's a writepixel(x,y) loop.
.
It's possible the writepixels are called from Imagefont.bmx Function CreateDefault:TImageFont()
		Local pixmap:TPixmap=TPixmap.Create( 96*8,16,PF_RGBA8888 )
		
		Local p:Byte Ptr=IncbinPtr( "blitzfont.bin" )
	

		For Local y=0 Until 16
			For Local x=0 Until 96
				Local b=p[x]
				For Local n=0 Until 8
					If b & (1 Shl n) 
						pixmap.WritePixel x*8+n,y,~0
					Else
						pixmap.WritePixel x*8+n,y,0
					EndIf
				Next
			Next
			p:+96
		Next

so I'll add my debug statements to this file as well and check.
I'll also trace the GL graphics set-up.


tonyg(Posted 2006) [#6]
It is Imagefont,bmx createdefault function.
I can't pretend I understand this stuff but we seem to be building the default font from this .bin file using writepixel. Why is this?
Same code is run for OGL of course.
However, I've noticed when using setgraphicsdriver glmax2ddriver() the code still runs through the DX7 enumerator.
I'm not sure how much it matters but a bit curious.
<edit>
Hmmm
When an image is loaded it creates a TImage but also a TPixmap. When Drawimage it seems to create a staticpixmap, convert each pixel, get a byte ptr to each pixel and paste it into the imageframe before displaying. Is this normal?