Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Can we draw on top of a video?

Author
Message
mindsclay
14
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 16th Jun 2013 22:28
In my development, I want to have boxes drawn over the video I am using so I can see if the "click area" is in the correct location. But when I draw a box (using lines) the box is underneath the video, not on top, thus I cannot see the box.

So my question is... Is there a layer heirarcy that I can incorporate? Or is are video clips always on top?

I am guessing this could be done with a sprite? But can it be done with the LINE command? (using sprites looks to be more involved to have boxes drawn with specific top/left and bottom/right coordinates)

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 16th Jun 2013 23:02
any code to have a look?

Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 16th Jun 2013 23:55 Edited at: 16th Jun 2013 23:56
I'm not sure what you are using the video for or what your needs are. If it is a situation where you can switch to texture or image cycling you can animate surfaces or animate by pasting to the screen. If this is appropriate in your situation the. It's easy to overlay graphics with this approach.

Pros:
Far less cpu overhead
Much easier to manipulate
Does not use a video decoder

Cons:
Uses more memory
Does not support synced audio

If this is appropriate to what you are trying to do, here's a code example I posted a few years ago:
http://forum.thegamecreators.com/?m=forum_view&t=138206&b=1

PirateJohn
14
Years of Service
User Offline
Joined: 4th Aug 2011
Location: California
Posted: 17th Jun 2013 01:08
Use the command "DRAW SPRITES LAST" and make sure that you redraw the 2-D image for every frame.
mindsclay
14
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 23rd Jun 2013 01:47 Edited at: 23rd Jun 2013 01:52
Looks like the answer is "sprites" then...

@ Mage: In the orignal post I stated that I need the "click area" visible on top of the video I am using. "Click area" is where the mouse is when the user presses the mouse button. It doesn't matter for what the video is intended, I merely need an area defined and I would like to see where it is during development. After development the "box" will no longer be shown. And yes, I need synced audio, but only in the final product.

Thanks for the responses. (now I need to find out why I am not getting emails from the forum)

BTW, I am not creating a 3D-engine-type of game. I am using video clips and actors. It was done in Myst and A Puzzle of Flesh. I am attempting to take it up a notch or two.

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
mindsclay
14
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 23rd Jun 2013 19:55 Edited at: 24th Jun 2013 00:05
Soooo... I would need to create a bitmap, draw my lines, GET IMAGE from the bitmap, then transfer that image to the sprite. Okay, I think I have a solution.



Tried it. Not what I need. I can get the "box" to draw but I cannot see the rest of my image (text and video). I can only see one at a time. Either just the sprite or just the text, but never both. Also, when I display the video I cannot see the sprite.

I have either video and text or sprite by itself. There has to be a way of accomplishing this.

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
mindsclay
14
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 24th Jun 2013 00:08 Edited at: 24th Jun 2013 00:11
Since my last post, it is now working. Why? I have no idea. The only difference is that the sprites are created when BITMAP 31 is selected (as opposed to BITMAP 0 as in the code above). Changes are highlighted below....

Instead of SET CURRENT BITMAP 0
It is now SET CURRENT BITMAP 31

Obviously, there are some rules to the bitmaps being used. I know that video shows only on BITMAP 0. It appears that if I create the sprite with BITMAP 0 set to current, then nothing else shows up.

WEIRD...

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
mindsclay
14
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 24th Jun 2013 00:17 Edited at: 24th Jun 2013 00:50
Do not read this.

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
mindsclay
14
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 24th Jun 2013 00:18
Now it is not working again!! What the F?
I don't get it!

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
mindsclay
14
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 24th Jun 2013 00:39
Wow! Working again. Hmmm... I turned on each sprite one at a time. Now I have three working. It must be the fourth one that is causing trouble.

I see now that this DarkBasic compiler has issues. It will show that there is an error, but it won't tell you exactly where it is unless it is in your main module. Also, the same error can represent more than one type of error reported.

For example, I can have a typo (missing bracket) in an array assignment, but DarkBasic does not state that there is a syntax error. It waits until the executable is created, then it points out that there is an "out of range" array index, or "no such sprite". But the out of range error is not true, there is actually a typo leaving out a parenthesis. That is a syntax error! And it causes a runtime error of "no such sprite".

Anyway, as the program gets bigger, it is more difficult to trouble shoot because the compiler shows errors at say line 286, but none of my modules contains line 286. So where exactly is the error?

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
mindsclay
14
Years of Service
User Offline
Joined: 1st May 2012
Location: Rocklin, CA, USA
Posted: 24th Jun 2013 00:41 Edited at: 24th Jun 2013 00:52
I thought I found the array problem. I was assigning to element 1 without any element zero.

However, having a 4th sprite still causes there to be no sprites at all. Auuuggghhh!!!

www.mindsclay.com
lucifermagus.mindsclay.com (not working with Firefox)
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 25th Jun 2013 12:31
I would suggest you look into play animation to image.
Chances are that will retain audio sync without you having to deal with timing yourself. Setting the image to a sprite will continously update it and let you draw other sprites (or basic 2D) on top of it.


"Why do programmers get Halloween and Christmas mixed up?"

Login to post a reply

Server time is: 2026-07-07 06:24:29
Your offset time is: 2026-07-07 06:24:29