what’s wrong with the code:
hdc = GetDC(hWnd); // creating bitmaps in memory with size of client area
// GlPlane
GlPlane.hdcMem = CreateCompatibleDC(hdc);
BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
BitmapInfo.bmiHeader.biWidth = cxClient;
BitmapInfo.bmiHeader.biHeight = cyClient;
BitmapInfo.bmiHeader.biPlanes = 1;
BitmapInfo.bmiHeader.biBitCount = 24;
BitmapInfo.bmiHeader.biCompression = BI_RGB;
BitmapInfo.bmiHeader.biSizeImage = 0;
BitmapInfo.bmiHeader.biClrUsed = 0;
BitmapInfo.bmiHeader.biClrImportant = 0;
BitmapInfo.bmiHeader.biXPelsPerMeter = 0;
BitmapInfo.bmiHeader.biYPelsPerMeter = 0;
GlPlane.hBitmap = CreateDIBSection(hdc,&BitmapInfo,DIB_RGB_COLORS,&pBits,NULL,0);
SelectObject(GlPlane.hdcMem,GlPlane.hBitmap);
memset(&pfd,0,sizeof(PIXELFORMATDESCRIPTOR)) ;
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL | PFD_SUPPORT_GDI;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
iPixelFormat = ChoosePixelFormat(GlPlane.hdcMem,&pfd);
SetPixelFormat(GlPlane.hdcMem,iPixelFormat,&pfd);
hrc = wglCreateContext(GlPlane.hdcMem);
wglMakeCurrent(GlPlane.hdcMem,hrc);
glViewport(0, 0, cxClient, cyClient);
glLoadIdentity();
glOrtho(0.0f, cxClient, 0.0f, cyClient, 1.0f, -1.0f);
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0f, 0.0f, 0.0f);
glRectf(100.0f, 100.0f, 200.0f, 200.0f);
glFlush();
GdiFlush();
BitBlt(hdc,0,0,cxClient,cyClient,GlPlane.hdcMem,0,0,SRCCOPY);
ReleaseDC(hWnd,hdc);
i got rendering context but it doesn’t want to draw on the bitmap
or maybe the bitmap has size of 0???
help needed urgently