Jump to content

Play Video Suppoer

Recommended Posts

Litle feature request, video playback support.


Would be nice that video playback will be supported by leadwerks engine with the installed codecs installed on the system.

This way everything can be done by the engine itself.


Its not nice to init a application everytime a video has been played, or close the application for video display.



ReSize the application on a preset screen resolution.. play the video. fullscreen..

and go back to the original screen resolution would be a very nice feature to have.

This way everything can be handled by the Leadwerks engine itself.





Share this post

Link to post

First of all, the engine can't manage codecs, you'll need to add them when you deploy.

Secondly, you can do this yourself. This isn't a real cool feature for middle ware.

Share this post

Link to post

deplay the codecs on install.. how do want to do that otherwise ??


What i mean is that the Graphics(640,480,0,0,GRAPHICS_BACKBUFFER+GRAPHICS_DEPTHBUFFER); command is creating its own window.

It gives back 0 or 1.. and not a handle.


So how can i play video on the damm window ?? without tracking this window down for the handle.



Ok i know, you can close the graphics windows.. open your own window, and play video into it.

But this will be noticed by the users.


Its a lot nicer if the mmsystem functions are forwarded in the Leadwerks engine, so the simple mmsystem commands can be send in the leadwerks engine created window.

This way everything stays inside 1 window application.

Share this post

Link to post




I disagree. Being able to render video to texture would be an excellent feature for middleware. I wouldn't mind implementing it for Ogg Theora video, but don't know enough about the engine to do so. I don't think there's a way to do it w/ the SDK w/o a little more information. Could someone who knows more than me answer these?


If we could somehow get a byte* to the actual texture information, would filling the texture buffer w/ a frame update the texture on screen? We can currently create a texture using the TTexture CreateTexture( int width, int height, int format=TEXTURE_RGBA ) function, but what does that give us? What's the format of a TTexture?


Actually, is there anything we can do w/ CreateTexture? Seems like we can create a texture, but there's no way to fill the created texture w/ data unless we have the TTexture data format, and none of the other texture functions seem to give access to it. Unless it's just there for copying the color information from a buffer so you can render to texture (remote video camera, reflection, etc)?


Anyways, I may be way off, my 3D-fu is weak, but I would love to take a shot at it.

Share this post

Link to post

I implemented mciSendString into leadwerks in 1 hour, playing avi's in LWE window (you can find it on the old forum)...

Or you play video, or you render bitmaps. I don't find it very efficient copying pixel data from bitmap to textures. The uncompressed avi is just a list of bitmaps, so you can go that way too.


@ shadow_tj: The engine doesn't create your installer, you do. So just don't forget the codec if needed.

Share this post

Link to post

Yes, playing fullscreen video like that is fine, and probably performs a lot better than populating RGB data. But it doesn't give you the ability to render to a texture that you could then map to an object like a TV in game.

Share this post

Link to post

You can render to a texture yourself though.


You can just render to a new buffer, get the color buffer as a texture and then use that texture on a TV or whatever.




This is the call you need to get the color component of a buffer as a texture:


Share this post

Link to post

I'm evidently lacking some rudimentary knowledge. If I wanted to paint the color 200,200,200,255 (RGBA) to the top left pixel of the screen, how would I do that? Or if I wanted to paint the same color to the top left pixel of a texture, how would I do that? Without using SetColor and Plot I mean. What I'd really like to do is write out YCbCr data to a float texture and then use a pixel shader to convert it to RGB to speed things up, but for now I'd be happy just to be able to write arbitrary data to a TTexture.

Share this post

Link to post

If you just want to render whatever to a texture; then it's very easy.


Create a buffer.

Set buffer as the current target.

Draw whatever.

Get the color from the buffer (with the function that I mentioned in my last post).

Use the texture for whatever.


I'll write some code, but it's all written from memory so some things might be more or less wrong:

TBuffer b = CreateBuffer(...); // buffer need at least color
Render(); // Render whatever
TTexture t = GetColorBuffer(; // might be other parameters.. don't remember

// Use t


If you can edit texture data without plot I don't know however. Look in the wiki.

Share this post

Link to post

Join the conversation


Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.


×   Your previous content has been restored.   Clear editor


  • Create New...