import "Object"
#if defined(__EMSCRIPTEN__)
-#define ES2
+#if !defined(_GLES2)
+#define _GLES2
+#endif
#endif
#if defined(__ANDROID__) || defined(__ODROID__)
-#define ES1_1
+#define _GLES
#endif
-#if !defined(ES1_1) && !defined(ES2)
+#if !defined(_GLES) && !defined(_GLES2)
#define USE_32_BIT_INDICES true
#define indicesMember indices32
#define uintindex uint32
namespace gfx::drivers;
-#if defined(_GLES)
- #define ES1_1
-#else
+#if !defined(_GLES) // OpenGL ES 1
#define SHADERS
#endif
#endif
#if defined(__ANDROID__) || defined(__ODROID__)
- #if defined(__ODROID__) && !defined(ES1_1)
- #define ES1_1
+ #if defined(__ODROID__) && !defined(_GLES)
+ #define _GLES
#endif
#define uint _uint
#undef class
#elif defined(__EMSCRIPTEN__)
- #define ES2
- // #define ES1_1
+#if !defined(_GLES2)
+ #define _GLES2
+#endif
+ // #define _GLES
#define property _property
#define uint _uint
#define APIENTRY
#endif
-#if defined(ES1_1) || defined(ES2) || defined(SHADERS)
+#if defined(_GLES) || defined(_GLES2) || defined(SHADERS)
#undef glRecti
#undef glBegin
}
static GLuint stippleTexture;
-#if defined(ES1_1) || defined(ES2) || defined(SHADERS)
+#if defined(_GLES) || defined(_GLES2) || defined(SHADERS)
static bool stippleEnabled;
#endif
static int primitiveTypes[RenderPrimitiveType] =
{
GL_POINTS, GL_LINES, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN,
-#if defined(SHADERS) || defined(ES1_1) || defined(ES2)
+#if defined(SHADERS) || defined(_GLES) || defined(_GLES2)
GL_TRIANGLE_FAN, // NOTE: This will only work for single quads
#else
GLIMTKMode::quads,
// Non OpenGL ES friendly stuff
-#if defined(ES1_1) || defined(ES2)
+#if defined(_GLES) || defined(_GLES2)
//#undef GL_UNSIGNED_INT
//#undef GL_DOUBLE
{
oglDisplay.flipBufW = width;
oglDisplay.flipBufH = height;
-#if defined(ES1_1) || defined(ES2)
+#if defined(_GLES) || defined(_GLES2)
result = true;
#else
oglDisplay.flippingBuffer = renew oglDisplay.flippingBuffer ColorAlpha [width * height];
glColor4fv(oglSurface.foreground);
glBegin(GL_LINES);
-#if defined(ES1_1) || defined(ES2) || defined(SHADERS)
+#if defined(_GLES) || defined(_GLES2) || defined(SHADERS)
if(stippleEnabled)
{
glTexCoord2f(0.5f, 0);
//Logf("Rectangle\n");
glColor4fv(oglSurface.foreground);
-#if defined(ES1_1) || defined(ES2) || defined(SHADERS)
+#if defined(_GLES) || defined(_GLES2) || defined(SHADERS)
if(stippleEnabled)
{
glBegin(GL_LINES);
if(stipple)
{
-#if defined(ES1_1) || defined(ES2) || defined(SHADERS)
+#if defined(_GLES) || defined(_GLES2) || defined(SHADERS)
stippleEnabled = true;
glesLineStipple(1, (uint16)stipple);
#else
}
else
{
-#if defined(ES1_1) || defined(ES2) || defined(SHADERS)
+#if defined(_GLES) || defined(_GLES2) || defined(SHADERS)
stippleEnabled = false;
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
#endif
break;
case fillMode:
-#if !defined(ES1_1) && !defined(ES2)
+#if !defined(_GLES) && !defined(_GLES2)
glPolygonMode(GL_FRONT_AND_BACK, ((FillModeValue)value == solid) ? GL_FILL : GL_LINE);
#endif
break;
{
if(vboAvailable)
{
-#if defined(ES1_1) || defined(ES2)
+#if defined(_GLES) || defined(_GLES2)
if(indices32bit)
{
if(!oglIndices.buffer.buffer)
{
OGLIndices oglIndices = primitive->data;
GLEAB eab = ((!display.display3D.collectingHits && oglIndices && vboAvailable) ? oglIndices.buffer : noEAB);
-#if defined(ES1_1) || defined(ES2)
+#if defined(_GLES) || defined(_GLES2)
if(!vboAvailable && primitive->type.indices32bit)
{
uint16 * temp = new uint16[primitive->nIndices];
// GL Array Buffer Manipulation
-#if defined(_GLES)
- #define ES1_1
-#else
+#if !defined(_GLES)
#define SHADERS
#endif
#elif defined(__EMSCRIPTEN__)
#include <GLES2/gl2.h>
- #define ES2
+#if !defined(_GLES2)
+ #define _GLES2
+#endif
#define GL_INT 0x1404
#define GL_DOUBLE 0x140A
void useVertTrans(uint count, int n, int type, uint stride, void * pointer)
{
-#if defined(_GLES) || defined(ES1_1) || defined(ES2)
+#if defined(_GLES) || defined(_GLES2)
if(glabCurArrayBuffer != ((this != null) ? buffer : 0) && vboAvailable)
GLABBindBuffer(GL_ARRAY_BUFFER, ((this != null) ? buffer : 0));
if(type == GL_INT)
{
if(glabCurElementBuffer != ((this != null) ? buffer : 0))
GLABBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ((this != null) ? buffer : 0));
-#if defined(_GLES) || defined(ES1_1) || defined(ES2)
+#if defined(_GLES) || defined(_GLES2)
type = GL_UNSIGNED_SHORT;
#endif
glDrawElements(primType, count, type, indices);
m[0][0]=m[1][1]=m[2][2]=m[3][3]=1;
}
+ void Translate(double tx, double ty, double tz)
+ {
+ Matrix tmat;
+ Matrix mat1;
+
+ FillBytesBy4(tmat, 0, sizeof(Matrix) >> 2);
+ tmat.m[0][0]=tmat.m[1][1]=tmat.m[2][2]=tmat.m[3][3]=1;
+ tmat.m[3][0]=tx; tmat.m[3][1]=ty; tmat.m[3][2]=tz;
+ mat1.Multiply(this, tmat);
+ this = mat1;
+ }
+
+ void Scale(double sx, double sy, double sz)
+ {
+ Matrix smat;
+ Matrix mat1;
+ FillBytesBy4(smat, 0, sizeof(Matrix) >> 2);
+ smat.m[0][0]=sx; smat.m[1][1]=sy; smat.m[2][2]=sz; smat.m[3][3]=1;
+ mat1.Multiply(this, smat);
+ this = mat1;
+ }
+
void Transpose(Matrix source)
{
int i,j;
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));
+ memcpy(matrixStack[curStack][matrixIndex[curStack]].array, m, 16*sizeof(double));
LoadCurMatrix();
}
LoadCurMatrix();
}
+public void glmsScaled( double a, double b, double c )
+{
+ Matrix m, r;
+
+ m.Identity();
+ m.Scale(a,b,c);
+ r.Multiply(m, matrixStack[curStack][matrixIndex[curStack]]);
+ matrixStack[curStack][matrixIndex[curStack]] = r;
+ LoadCurMatrix();
+}
+
+public void glmsTranslated( double a, double b, double c )
+{
+ Matrix m, r;
+
+ m.Identity();
+ m.Translate(a,b,c);
+ r.Multiply(m, matrixStack[curStack][matrixIndex[curStack]]);
+ matrixStack[curStack][matrixIndex[curStack]] = r;
+ LoadCurMatrix();
+}
+
+#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA)
public void glmsFrustum( double l, double r, double b, double t, double n, double f )
{
nearPlane = n;
}
}
-#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA)
public void glmsRotated( double a, double b, double c, double d )
{
Quaternion q;
matrixStack[curStack][matrixIndex[curStack]] = r;
LoadCurMatrix();
}
-public void glmsScaled( double a, double b, double c )
-{
- Matrix m, r;
-
- m.Identity();
- m.Scale(a,b,c);
- r.Multiply(m, matrixStack[curStack][matrixIndex[curStack]]);
- matrixStack[curStack][matrixIndex[curStack]] = r;
- LoadCurMatrix();
-}
-
-public void glmsTranslated( double a, double b, double c )
-{
- Matrix m, r;
-
- m.Identity();
- m.Translate(a,b,c);
- r.Multiply(m, matrixStack[curStack][matrixIndex[curStack]]);
- matrixStack[curStack][matrixIndex[curStack]] = r;
- LoadCurMatrix();
-}
public void glmsMultMatrixd( double * i )
{
glUniform1i(uTexturingOn, on);
}
+#if !defined(ECERE_NO3D)
public void shader_setMaterial(Material material, bool perVertexColor)
{
glUniform1i(uPerVertexColor, perVertexColor);
glUniform1f(uMatPower, material.power);
glUniform1f(uMatOpacity, material.opacity);
}
+#endif
public void shader_setSimpleMaterial(ColorAlpha color)
{
glUniform1i(uPerVertexColor, perVertexColor);
}
+#if !defined(ECERE_NO3D)
void shader_setLight(Display display, uint id, Light light)
{
if(light != null)
else
glUniform1i(uLightsOn[id], 0);
}
+#endif
bool loadShaders(const String vertexShaderFile, const String fragmentShaderFile)
{
"TargetFileName" : "mandelbrot.html",
"Libraries" : [
"ecereStatic",
- "z",
- "jpeg",
- "png",
- "freetype"
+ "z"
],
"LibraryDirs" : [
- "../../../ecere/obj/emscripten.linux.emscripten"
+ "../../../ecere/obj/minEmscripten.linux.emscripten"
],
"FastMath" : true
}