Need a test with this...

BlitzMax Forums/BlitzMax Beginners Area/Need a test with this...

hub(Posted 2006) [#1]
[EDIT]
I've modified the code to use the Dreamora/ GeoffTheGyratingGiraffe DrawImageArea function
to correct the bug on old machine, so
so could you test this :
http://www.bayre.com/zigwigwis/test_griffe_2.exe

Many thanks

[/EDIT]



Hi !
i need to know if it works fine for you.
you should have this. ie nothing inside the red square !



Here the link :
http://www.bayre.com/zigwigwis/test_griffe.exe

Many thanks for you help !!! Please post also you config.

if someone could also test this with an old pc configuration (geforce 2) it should be interesting for me to know it there is a bug or not !


Diablo(Posted 2006) [#2]
works fine here.


SebHoll(Posted 2006) [#3]
Tried it on an old Windows 2000 laptop (750Mhz, 256MB RAM, 11MB Onboard Graphics) and the red square is visible but there is no image behind it at all. Was it included in the EXE? I.e. IncBin


WendellM(Posted 2006) [#4]
Looks like screenshot above on my AMD XP 3000+ with Win XP Pro SP2 and Radeon 9600 Pro. Animated "blue blades" extend and retract while image inside red square remains unchanged.


Booticus(Posted 2006) [#5]
Same as Wendell, works fine here. Animation and everything. Good stuff!


hub(Posted 2006) [#6]
Thanks for the tests !

@seb : its confirms that this code using classic bmax viewport to simulate the blitzbasic drawimagerect doesn't work on old machines. Yes graphics images are include into the exe. i suppose that this function doesn't work too on your old pc :

Function DrawImageRectClip(image:TImage, x#, y#, rx#, ry#, rw#, rh#, frame=0)
	Local vx, vy, vw, vh, hx#, hy#
	
	hx# = image.handle_x
	hy# = image.handle_y
	SetImageHandle image, 0, 0
	GetViewport(vx, vy, vw, vh)
	SetViewport x#, y#, rx# + rw#, ry# + rh#
	
	DrawImage image, x# - rx#, y# - ry#, frame
	
	SetViewport vx, vy, vw, vh
	SetImageHandle image, hx#, hy#
End Function



undomiel(Posted 2006) [#7]
Didn't work here, the up-down spikies would go into the red box while the side-side spikies would be clipped by the red box. So that definitely confirms your bug!

P3 933 XP SP2 768 MB RAM GeForce 2 GTS w/ 32 MB


Dreamora(Posted 2006) [#8]
There are enough functions in the code archives that use the correct way to draw image rects like old Blitz did (by using UV coords that are reset to the right values before the function is left)

Using viewport is a strange and unlogical hack ...


TartanTangerine (was Indiepath)(Posted 2006) [#9]
BMAX viewports are just clipping rects, they will do the job but it's not the most elegant and does involve overhead you could do without.


Yan(Posted 2006) [#10]
He was already offered a UV routine but wanted a solution that *only* used the standard Max2D commands!

[edit]
Edited to satisfy Dreamora's pedantic side. ;oP
[/edit]


Dreamora(Posted 2006) [#11]
ok

Although UV only uses Max2D commands as well, but only OOP commands and not procedural commands.
You don't need to modify the module to get the desired results.


hub(Posted 2006) [#12]
Many thanks for your tests. it's true that i prefer use standard max2d commands ;-) GeoffTheGyratingGiraffe
have posted a link to dreamora code ( http://www.blitzbasic.com/codearcs/codearcs.php?code=1422 ) in another topic. Is Dreamora code works with mac, windows and linux ? i don't understand too how to use it with my project (you know... i don't use framework !)


Blitzer101(Posted 2006) [#13]
>Didn't work here, the up-down spikies would go into >the red box while the side-side spikies would be >clipped by the red box. So that definitely confirms your >bug!

Does exactly the same here, but I also found the I could not close the window after trying it and had to resort to Ctrl+alt+del and force it to it as a task.

Comp Spec...

Win98se, 800mhz AMD Athlon, 256mb ram, GeForce gfx, Soundblaster snd card. HTH.


Dreamora(Posted 2006) [#14]
I updated the code with a little commented description on what the parameters mean.

You only need to put the code into a bmx and include it or even just put it into one of your existing BMX files.


hub(Posted 2006) [#15]
@dreamora : i paste your code into my bmx file. and i've an error : "identifier 'TDX7ImageFrame not found"


Dreamora(Posted 2006) [#16]
I updated the code. Some BM stuff changed.

Added the possibility to specify the drawing size of the image part as well.

Hope the description is understandable.


hub(Posted 2006) [#17]
Thanks Dreamora. You should also translate this into english :

Assert l < image.width Else "l muss kleiner als die Bildbreite sein"
Assert t < image.height Else "t muss kleiner als die Bildhöhe sein"

i'll test your code tomorrow.


Dreamora(Posted 2006) [#18]
good input


undomiel(Posted 2006) [#19]
Assert l < image.width Else "l must be less than the image's width"
Assert t < image.height Else "t must be less than the image's height"

Unless my german is too rusty.


Dreamora(Posted 2006) [#20]
yes that would be right. But I removed it so you can now even create repeating structures and mirrored repeating structures.


hub(Posted 2006) [#21]
Hi !
with Dreamora function... the image auto scale to the drawrect size ? How to not deform the image ?
Thanks
(note i invert some params into the dreamora function declaration)






Yan(Posted 2006) [#22]
Dreamora's routine doesn't seem to take power of two texture rescaling into account?

I've fixed the scaling thing, pulled out the dx and dy as they seemed a bit pointless to me, renamed the variables and slapped in some compiler directives for good measure...



Dreamora(Posted 2006) [#23]
the dw, dh had a reason:

l,t and h,w define the rect on the image you want to draw.

x,y defines the position for the rect
dw,dh define the size of the image when you draw it.

The reason I added those: What if you have a 512x512 image you split up to 128x128 subimages. But for some reason you want to draw them in 80x60 or something similar? Without dw and dh, you can't do that. That's why I added them. If you want to draw it in 1:1 scale, you can still set w,h and dw,dh to the same value.

And the power of two: why should this be of interest? You don't need power of two if you draw subparts of a texture. There is no reason to enforce it. (the image will be as whole within VRAM and thus be power of 2 as it was loaded through BMs routines)


Yan(Posted 2006) [#24]
Yeah, I can read code thanks...I was probably a bit harsh when I said pointless, just not used that often generally and I was thinking more about compatibility with classic Blitz commands. It'd be easy enough to add them back and setting them to default to rw and rh.

the image will be as whole within VRAM and thus be power of 2 as it was loaded through BMs routines
Precisely! The UV settings have to take that into account, where as Image.width and Image.height do not.


Dreamora(Posted 2006) [#25]
Why should the UV have to take that into account?
There is no reason for it.
I did not create a DrawImageArea function to be forced to power of 2 subimages once again. That would be totally pointless! If you want that, you could have used loadanimimage which already does work that way and would be faster as image frames are seperate images.

The target of the function is to draw any arbitary subimage of an image to any arbitary area on the screen. For everything else, BM has the needed functionality as part of Max2D


Yan(Posted 2006) [#26]
Oh dear...Have you even tried your own code?...

Using this image, I get this.


Dreamora(Posted 2006) [#27]
ok. in that case its really needed. .width / .height don't work as they should, they don't have the real image width/height saved of the image that is held in VRAM ... thats plain crap but ok.

Thanks for mentioning that. Never realized that BM saves incorrect informations in its internal structure (or if the internal handling changed since BM 1.06 for which this function was written)

I thought you meant powerof2 for the subimagerect you want to draw, not for the width/height of the original image. Thats why I didn't understand its use. sorry.

Is it ok, if I add that to my code?


Yan(Posted 2006) [#28]
ok. in that case its really needed. .width / .height don't work as they should, they don't have the real image width/height saved of the image that is held in VRAM ... thats plain crap but ok.
Remember, Max2D is trying to act like a 2D system, so it stands to reason that the texture resizing should be hidden from the user. It would be nice if the real texture size was stored somewhere though (Unless it is and I've missed it?).

or if the internal handling changed since BM 1.06 for which this function was written
It's always been that way.

Is it ok, if I add that to my code?
Of course you can.


[edit]
Apologies to hub for the thread hi-jack...
[/edit]


Dreamora(Posted 2006) [#29]
Never spoted it because I only use PowerOf2 textures (as others have a VRAM overhead).
Updated the code


hub(Posted 2006) [#30]
I've modified the code to use the Dreamora/ GeoffTheGyratingGiraffe DrawImageArea function
to correct the bug on old machine, so
so could you test this :
http://www.bayre.com/zigwigwis/test_griffe_2.exe

Many thanks !!!!


undomiel(Posted 2006) [#31]
Yep, works as expected now.