DirectShow and image Overlay

Started by
0 comments, last by Klaus Post 19 years, 6 months ago
Hi, First of all, I'm French so don't hesitate to ask me if I don't make myself clear in my request. I'm trying to put an image onto a video stream. I already have the video stream (thanks to CaptureText9 sources). That seems to be quite simple but I need to load my image from memory. So I'm using D3DXLoadSurfaceFromMemory (D3DXCreateTextureFronFileInMemory is not working by my experiment) and it would be easier if D3DXCreateSurfaceFromMemory existed... Let's see what I have done : D3D_Device->CreateTexture( image->width(), image->height(), 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, &lpTexture, NULL); lpTexture->GetSurfaceLevel(0, &lpSurface); D3DXLoadSurfaceFromMemory(lpSurface, NULL,NULL, image->scanLine(0),D3DFMT_X8R8G8B8,image->bytesPerLine(),NULL,&rect,D3DX_DEFAULT ,ColorKey ))) NB: scanLine() returns a pointer to the pixel data at the scanline with index i. The first scanline is at index 0. Then I draw my vertices the normal way to render my texture. That is not so cool (and doesn't do the way I want)and my frame rate is getting low. Is anyone here has a better idea (I'm sure someone does) for doing what I need ? Thanks Fenrhyr
Advertisement
I'm uploading like this:

My Texture:
IDirect3DTexture9* sys_tex;

On device creation:
HRESULT res = m_pd3dDevice->CreateTexture(vi.width, vi.height, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &sys_tex, NULL);

On every frame I do:
D3DLOCKED_RECT r;res = sys_tex->LockRect(0, &r, NULL, 0);    if (FAILED(res))       return res;    // Copy the image into r.pBits.    env->BitBlt((BYTE*)r.pBits, r.Pitch, src->GetReadPtr(), src->GetPitch(), src->GetRowSize(), src->GetHeight());    res = sys_tex->UnlockRect(0);    if (FAILED(res))       return res;    res =  m_pd3dDevice->SetTexture(0, sys_tex);    if (FAILED(res))       return res;

You need to be more specific than "doesn't do the way I want" for more to the point help.

This topic is closed to new replies.

Advertisement