Generate .Avi File with Memory HDC (random pixels)


I’m try to render in a off-buffer for generating a file .AVI. I create this off-buffer with a memory DC and a DIB section associate a this memory DC. So, I can do other things in my computer while the .avi file are generating.

Here I write some code:

fun for creating HDC memory and the context RC.
m_hDib = ::CreateDIBSection(hDC, &m_bmi, DIB_RGB_COLORS, &m_pBitmapBits, NULL, (DWORD)0);

m_hDC = CreateCompatibleDC(NULL);

SelectObject(m_hDC, m_hDib);


m_hGLContext = wglCreateContext(m_hDC);


After, I read the front buffer int orden to add the bitmap to the .avi file.

Some code:






CBmp bmp; // (debug) for viewing the bmp I read from front buffer




In the file bmpDebugAvi.bmp I can see some random pixel (blue pixel, red pixel, yellow pixel,…) with colors that it’s part of my render. The wrong pixel aren’t always in same place. For each render they are in other place. I believe the wrong pixel are locate with the render triangle are far from the camera.

I believe my code is ok, and opengl and memory DC don’t work well whe the triangles are far from the camera. I have develop a simple sample for testing this, and I don’t seem this random pixels in random places in the render window.

I’ll estimate all sugerencies.

Thank you.

Regards from Spain.