"Options" : {
"ExcludeFromBuild" : false
}
+ },
+ {
+ "Name" : "Emscripten",
+ "Options" : {
+ "ExcludeFromBuild" : false
+ }
}
]
},
{
"Name" : "Emscripten",
"Options" : {
- "ExcludeFromBuild" : false
+ "ExcludeFromBuild" : true
}
}
]
import "immediate"
import "Display"
+import "OpenGLDisplayDriver"
// Kept public for now
public void GLABDeleteBuffers(int count, GLAB * buffers)
(float)matrix.m[3][0], (float)matrix.m[3][1], (float)matrix.m[3][2], (float)matrix.m[3][3]
};
#ifdef SHADERS
+ memcpy(matrixStack[curStack][matrixIndex[curStack]].array, matrix.array, sizeof(Matrix));
shader_LoadMatrixf((MatrixMode) (0x1700 + curStack), m);
#else
glLoadMatrixf(m);
}
}
+public void glmsLoadMatrixf(float * i)
+{
+ double m[16] =
+ {
+ i[0*4+0], i[0*4+1], i[0*4+2], i[0*4+3],
+ i[1*4+0], i[1*4+1], i[1*4+2], i[1*4+3],
+ i[2*4+0], i[2*4+1], i[2*4+2], i[2*4+3],
+ i[3*4+0], i[3*4+1], i[3*4+2], i[3*4+3]
+ };
+ memcpy(matrixStack[curStack][matrixIndex[curStack]].array, i, 16*sizeof(double));
+ LoadCurMatrix();
+}
+
public void glmsLoadMatrixd(double * i)
{
memcpy(matrixStack[curStack][matrixIndex[curStack]].array, i, sizeof(Matrix));
#define CPUCONF_LONG_SIZESHIFT ((sizeof(long) == 2) ? 2 : 3)
#define CPUCONF_LONG_BITS (sizeof(long) * 8)
#else
+
+#if !defined(__EMSCRIPTEN__)
#define CPUCONF_ARCH_IA32
+#endif
#define CPUCONF_INTPTR_BITS (32)
#define CPUCONF_POINTER_BITS (32)
bitmap->map = 0;
if( mapsize )
{
+#ifdef MM_ATOMIC_SUPPORT
if( !( bitmap->map = malloc( mapsize * sizeof(mmAtomicL) ) ) )
+#else
+ if( !( bitmap->map = malloc( mapsize * sizeof(long) ) ) )
+#endif
return 0;
}
bitmap->mapsize = mapsize;
#define SHADERS
#endif
+#if defined(__EMSCRIPTEN__)
+ #define ES2
+ #include <GLES2/gl2.h>
+#endif
+
#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__ODROID__)
# if defined(SHADERS)
//# include "gl_core_3_3.h"
#undef glVertex3fv
#undef glLoadMatrixd
+ #undef glLoadMatrixf
#undef glMultMatrixd
#undef glFrustum
#undef glOrtho
#define glVertex3fv glimtkVertex3fv
#define glLoadMatrixd glmsLoadMatrixd
+ #define glLoadMatrixf glmsLoadMatrixf
#define glMultMatrixd glmsMultMatrixd
#define glFrustum glmsFrustum
#define glOrtho glmsOrtho
return program;
}
+#if !defined(__EMSCRIPTEN__)
static void flushRenderDrawBufferArchaic( DMDrawBuffer drawBuffer, DMProgram program, int vertexCount )
{
glEnable( GL_TEXTURE_2D );
}
}
+#endif
void flushRenderDrawBuffer( DMDrawBuffer drawBuffer, DMProgram program, int vertexCount )
{
drawBuffer = &this.drawBuffer[this.drawBufferIndex];
this.drawBufferIndex = ( this.drawBufferIndex + 1 ) % DM_CONTEXT_DRAW_BUFFER_COUNT;
glBindBuffer( GL_ARRAY_BUFFER, drawBuffer->vbo );
+
+#if !defined(__EMSCRIPTEN__)
vboVertex = glMapBuffer( GL_ARRAY_BUFFER, GL_WRITE_ONLY );
+#endif
vertexcount = 0;
glActiveTexture( GL_TEXTURE0 );
{
if( vertexcount )
{
+#if !defined(__EMSCRIPTEN__)
glUnmapBuffer( GL_ARRAY_BUFFER );
+#endif
// Flush font manager texture updates
flush();
drawBuffer = &this.drawBuffer[this.drawBufferIndex];
this.drawBufferIndex = ( this.drawBufferIndex + 1 ) % DM_CONTEXT_DRAW_BUFFER_COUNT;
glBindBuffer( GL_ARRAY_BUFFER, drawBuffer->vbo );
+#if !defined(__EMSCRIPTEN__)
vboVertex = glMapBuffer( GL_ARRAY_BUFFER, GL_WRITE_ONLY );
+#endif
vertexcount = 0;
}
vertexcount += 6;
}
+#if !defined(__EMSCRIPTEN__)
glUnmapBuffer( GL_ARRAY_BUFFER );
+#endif
// Flush font manager texture updates
flush();
// Render buffered images
// Save OpenGL state
// FIXME: no glPushAttrib() in core profile
-//#ifndef SHADERS
+#if !defined(__EMSCRIPTEN__)
glPushClientAttrib( GL_CLIENT_ALL_ATTRIB_BITS );
glPushAttrib( GL_ALL_ATTRIB_BITS );
-//#endif
+#endif
// Prepare rendering pass
matrixOrtho( matrix, 0.0, (float)viewportwidth, (float)viewportheight, 0.0, -1.0f, 1.0 );
if(flags.prehistoricOpenGL)
{
- glMatrixMode(GL_PROJECTION);
+ glMatrixMode(projection);
glLoadMatrixf(matrix);
- glMatrixMode(GL_MODELVIEW);
+ glMatrixMode(modelView);
glLoadIdentity();
glScalef(4,4,4);
}
void flushImages( )
{
+#if !defined(__EMSCRIPTEN__)
if( flags.prehistoricOpenGL )
flushDrawImagesArchaic( );
else
+#endif
flushDrawImages( );
if(vboAvailable)
glUseProgram( prevProgram );
// Restore OpenGL state
// FIXME: no glPushAttrib() in core profile
-//#ifndef SHADERS
+#if !defined(__EMSCRIPTEN__)
glPopAttrib();
glPopClientAttrib();
-//#endif
+#endif
}
void drawBarrier( )
# endif
#endif
+#if defined(__EMSCRIPTEN__)
+ #define ES2
+ #include <GLES2/gl2.h>
+#endif
+
#include "cc.h"
#include "mm.h"
{
if(texture)
{
-#ifdef SHADERS
+#if defined(SHADERS) && !defined(__EMSCRIPTEN__)
int glformat = GL_RED;
#else
int glformat = GL_ALPHA;
int h = rect[3] - rect[1];
if( channelcount == 1 );
+#if !defined(__EMSCRIPTEN__)
else if( channelcount == 2 )
glformat = GL_RG;
+#endif
else if( channelcount == 3 )
glformat = GL_RGB;
else if( channelcount == 4 )
glformat = GL_RGBA;
// FIXME: no glPushAttrib() in core profile
-//#ifndef SHADERS
+#if !defined(__EMSCRIPTEN__)
glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT );
glPushAttrib( GL_TEXTURE_BIT );
-//#endif
+#endif
glBindTexture( GL_TEXTURE_2D, texture.glTex );
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
+#if !defined(__EMSCRIPTEN__)
glPixelStorei( GL_UNPACK_ROW_LENGTH, textureWidth );
glPixelStorei( GL_UNPACK_SKIP_PIXELS, rect[0] );
glPixelStorei( GL_UNPACK_SKIP_ROWS, rect[1] );
+#endif
glTexSubImage2D( GL_TEXTURE_2D, 0, rect[0], rect[1], w, h, glformat, GL_UNSIGNED_BYTE, data );
-//#ifndef SHADERS
+#if !defined(__EMSCRIPTEN__)
glPopAttrib();
glPopClientAttrib();
-//#endif
+#endif
#if 0
IMGImage image;
# endif
#endif
+#if defined(__EMSCRIPTEN__)
+ #define ES2
+ #include <GLES2/gl2.h>
+#endif
+
// TOFIX:
int GL_ARB_texture_non_power_of_two = 1;
int GL_EXT_texture_filter_anisotropic = 1;
if( image.format.bytesPerPixel == 1 )
{
-#ifdef SHADERS
+#if defined(SHADERS) && !defined(__EMSCRIPTEN__)
glformat = GL_RED;
#else
glformat = GL_ALPHA;
#endif
}
+#if defined(SHADERS) && !defined(__EMSCRIPTEN__)
else if( image.format.bytesPerPixel == 2 )
glformat = GL_RG;
+#endif
else if( image.format.bytesPerPixel == 3 )
glformat = GL_RGB;
else if( image.format.bytesPerPixel == 4 )
for(link = class(Interface).derivatives.first; link; link = link.next)
{
bool foundDriver = false;
- int c, numDrivers;
+ int c, numDrivers = 0;
const char ** graphicsDrivers;
inter = link.data;
int UnlockEx(void)
{
- int count = lockMutex.owningThread == GetCurrentThreadID() ? lockMutex.lockCount : 0;
+ int count;
#if !defined(__EMSCRIPTEN__)
int i;
+ count = lockMutex.owningThread == GetCurrentThreadID() ? lockMutex.lockCount : 0
for(i = 0; i < count; i++)
{
#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__)