Welcome, Guest. Please login or register.

Author Topic: Blitting  (Read 10391 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Blitting
« on: January 15, 2003, 11:17:19 PM »
hi,
im trying to make an action game in C but i cant seem to get blitting to work properly

im able to load an image and stick it anywhere on a window using WriteChunkyPixels() - but its WAY to slow!
so i want to use BltBitMapRastPort(), BltMaskBitMapRastPort(), &ClipBlit()
i allocate a bitmap + a rastport, initialize them then link them, then i try to write an image to it, then blit from it to a window, but it only writes blank squares(all 0)!
does any one know what i might be doing wrong? and would anyone know of any good examples or source code for doing what i want to do?
the main thing im working on at the moment is placing tiles for a map, as a background...
im the sort of person who works best from example code, and the graphics.library/blitting pages of the ARKRM's dont contain much...

also im using cybergraphx on a SV64/3D not AGA
so to make it easier on my self im opening a window on the workbench screen

thanks for any help... :-)
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blitting
« Reply #1 on: January 17, 2003, 12:03:54 AM »
thanks, i didint see the bit about the friend bitmap
so ill try again!!
 :-)
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blitting
« Reply #2 on: January 17, 2003, 10:16:49 PM »
thanks!! i worked out the BMF_DISPLAYABLE part out last night, after using AllocBitMap() and ataching the windows bitmap as a friend, the code worked but was very slow, BMF_DISPLAYABLE made it much faster! but still a bit too slow, so ill try the idea you just gave me of rendering on a bitmap that isnt displayed, i could imagine how that should give me the speed im after

i only found out about AllocBitMap()  after reading through my includes and autodocs :( i wish there were new printed ARKRMs!!! :-(



 :-)  :-)
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blitting
« Reply #3 on: January 18, 2003, 11:49:28 PM »
ok, now rendering to the offscreen bitmaps or rastports produces the wrong image, it looks like just one or two of the planes of the image, theres somthing there but its definently the wrong color, rendering straight into the window using the exact same tecnique is fine

also how would i speed the thing up on 15/16/24 bit screen modes? its fast on 8-bit now, but is there any way at all to speed up writing the second bitmap to the window?

im using cybergraphx
 :-)
 

Offline iamaboringpersonTopic starter

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show all replies
Re: Blitting
« Reply #4 on: January 22, 2003, 08:46:32 PM »
YYYYYYYYYYYEEEEEEEEEEEEESSSSSSSSSSS!!!!!!
i finaly have it working!!!! thanks all!!! it wasnt the actual blitting part of the code after all,

it was actually further up!

here is what i had when it wasnt working:

bitMap2 = AllocBitMap(640,480,8,BMF_DISPLAYABLE|BMF_MINPLANES|BMB_SPECIALFMT|PIXFMT_LUT8,bitMap);
InitBitMap(bitMap2,8,640,480);
InitRastPort(&rastPort2);
rastPort2.BitMap = bitMap2;


after using AllocBitMap() i used InitBitMap() which mustof messed up some of the BitMap structure!

but i was getting so frustrated that i was prepared to experiment & decided to remove the InitBitMap line!!
and now it works!
not only that but its fast on 15/16 bit screens now too
or at least, about as fast as 8 bit,
its still fairly slow, but thats ok for now
i probably will go fullscreen with V40 style double buffering from now, but i still want to give the user the option of having the window on a public screen, like alt-enter under windows when using a dos window
i think ill just have two slightly different routines used when changing frames, depending on weather its fullscreen or small window

but you couldnt image how happy i was when it finally worked, and it was much faster aswell
so, to all you programers out there remember what i said about the code above!
 :-D