diff --git a/project/ToolkitBuild.xml b/project/ToolkitBuild.xml
index 73fb75aad..a6586d242 100644
--- a/project/ToolkitBuild.xml
+++ b/project/ToolkitBuild.xml
@@ -668,6 +668,8 @@
diff --git a/project/src/opengl/OGLExport.cpp b/project/src/opengl/OGLExport.cpp
index 6a3810e1b..41ecfd054 100644
--- a/project/src/opengl/OGLExport.cpp
+++ b/project/src/opengl/OGLExport.cpp
@@ -377,6 +377,7 @@ unsigned int getResource(value inResource, ResoType inType)
else if (resource->contextVersion!=gTextureContextVersion)
{
ELOG("Warning: %s resource is from old context in %s", getTypeString(inType), sDebugName);
+ resource->contextVersion=gTextureContextVersion;
}
else if (resource->type!=inType)
{
diff --git a/project/src/sdl/SDLStage.cpp b/project/src/sdl/SDLStage.cpp
index 9b5751f42..c96f3e3aa 100644
--- a/project/src/sdl/SDLStage.cpp
+++ b/project/src/sdl/SDLStage.cpp
@@ -363,7 +363,7 @@ class SDLStage : public Stage
void Resize(int inWidth, int inHeight, bool resizeWindow = false)
{
- #ifdef HX_WINDOWS
+ #if (defined(HX_WINDOWS) || defined(emscripten))
if (mIsOpenGL && !resizeWindow)
{
// Little hack to help windows
@@ -378,6 +378,8 @@ class SDLStage : public Stage
// display lists. So Work around it.
gTextureContextVersion++;
+
+
if (mIsOpenGL)
{
Event contextLost(etRenderContextLost);
diff --git a/src/nme/StaticNme.hx b/src/nme/StaticNme.hx
index 4999482e2..76f2464bc 100644
--- a/src/nme/StaticNme.hx
+++ b/src/nme/StaticNme.hx
@@ -2,7 +2,7 @@ package nme;
@:cppFileCode('extern "C" int nme_register_prims();')
#if !nmelink
-@:build(nme.macros.BuildXml.importRelative("../../../project/ToolkitBuild.xml"))
+@:build(nme.macros.BuildXml.importRelative("../../../project/ToolkitBuild.xml","NME_STATIC_LINK","nme-target"))
#else
@:buildXml("
diff --git a/src/nme/macros/BuildXml.hx b/src/nme/macros/BuildXml.hx
index 5085c8c75..91bc68a93 100644
--- a/src/nme/macros/BuildXml.hx
+++ b/src/nme/macros/BuildXml.hx
@@ -8,7 +8,7 @@ using haxe.macro.PositionTools;
class BuildXml
{
- public static macro function importRelative(inFilename:String):Array
+ public static macro function importRelative(inFilename:String, compileDef:String, mergeTarget:String ):Array
{
var dir = Path.directory(Context.currentPos().getInfos().file);
if (!Path.isAbsolute(dir))
@@ -20,10 +20,10 @@ class BuildXml
dir = here + dir;
}
var xmlInject =
- "\n" +
+ "\n" +
"\n" +
"\n" +
- " \n" +
+ " \n" +
";\n";
var p = Context.currentPos();
Context.getLocalClass().get().meta.add(":buildXml", [ { expr:EConst( CString( xmlInject ) ), pos:p } ], p );