File tree Expand file tree Collapse file tree 7 files changed +47
-23
lines changed
lib/draft-api/src/openfl/display3D Expand file tree Collapse file tree 7 files changed +47
-23
lines changed Original file line number Diff line number Diff line change @@ -2377,9 +2377,12 @@ import lime.math.Vector2;
23772377 __bindGLTextureCubeMap (texture .__getTexture ());
23782378 }
23792379
2380- #if (desktop && !html5)
2381- // TODO: Cache?
2382- gl .enable (gl. TEXTURE_2D );
2380+ #if lime
2381+ if (__context .type == OPENGL )
2382+ {
2383+ // TODO: Cache?
2384+ gl .enable (gl. TEXTURE_2D );
2385+ }
23832386 #end
23842387
23852388 __contextState .textures [i ] = texture ;
@@ -2422,9 +2425,12 @@ import lime.math.Vector2;
24222425 texture .__alphaTexture .__setSamplerState (samplerState );
24232426 gl .uniform1i (__state .program .__agalAlphaSamplerEnabled [sampler ].location , 1 );
24242427
2425- #if (desktop && !html5)
2426- // TODO: Cache?
2427- gl .enable (gl. TEXTURE_2D );
2428+ #if lime
2429+ if (__context .type == OPENGL )
2430+ {
2431+ // TODO: Cache?
2432+ gl .enable (gl. TEXTURE_2D );
2433+ }
24282434 #end
24292435 }
24302436 else
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ class OpenGLRenderer extends DisplayObjectRenderer
7373 @:noCompletion private static var __staticDefaultDisplayShader : DisplayObjectShader ;
7474 @:noCompletion private static var __staticDefaultGraphicsShader : GraphicsShader ;
7575 @:noCompletion private static var __staticMaskShader : Context3DMaskShader ;
76+ @:noCompletion private static var __sRGBWriteControlSupported : Null <Bool >;
7677 @:noCompletion private static var __complexBlendsSupported : Null <Bool >;
7778 @:noCompletion private static var __coherentBlendsSupported : Null <Bool >;
7879
@@ -142,6 +143,16 @@ class OpenGLRenderer extends DisplayObjectRenderer
142143 }
143144 #end
144145
146+ if (__sRGBWriteControlSupported == null )
147+ {
148+ __sRGBWriteControlSupported = gl .getSupportedExtensions ().contains (" EXT_sRGB_write_control" );
149+ }
150+
151+ if (__sRGBWriteControlSupported )
152+ {
153+ gl .disable (0x8DB9 ); // GL_FRAMEBUFFER_SRGB
154+ }
155+
145156 if (__complexBlendsSupported == null )
146157 {
147158 #if desktop
Original file line number Diff line number Diff line change @@ -625,8 +625,8 @@ class Shader
625625 extensions + = " #extension " + ext .name + " : " + ext .behavior + " \n " ;
626626 }
627627
628- var complexBlendsSupported = OpenGLRenderer .__complexBlendsSupported && isFragment
629- #if desktop && (! StringTools .startsWith (__glVersion , " 1" ) || __glVersion == " 150" ) #end;
628+ var complexBlendsSupported = OpenGLRenderer .__complexBlendsSupported && isFragment #if desktop
629+ && (! StringTools .startsWith (__glVersion , " 1" ) || __glVersion == " 150" ) #end;
630630
631631 if (complexBlendsSupported )
632632 {
Original file line number Diff line number Diff line change @@ -1239,6 +1239,8 @@ class Stage extends DisplayObjectContainer #if lime implements IModule #end
12391239
12401240 if (__renderer != null )
12411241 {
1242+ __renderer .__clear ();
1243+
12421244 __renderer .__allowSmoothing = (quality != LOW );
12431245 __renderer .__pixelRatio = #if openfl_disable_hdpi 1 #else window .scale #end;
12441246 __renderer .__worldTransform = __displayMatrix ;
Original file line number Diff line number Diff line change @@ -2438,9 +2438,12 @@ import lime.math.Vector2;
24382438 __bindGLTextureCubeMap (texture .__getTexture ());
24392439 }
24402440
2441- #if (desktop && !html5)
2442- // TODO: Cache?
2443- gl .enable (gl. TEXTURE_2D );
2441+ #if lime
2442+ if (__context .type == OPENGL )
2443+ {
2444+ // TODO: Cache?
2445+ gl .enable (gl. TEXTURE_2D );
2446+ }
24442447 #end
24452448
24462449 __contextState .textures [i ] = texture ;
@@ -2472,9 +2475,12 @@ import lime.math.Vector2;
24722475 texture .__alphaTexture .__setSamplerState (samplerState );
24732476 gl .uniform1i (__state .program .__agalAlphaSamplerEnabled [sampler ].location , 1 );
24742477
2475- #if (desktop && !html5)
2476- // TODO: Cache?
2477- gl .enable (gl. TEXTURE_2D );
2478+ #if lime
2479+ if (__context .type == OPENGL )
2480+ {
2481+ // TODO: Cache?
2482+ gl .enable (gl. TEXTURE_2D );
2483+ }
24782484 #end
24792485 }
24802486 else
Original file line number Diff line number Diff line change @@ -84,13 +84,7 @@ class TextureBase extends EventDispatcher
8484 {
8585 __supportsBGRA = true ;
8686 __textureFormat = bgraExtension. BGRA_EXT ;
87-
88- #if (lime && !ios && !tvos)
89- if (context .__context .type == OPENGLES )
90- {
91- __textureInternalFormat = bgraExtension. BGRA_EXT ;
92- }
93- #end
87+ __textureInternalFormat = bgraExtension. BGRA_EXT ;
9488 }
9589 else
9690 {
@@ -369,8 +363,13 @@ class TextureBase extends EventDispatcher
369363 gl .texParameteri (__textureTarget , gl. TEXTURE_MAG_FILTER , magFilter );
370364 gl .texParameteri (__textureTarget , gl. TEXTURE_WRAP_S , wrapModeS );
371365 gl .texParameteri (__textureTarget , gl. TEXTURE_WRAP_T , wrapModeT );
372- gl .texParameterf (__textureTarget , 34049 , state .lodBias ); // GL_TEXTURE_LOD_BIAS
373366
367+ #if lime
368+ if (__context .__context .type == OPENGL )
369+ {
370+ gl .texParameterf (__textureTarget , 0x8501 , state .lodBias ); // GL_TEXTURE_LOD_BIAS
371+ }
372+ #end
374373
375374 if (__samplerState == null ) __samplerState = state .clone ();
376375 __samplerState .copyFrom (state );
Original file line number Diff line number Diff line change @@ -441,7 +441,7 @@ class ShaderMacro
441441 {
442442 // Specify the default glVersion.
443443 // We can use compile defines to guess the value that prevents crashes in the majority of cases.
444- return #if (android) " 100" #elseif (web) " 100 " #elseif (mac) " 120 " #elseif (desktop) " 150 " #else " 100 " #end ;
444+ return " 100" ;
445445 }
446446
447447 /**
You can’t perform that action at this time.
0 commit comments