LWJGL + Webcam

Started by Lagz, March 18, 2007, 11:39:10

Previous topic - Next topic

Lagz

Hi,

Does anyone have experience of using webcams with JOGL. I basically want to link a webcam to an openGL texture. Does anyone know the best way to do this?

princec

I've done this (using LWJGL, not JOGL, but the principle is the same).

It's not as easy as it should be.

Basically the complicated bit is figuring out how to read image data out of the camera - for that, you need either some custom windows media code in C++ to do the job or someone else's prebuilt code (NCTVideo is what I used). There is a possibility the Java Media Framework can do it but I abandoned that years ago because it was so obscure and difficult to code and didn't seem to work.

Once you've got your image data it's a doddle to just blit it straight over to a texture using glTexSubImage2D every frame and then render it however you want.

Cas :)

rainforest

I was wondering how to use this NCTVideo with Java (where can I get it). Is the API (or whatever) license free for the users? Is there any other alternatives?

I wanted to make a scree saver where the user will be able to look in the webcam within a 3D perspective, waiting for your reply ...
.:: A journey of thousand miles starts with a single step ::.

princec

http://www.nctsoft.com/products/NCTVideoStudio/

All you need to know is there.

You'll need to write some JNI to interface to it. And no, it won't work on the Mac or Linux, you'll need to find another way to do it.

Cas :)

rainforest

Thank u very much Cas, seems a wonderful activeX controller, bad that it is not written in Java. Im damn 'good' in JNI; I was wondering if anyone here has knowledge about an easy tutorial for learning JNI quickly?
.:: A journey of thousand miles starts with a single step ::.

markush

Quote from: princec on April 17, 2007, 20:46:17
http://www.nctsoft.com/products/NCTVideoStudio/

All you need to know is there.

You'll need to write some JNI to interface to it. And no, it won't work on the Mac or Linux, you'll need to find another way to do it.

Cas :)

On Mac you can use quicktime for java to use the webcam. That works on windows, too (if the user has installed quicktime).

Won't work on linux though.