• Create Account

### #ActualKrum110487

Posted 13 August 2012 - 06:26 PM

I am only double posting because I solved this, and I figured if anyone was curious, they would like to know.

Instead of a call back, which can be called at any time (which I assume will mostly be AFTER a frame is rendered and before it is cleared, thus not rendering, I used this in my render loop.

			if(player.IsPlaying)
{
Bitmap bitmap = memRender.CurrentFrame;
BitmapData data = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);
bitmap.UnlockBits(data);
bitmap.Dispose();
}
base.OnRenderFrame(e);

it is playing the video just fine, although I am not sure how to handle multiple textures yet.

also is there a more efficient way of doing this?

### #1Krum110487

Posted 13 August 2012 - 06:24 PM

I am only double posting because I solved this, and I figured if anyone was curious, they would like to know.

Instead of a call back, which can be called at any time (which I assume will mostly be AFTER a frame is rendered and before it is cleared, thus not rendering, I used this in my render loop.

int width = 0;
int height = 0;
if(player.IsPlaying)
{
Bitmap bitmap = memRender.CurrentFrame;
BitmapData data = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);
bitmap.UnlockBits(data);
bitmap.Dispose();
width = data.Width;
height = data.Height;
}
base.OnRenderFrame(e);

it is playing the video just fine, although I am not sure how to handle multiple textures yet.

also is there a more efficient way of doing this?

PARTNERS