Jump to content
  • Advertisement
Sign in to follow this  
Fenrhyr

DirectShow and image Overlay

This topic is 5400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!