Render udpates
This commit is contained in:
@@ -11,6 +11,11 @@ HiddenGlWindow::~HiddenGlWindow()
|
||||
}
|
||||
|
||||
bool HiddenGlWindow::Create(unsigned width, unsigned height, std::string& error)
|
||||
{
|
||||
return CreateShared(width, height, nullptr, nullptr, error);
|
||||
}
|
||||
|
||||
bool HiddenGlWindow::CreateShared(unsigned width, unsigned height, HDC sharedDeviceContext, HGLRC sharedContext, std::string& error)
|
||||
{
|
||||
Destroy();
|
||||
|
||||
@@ -63,7 +68,11 @@ bool HiddenGlWindow::Create(unsigned width, unsigned height, std::string& error)
|
||||
pfd.cDepthBits = 0;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
|
||||
const int pixelFormat = ChoosePixelFormat(mDc, &pfd);
|
||||
int pixelFormat = 0;
|
||||
if (sharedDeviceContext != nullptr)
|
||||
pixelFormat = GetPixelFormat(sharedDeviceContext);
|
||||
if (pixelFormat == 0)
|
||||
pixelFormat = ChoosePixelFormat(mDc, &pfd);
|
||||
if (pixelFormat == 0 || !SetPixelFormat(mDc, pixelFormat, &pfd))
|
||||
{
|
||||
error = "Could not choose/set pixel format for hidden OpenGL window.";
|
||||
@@ -76,6 +85,11 @@ bool HiddenGlWindow::Create(unsigned width, unsigned height, std::string& error)
|
||||
error = "wglCreateContext failed for hidden OpenGL window.";
|
||||
return false;
|
||||
}
|
||||
if (sharedContext != nullptr && wglShareLists(sharedContext, mGlrc) != TRUE)
|
||||
{
|
||||
error = "wglShareLists failed for hidden OpenGL shared context.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
~HiddenGlWindow();
|
||||
|
||||
bool Create(unsigned width, unsigned height, std::string& error);
|
||||
bool CreateShared(unsigned width, unsigned height, HDC sharedDeviceContext, HGLRC sharedContext, std::string& error);
|
||||
bool MakeCurrent() const;
|
||||
void ClearCurrent() const;
|
||||
void Destroy();
|
||||
|
||||
Reference in New Issue
Block a user