Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 4 posts ] 
    Amy
  Sun Nov 08, 2015 12:14 am
User avatar
Staff

Big Dumb Guy
Expand to see the code.


Am I using this right? I'm just getting a blank image.

bmp.blt(source, sx, sy, sw, sh, dx, dy, dw, dh);

So I resume that sw and sh are source width and height, and dw dh are destination width and height. That's fine.

But sx sy, dx dy, I presume are the x,y I am drawing at. Am I right to set these at 0?

I am trying to layer several bitmaps on top of one another.


Top Top
Profile      
 

    Xilef
  Sun Nov 08, 2015 1:08 am
User avatar
Staff

Big Dumb Guy

Location: UK
MV Source apparently;
Expand to see the code.
Line 19 looks interesting with "sx + sw <= source.width && sy + sh <= source.height"; indicates the blit will fail if it goes over the edge of the source bitmap. You need to make sure you're not going over the edge (if your source width/source height is larger than the image's dimensions).

Width and height are properties so I guess this should work;
Expand to see the code.
If that sure-fire bounds checking fails then can you confirm that load bitmap is working? Try returning one of the loaded bitmaps to see what happens.

I would guess dw/dh controls stretching.

EDIT: Interesting, looks like bitmaps contain draw contexts as well as the draw-surface (canvas). Should be quite easy to attack a bitmap with advanced effects.

Unrelated to your post, could you try this on a bitmap to see what happens?
Expand to see the code.
If my_bitmap goes pink then that means WebGL can be used directly on an MV bitmap object.


Top Top
Profile      
 

    Amy
  Sun Nov 08, 2015 10:48 am
User avatar
Staff

Big Dumb Guy
If I return either hair_bitmap or body_bitmap it works. But blt doesn't seem to do anything on either of them if I return them either. Returning bmp gives me a blank image.


As for your code, I get "gl is null".

RPG Maker MV has really, really bad error reporting though (i.e. basically none).


Top Top
Profile      
 

    Xilef
  Sun Nov 08, 2015 3:01 pm
User avatar
Staff

Big Dumb Guy

Location: UK
Looking deeper into the source, check if the new bitmap is ready with bmp.isReady(), it could be doing that thing canvas does when everything requires to be performed in onReady() or whatever they want to call it.

There's also isError() that you can try.

Also, try calling bmp.clear() then bmp.fillRect( ... ) on the bitmap to see if you can modify the contents of it (Fill it green to see if you can get a green bitmap returned).

As for my snippet, yeah the context is initialised as 2d by default for bitmaps, so I guess that snippet wouldn't have worked unless you change the constructor for Bitmap. Pretty awesome though as webgl is scattered all over the MV javascript.


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: Majestic-12 and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group