ecere/gfx/newFonts: Fixed to work with meta shader
authorJerome St-Louis <jerome@ecere.com>
Thu, 28 Jul 2016 21:27:03 +0000 (17:27 -0400)
committerJerome St-Louis <jerome@ecere.com>
Wed, 2 Nov 2016 16:32:50 +0000 (12:32 -0400)
ecere/src/gfx/newFonts/cc/mmbitmap.h
ecere/src/gfx/newFonts/drawManager.ec
ecere/src/gfx/newFonts/textureManager.ec

index 1ae7122..33360c7 100644 (file)
 #endif
 
 #if !defined(MM_ATOMIC_SUPPORT)
- #warning Compiling mmbitmap without atomic support, it is going to be SLOW.
+ //#warning Compiling mmbitmap without atomic support, it is going to be SLOW.
+#ifndef MM_H
  #warning This header requires mm.h
 #endif
+#endif
 
 
 typedef struct
index fb71490..4708c9d 100644 (file)
@@ -32,7 +32,7 @@ class DMImageFlags : uint16
 {
    bool empty:1;     // Image is empty, do not draw
    bool blending:1;  // Must draw image with blending
-   int swizzle:2;
+   SwizzleMode swizzle:2;
 }
 
 #define DM_BARRIER_ORDER_BITS 5
@@ -192,6 +192,7 @@ public class DrawManager
       GLVertexPointer  (2, GL_SHORT, sizeof(DMDrawVertex), (void *)OFFSET(DMDrawVertex, vx) );
       GLTexCoordPointer(2, GL_SHORT, sizeof(DMDrawVertex), (void *)OFFSET(DMDrawVertex, tx) );
 
+      GLFlushMatrices();
       glDrawArrays( GL_TRIANGLES, 0, vertexCount );
    }
 
@@ -204,7 +205,7 @@ public class DrawManager
       {
          bool stateBlend = true;
 #if ENABLE_GL_SHADERS
-         int swizzleMode = 0;
+         SwizzleMode swizzleMode = off;
 #endif
          int vertexCount = 0;
          int index;
@@ -222,13 +223,12 @@ public class DrawManager
 
          glabCurArrayBuffer = 0;
 
-         GLFlushMatrices();
-
          glDisable(GL_DEPTH_TEST);
          glDisable(GL_CULL_FACE);
          GLSetupFog(false);
          GLSetupTexturing(true);
          GLSetupLighting(false);
+
          GLEnableClientState(VERTICES);
          GLEnableClientState(TEXCOORDS);
          glEnable(GL_BLEND);
@@ -288,7 +288,8 @@ public class DrawManager
                   flush();
 
                   // Render buffered images
-                  flushRenderDrawBuffer( drawBuffer, vertexCount );
+                  if(color)
+                     flushRenderDrawBuffer( drawBuffer, vertexCount );
                   drawBuffer = &drawBuffers[drawBufferIndex++];
                   drawBufferIndex %= DRAW_BUFFER_COUNT;
                   glBindBuffer( GL_ARRAY_BUFFER, drawBuffer->vbo.buffer );
@@ -315,7 +316,7 @@ public class DrawManager
                {
                   swizzleMode = image->flags.swizzle;
                   if(glCaps_shaders)
-                     shader_swizzle( swizzleMode );
+                     defaultShader.swizzle( swizzleMode );
                }
 #endif
                if( texture != bindTexture )
@@ -351,7 +352,8 @@ public class DrawManager
          flush();
 
          // Render buffered images
-         flushRenderDrawBuffer( drawBuffer, vertexCount );
+         if(color)
+            flushRenderDrawBuffer( drawBuffer, vertexCount );
          imageBufferCount = 0;
 
          ERRORCHECK();
@@ -360,7 +362,7 @@ public class DrawManager
          GLSetupTexturing(false);
 #if ENABLE_GL_SHADERS
          if(glCaps_shaders)
-            shader_swizzle(0);
+            defaultShader.swizzle(off);
 #endif
 
          if(glCaps_vertexBuffer)
index 4ddba83..f13f448 100644 (file)
@@ -36,7 +36,7 @@ class Texture : struct
    float widthinv;
    float heightinv;
    TextureFlags flags;
-   int swizzle;
+   SwizzleMode swizzle;
    uint32 orderMask;
 
    flags = { invalid = true };
@@ -49,7 +49,7 @@ public:
    {
       int width, height;
       int glformat;
-      int swizzle = 0;
+      SwizzleMode swizzle = 0;
 
       if( image.format.bytesPerPixel == 1 )
       {