mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-10 00:31:20 +03:00
Fixed a bug in the gl context creation. The context must be asigned before the OpenGL backend init.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 2.7.1, 2013-06-30T01:02:25. -->
|
||||
<!-- Written by QtCreator 2.7.1, 2013-07-03T00:08:20. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
|
||||
@@ -11,20 +11,13 @@
|
||||
namespace EE { namespace Graphics { namespace Private {
|
||||
|
||||
static void fromGLMmat4( glm::mat4 from, GLfloat * to ) {
|
||||
Int32 i,p;
|
||||
|
||||
for ( i = 0; i < 4; i++ ) {
|
||||
glm::vec4 v = from[i];
|
||||
p = i * 4;
|
||||
to[p ] = v.x;
|
||||
to[p+1] = v.y;
|
||||
to[p+2] = v.z;
|
||||
to[p+3] = v.w;
|
||||
}
|
||||
memcpy( to, &from[0][0], sizeof(glm::mat4) );
|
||||
}
|
||||
|
||||
static glm::mat4 toGLMmat4( const GLfloat * m ) {
|
||||
return glm::mat4( m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11], m[12], m[13], m[14], m[15] );
|
||||
glm::mat4 Result;
|
||||
memcpy( &Result[0][0], m, sizeof(glm::mat4));
|
||||
return Result;
|
||||
}
|
||||
|
||||
class cMatrixStack
|
||||
@@ -42,4 +35,3 @@ using namespace EE::Graphics::Private;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -64,7 +64,8 @@ namespace EE { namespace Window { namespace Backend { namespace SDL2 {
|
||||
cWindowSDL::cWindowSDL( WindowSettings Settings, ContextSettings Context ) :
|
||||
cWindow( Settings, Context, eeNew( cClipboardSDL, ( this ) ), eeNew( cInputSDL, ( this ) ), eeNew( cCursorManagerSDL, ( this ) ) ),
|
||||
mSDLWindow( NULL ),
|
||||
mGLContext( NULL )
|
||||
mGLContext( NULL ),
|
||||
mGLContextThread( NULL )
|
||||
#ifdef EE_USE_WMINFO
|
||||
,
|
||||
mWMinfo( eeNew( SDL_SysWMinfo, () ) )
|
||||
@@ -197,7 +198,7 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
mGLContext = SDL_GL_CreateContext( mSDLWindow );
|
||||
mGLContextThread = SDL_GL_CreateContext( mSDLWindow );
|
||||
|
||||
if ( NULL == mGLContext ) {
|
||||
if ( NULL == mGLContext || NULL == mGLContextThread ) {
|
||||
cLog::instance()->Write( "Unable to create context: " + std::string( SDL_GetError() ) );
|
||||
|
||||
LogFailureInit( "cWindowSDL", GetVersion() );
|
||||
@@ -207,13 +208,13 @@ bool cWindowSDL::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
|
||||
SDL_GL_SetSwapInterval( ( mWindow.ContextConfig.VSync ? 1 : 0 ) ); // VSync
|
||||
|
||||
SDL_GL_MakeCurrent( mSDLWindow, mGLContext );
|
||||
|
||||
if ( NULL == cGL::ExistsSingleton() ) {
|
||||
cGL::CreateSingleton( mWindow.ContextConfig.Version );
|
||||
cGL::instance()->Init();
|
||||
}
|
||||
|
||||
SDL_GL_MakeCurrent( mSDLWindow, mGLContext );
|
||||
|
||||
CreatePlatform();
|
||||
|
||||
GetMainContext();
|
||||
|
||||
@@ -193,10 +193,9 @@ bool cWindowAl::Create( WindowSettings Settings, ContextSettings Context ) {
|
||||
|
||||
if ( NULL == cGL::ExistsSingleton() ) {
|
||||
cGL::CreateSingleton( mWindow.ContextConfig.Version );
|
||||
cGL::instance()->Init();
|
||||
}
|
||||
|
||||
cGL::instance()->Init();
|
||||
|
||||
CreatePlatform();
|
||||
|
||||
GetMainContext();
|
||||
|
||||
Reference in New Issue
Block a user