Problem with: DIB rendering context + opengl extension

Problem with: DIB rendering context + opengl extension

I’m trying to render stuff off screen by using the function CreateDIBSection() and doing maximum blending using
extension function glBlendEquationEXT()

However, whenever I change the rendering context to the rendering context derived from [the device context derived
from CreateDIBSection()], the extension GL_EXT_blend_minmax is not supported - calling glGetString(GL_EXTENSIONS). In fact, only the extensions: [GL_WIN_swap_hint, GL_EXT_bgra, and GL_EXT_paletted_texture] are supported in the new rendering context out of something like 40 GL extensions normally supported by my card: Oxygen GVX1

My initial guess is that the driver is switching to software mode when using the new rendering context. If so, is there any way around it?

The my goal here is to create a movie out of maximally (is that even a word?) blended textures using off-screen buffer because if I use the back buffer to create the movie, whatever is on the top of the GL windows gets drawn as well - using glPixelCopy(). If there is a way to intercept the rendered and blended picture before it gets drawn to the front/back buffer, that would be what I’m looking for. Unfortunately, this card doesn’t support any auxiliary buffers.

Any help will be greatly appreciated.

  • Phil

The following is the code where I make the DC and RC, copy info, and make them current:

memset(&m_bmi, 0, sizeof(m_bmi));
m_bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_bmi.bmiHeader.biWidth = image_width;
m_bmi.bmiHeader.biHeight = image_height;
m_bmi.bmiHeader.biPlanes = 1;
m_bmi.bmiHeader.biBitCount = 24; //24 bit?
m_bmi.bmiHeader.biCompression = BI_RGB; //RGB

//DIB
HDC	hDC = ::GetDC(this->m_hWnd);

m_hDib = ::CreateDIBSection(hDC, &m_bmi, DIB_RGB_COLORS, (void**)bits, NULL, (DWORD)0);
::ReleaseDC(this->m_hWnd, hDC);

//memory DC
m_hMemDC = ::CreateCompatibleDC(NULL);
if (!m_hMemDC)
{
	DeleteObject(m_hDib);
	m_hDib = NULL;
	return NULL;
}

m_hOldDib = SelectObject(m_hMemDC, m_hDib);

// Setting up memory DC's pixel format.
if (!SetDCPixelFormat(m_hMemDC, PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL | PFD_STEREO_DONTCARE))
{
	SelectObject(m_hMemDC, m_hOldDib);
	DeleteObject(m_hDib);
	m_hDib = NULL;
	DeleteDC(m_hMemDC);
	m_hMemDC = NULL;
	return NULL;
}

//RC
m_hMemRC = ::wglCreateContext(m_hMemDC);
if (!m_hMemRC)
{
	SelectObject(m_hMemDC, m_hOldDib);
	DeleteObject(m_hDib);
	m_hDib = NULL;
	DeleteDC(m_hMemDC);
	m_hMemDC = NULL;
	return NULL; 
}


// Store old DC and RC
m_hOldDC = ::wglGetCurrentDC();
m_hOldRC = ::wglGetCurrentContext(); 

// Make m_hMemRC the current RC.
::wglMakeCurrent(m_hMemDC, m_hMemRC);

When rendering offscreen (in a DIB), Windows automatically uses the Microsoft software OpenGL implementation.

I think the only way to use your card to render offscreen is if it supports P-Buffers…

Regards.

Eric

Thanks for the reply, Eric.

I just have another quick question: Can you do regular blending in a DIB or just RGB only?