Game Development Community

NewProject: Messenger Webcam voip Conference

by Paul Griffiths · in Torque Game Engine · 05/27/2006 (10:10 am) · 17 replies

Hi, I'm starting a new project, it's a Messenger system with Web-cam voice over IP and hopefully more all within torque!

I'm new to both Torque & C++ but have experience building a similar system in java (It included a multi-screen(16) web-cam chat room.) and little experiance using OGRE, 3d game studio ect.

I'm starting off with the video side of things for now. I'm concentrating on video preview.
So, i have several questions to ask the community:

(1). I create a key bind in TorqueScript to call a function called 'PreviewVideo' which would then call some c++ code. Where is this code?

(2). Where would i put my web-cam code? Where should i include/initialise it to? Wheres the best place to start?

(3). How can I get code from question 1 to call a function in my web-cam code(question 2)?

(4). Does Torque networking have a unreliable transmit means? I mean if the network is busy then some data is dropped? Or should i use a 3rd party network library?

(5). Any libraries available free to create my project to include Linux & Mac not just windows DirectX?

I'm not sure on interfacing the code, any help appreciated.
Any info on libraries, links, resources, code etc?

If I get good help ill include my finished Messenger as a Torque resource. Thank you for your time.

#1
05/27/2006 (12:04 pm)
Should i create my webcam code as a scriptable object? As here: tdn.garagegames.com/wiki/Code/How_do_I_make_a_scriptable_object%3F
#2
05/27/2006 (12:21 pm)
The webcam interface would have to be in the engine's C++ code. Then I would imagine you'd want to expose the controls to script so you could use them in-game.
#3
05/27/2006 (12:36 pm)
Heya Paul, you should take a good look around. Many of the answers to your questions are mentioned on the site. Question nr 4 and 5, for example.
#4
05/27/2006 (12:42 pm)
I'm new so im playing with scriptable objects for now in c++.
#5
05/27/2006 (12:45 pm)
Stefan you say question 5 has been answered? Are you saying their are libraries available for web-cam in torque already?
#6
05/27/2006 (1:12 pm)
Just started a website for Project TMessenger
#7
05/27/2006 (9:45 pm)
Found a nice Video capture library at:sourceforge.net/projects/portvideo

It's for Win32, Linux & Mac! Got a nice API so should be good.
#8
05/28/2006 (3:37 pm)
#include IANAL.h

@Paul: Unfortuantly you won't be able to distribute binaries to anyone if you use Portvideo, since it's GPLed and you arn't allowed to distribute the torque source to anyone without a license.

I suppose you might be able to distribute it to just TGE owners (the binaries that is) along with the source since they already have a license, but that might be iffy.
#9
05/28/2006 (3:40 pm)
Wnat if i'm not selling the game but giving it away as a free download?
#10
05/28/2006 (3:47 pm)
What licences can i use with torque?
#11
05/28/2006 (3:47 pm)
#include IANAL.h

@Paul: It doesn't matter, if you include GPL code with other code you have to release the source for the compiled binary to anyone you give the binary to, wether it's free or costs money.

http://www.fsf.org/licensing/licenses/gpl-faq.html is the FAQ about what you can and can't do with GPLed code, but basically you can't use GPLed code in any Torque based products.
You might want to try looking for BSD licensed webcam code, instead?
#12
05/28/2006 (3:51 pm)
Thanks matt. Guess ill start may search over again...
#13
05/28/2006 (4:57 pm)
I'm testing out another capture library: codevis.com/vidcapture/index.html

It outputs RGB24 raw images.

I wish to render the image to gui control.

The code in guiBitmapCtrl.cc is:

void GuiBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
{
   if (mTextureHandle)
   {
      dglClearBitmapModulation();
		if(mWrap)
		{
 			TextureObject* texture = (TextureObject *) mTextureHandle;
			RectI srcRegion;
			RectI dstRegion;
			float xdone = ((float)mBounds.extent.x/(float)texture->bitmapWidth)+1;
			float ydone = ((float)mBounds.extent.y/(float)texture->bitmapHeight)+1;

			int xshift = startPoint.x%texture->bitmapWidth;
			int yshift = startPoint.y%texture->bitmapHeight;
			for(int y = 0; y < ydone; ++y)
				for(int x = 0; x < xdone; ++x)
				{
		 			srcRegion.set(0,0,texture->bitmapWidth,texture->bitmapHeight);
  					dstRegion.set( ((texture->bitmapWidth*x)+offset.x)-xshift,
								      ((texture->bitmapHeight*y)+offset.y)-yshift,
								      texture->bitmapWidth,	
								      texture->bitmapHeight);
   				dglDrawBitmapStretchSR(texture,dstRegion, srcRegion, false);
				}
		}
		else
      {
         RectI rect(offset, mBounds.extent);
	      dglDrawBitmapStretch(mTextureHandle, rect);
      }
   }

   if (mProfile->mBorder || !mTextureHandle)
   {
      RectI rect(offset.x, offset.y, mBounds.extent.x, mBounds.extent.y);
      dglDrawRect(rect, mProfile->mBorderColor);
   }

   renderChildControls(offset, updateRect);
}

Question is can dglDrawBitmapStretchSR take a 24bit raw image? Or how can i achieve this?
#14
05/28/2006 (6:21 pm)
I'm guessing one approach is to create a blank(black) image texture resource and render that to gui and then manipulate it's pixels?

Any ideas or links etc?
#15
05/29/2006 (10:58 pm)
You might want to look at the GuiTheoraCtrl and how it renders offscreen data.
#16
05/31/2006 (1:58 pm)
Lateral, thanks for the info, looking into it now, seems ok to follow though may need some help from the community
#17
11/10/2009 (12:30 pm)
@Paul did you ever get this to work?

I want to add multiple webcam capture to t3D and am looking for a good bsd platform independent webcam sdk.

I am checking your posts now, but I don't see that you ever posted a resource.

Can you tell me what webcam sdk you used? And perhaps a bit of explanation as to where you integrated this, if you got it working?

Thanks in advance.