line overwrite
Hi. I am working on an MFC Dialog Based OpenGL Application. I use double buffering. My problem is: I have a gridline in grey and when I draw another line (which is yellow) on top of it, my new line does not completely cover the old one. I see some random grey points on yellow. My pixel format is as below. Does anyone know how I can fix this problem?
BOOL CMyDlg::SetWindowPixelFormat(HDC hDC)
{
PIXELFORMATDESCRIPTOR pfd;
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); // Size of this pfd
pfd.nVersion = 1; // Version number : must be 1
pfd.dwFlags = PFD_DRAW_TO_WINDOW | // Support window
PFD_SUPPORT_OPENGL | // Support OpenGL
PFD_DOUBLEBUFFER | // Double buffered
PFD_STEREO_DONTCARE; // Support either monoscopic or stereoscopic
pfd.iPixelType = PFD_TYPE_RGBA; // RGBA type
pfd.cColorBits = 0; // Specifies the number of color bitplanes in each color buffer
pfd.cRedBits = 0; // Specifies the number of red bitplanes in each RGBA color buffer
pfd.cRedShift = 0; // Specifies the shift count for red bitplanes in each RGBA color buffer
pfd.cGreenBits = 0; // Specifies the number of green bitplanes in each RGBA color buffer
pfd.cGreenShift = 0; // Specifies the shift count for green bitplanes in each RGBA color buffer
pfd.cBlueBits = 0; // Specifies the number of blue bitplanes in each RGBA color buffer
pfd.cBlueShift = 0; // Specifies the shift count for blue bitplanes in each RGBA color buffer
pfd.cAlphaBits = 0; // Specifies the number of alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported
pfd.cAlphaShift = 0; // Specifies the shift count for alpha bitplanes in each RGBA color buffer. Alpha bitplanes are not supported
pfd.cAccumBits = 0; // Specifies the total number of bitplanes in the accumulation buffer
pfd.cAccumRedBits = 0; // Specifies the number of red bitplanes in the accumulation buffer
pfd.cAccumGreenBits = 0; // Specifies the number of green bitplanes in the accumulation buffer
pfd.cAccumBlueBits = 0; // Specifies the number of blue bitplanes in the accumulation buffer
pfd.cAccumAlphaBits = 0; // Specifies the number of alpha bitplanes in the accumulation buffer
pfd.cDepthBits = 0; // Specifies the depth of the depth (z-axis) buffer
pfd.cStencilBits = 0; // Specifies the depth of the stencil buffer
pfd.cAuxBuffers = 0; // Specifies the number of auxiliary buffers. Auxiliary buffers are not supported
pfd.iLayerType = PFD_MAIN_PLANE; // Ignored. Earlier implementations of OpenGL used this member, but it is no longer used
pfd.bReserved = 0; // Specifies the number of overlay and underlay planes
pfd.dwLayerMask = 0; // Ignored. Earlier implementations of OpenGL used this member, but it is no longer used
pfd.dwVisibleMask = 0; // Specifies the transparent color or index of an underlay plane
pfd.dwDamageMask = 0; // Ignored. Earlier implementations of OpenGL used this member, but it is no longer used
int m_GLPixelIndex = ChoosePixelFormat(hDC, &pfd);// Attempts to match an appropriate pixel format supported by a device context to a given pixel format specification
if(m_GLPixelIndex == 0) // Choose default
{
m_GLPixelIndex = 1;
if(DescribePixelFormat(hDC, m_GLPixelIndex, // Obtains information about the pixel format identified by iPixelFormat of the device associated with hdc
sizeof(PIXELFORMATDESCRIPTOR), &pfd)==0)
return FALSE;
}
if(!SetPixelFormat(hDC, m_GLPixelIndex, &pfd)) //Sets the pixel format of the specified device context to the format specified by the iPixelFormat index
return FALSE;
return TRUE;
}
Note: I also tried many nonzero value combinations but I could not make it work.
NO CROSSPOST!
CHOSE A FORUM!
BOTH NEHES AND THE OGL ARE ALMOST IDENTICLE!
CHOSE A FORUM!
BOTH NEHES AND THE OGL ARE ALMOST IDENTICLE!

In general do avoid crossposting, but to answer your question the best way might be to increase the line width with glLineWidth(2.0), though this might not be what you want. You could try requesting a depth buffer and using that, but I don''t think that would help. Is there any way to avoid drawing the grid line where you add the yellow? What exactly are you trying to do, maybe someone could suggest something based on that.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement