mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 06:34:36 +00:00
Implementation of sRGB image support. Overhauls the linearization setup to utilize the sRGB image types, as well as refactors the use of ColorF and ColorI to be properly internally consistent. ColorIs are used only for front-facing/editing/UI settings, and ColorFs, now renamed to LinearColorF to reduce confusion of purpose, are used for color info in the engine itself. This avoids confusing and expensive conversions back and forth between types and avoids botches with linearity. Majority work done by @rextimmy
This commit is contained in:
parent
8780f83262
commit
25686ed4be
294 changed files with 3894 additions and 2813 deletions
|
|
@ -255,6 +255,14 @@ void GFXGLDevice::init( const GFXVideoMode &mode, PlatformWindow *window )
|
|||
HDC hdcGL = GetDC( hwnd );
|
||||
AssertFatal( hdcGL != NULL, "Failed to create device context" );
|
||||
|
||||
// Create pixel format descriptor...
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
CreatePixelFormat( &pfd, 32, 0, 0, false ); // 32 bit color... We do not need depth or stencil, OpenGL renders into a FBO and then copy the image to window
|
||||
if( !SetPixelFormat( hdcGL, ChoosePixelFormat( hdcGL, &pfd ), &pfd ) )
|
||||
{
|
||||
AssertFatal( false, "GFXGLDevice::init - cannot get the one and only pixel format we check for." );
|
||||
}
|
||||
|
||||
int OGL_MAJOR = 3;
|
||||
int OGL_MINOR = 2;
|
||||
|
||||
|
|
@ -269,7 +277,7 @@ void GFXGLDevice::init( const GFXVideoMode &mode, PlatformWindow *window )
|
|||
if (!wglMakeCurrent(hdcGL, tempGLRC))
|
||||
AssertFatal(false, "Couldn't make temp GL context.");
|
||||
|
||||
if( gglHasWExtension( ARB_create_context) )
|
||||
if( gglHasWExtension(hdcGL, ARB_create_context) )
|
||||
{
|
||||
int const create_attribs[] = {
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, OGL_MAJOR,
|
||||
|
|
@ -322,21 +330,13 @@ U32 GFXGLDevice::getTotalVideoMemory()
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
GFXWindowTarget *GFXGLDevice::allocWindowTarget(PlatformWindow *window)
|
||||
GFXWindowTarget *GFXGLDevice::allocWindowTarget( PlatformWindow *window )
|
||||
{
|
||||
AssertFatal(!mContext, "");
|
||||
|
||||
init(window->getVideoMode(), window);
|
||||
GFXGLWindowTarget *ggwt = new GFXGLWindowTarget(window, this);
|
||||
ggwt->registerResourceWithDevice(this);
|
||||
ggwt->createPixelFormat();
|
||||
|
||||
//first window
|
||||
if (!mContext)
|
||||
{
|
||||
init(window->getVideoMode(), window);
|
||||
ggwt->mSecondaryWindow = false;
|
||||
}
|
||||
else
|
||||
ggwt->mSecondaryWindow = true;
|
||||
|
||||
ggwt->mContext = mContext;
|
||||
AssertFatal(ggwt->mContext, "GFXGLDevice::allocWindowTarget - failed to allocate window target!");
|
||||
|
||||
|
|
@ -364,22 +364,6 @@ void GFXGLWindowTarget::_setupNewMode()
|
|||
{
|
||||
}
|
||||
|
||||
void GFXGLWindowTarget::createPixelFormat()
|
||||
{
|
||||
HWND hwnd = GETHWND(mWindow);
|
||||
// Create a device context
|
||||
HDC hdcGL = GetDC(hwnd);
|
||||
AssertFatal(hdcGL != NULL, "GFXGLWindowTarget::createPixelFormat() - Failed to create device context");
|
||||
|
||||
// Create pixel format descriptor...
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
CreatePixelFormat(&pfd, 32, 0, 0, false); // 32 bit color... We do not need depth or stencil, OpenGL renders into a FBO and then copy the image to window
|
||||
if (!SetPixelFormat(hdcGL, ChoosePixelFormat(hdcGL, &pfd), &pfd))
|
||||
{
|
||||
AssertFatal(false, "GFXGLWindowTarget::createPixelFormat() - cannot get the one and only pixel format we check for.");
|
||||
}
|
||||
}
|
||||
|
||||
void GFXGLWindowTarget::_makeContextCurrent()
|
||||
{
|
||||
HWND hwnd = GETHWND(getWindow());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue