{
if(stippleTexture)
{
- glDeleteTextures(1, (int *)&stippleTexture);
+ glDeleteTextures(1, &stippleTexture);
stippleTexture = 0;
}
if(eglDisplay != EGL_NO_DISPLAY)
shortBDSize = 0;
}
-static int stippleTexture;
+static GLuint stippleTexture;
static bool stippleEnabled;
void glesLineStipple( int i, unsigned short j )
#ifdef __ANDROID__
glGenBuffers(count, buffer);
#else
+#if defined(__WIN32__)
if(glGenBuffersARB)
+#endif
glGenBuffersARB(count, buffer);
#endif
}
-void GLDeleteBuffers(int count, uint * buffer)
+void GLDeleteBuffers(int count, GLuint * buffer)
{
#ifdef __ANDROID__
glDeleteBuffers(count, buffer);
#else
+#if defined(__WIN32__)
if(glDeleteBuffersARB)
+#endif
glDeleteBuffersARB(count, buffer);
#endif
}
#ifdef __ANDROID__
glBindBuffer(target, buffer);
#else
+#if defined(__WIN32__)
if(glBindBufferARB)
+#endif
glBindBufferARB(target, buffer);
#endif
}
else
glBufferData(target, size, data, usage);
#else
+
+#if defined(__WIN32__)
if(glBufferDataARB)
+#endif
glBufferDataARB(target, size, data, usage);
#endif
class OGLMesh : struct
{
- int vertices;
- int normals;
- int texCoords;
- int texCoords2;
- int colors;
+ uint vertices;
+ uint normals;
+ uint texCoords;
+ uint texCoords2;
+ uint colors;
};
class OGLIndices : struct
{
uint16 * indices;
- int buffer;
- int nIndices;
+ uint buffer;
+ uint nIndices;
};
#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA)
bool Lock(Display display)
{
OGLDisplay oglDisplay = display.driverData;
- OGLSystem oglSystem = display.displaySystem.driverData;
if(useSingleGLContext) return true;
#if defined(__WIN32__)
void ::CheckExtensions(OGLSystem oglSystem)
{
- char * extensions = glGetString(GL_EXTENSIONS);
+ const char * extensions = (const char *)glGetString(GL_EXTENSIONS);
if(extensions)
oglSystem.pow2textures = strstr(extensions, "GL_ARB_texture_non_power_of_two") ? false : true;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &oglSystem.maxTextureSize);
#endif
if(result)
{
-#if !defined(__OLDX__)
+#if defined(__WIN32__)
if(glBlendFuncSeparate)
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
else
-#endif
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+#else
+#if !defined(__OLDX__)
+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+#else
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+#endif
+#endif
glEnable(GL_BLEND);
glMatrixMode(GL_MODELVIEW);
bool DisplaySize(Display display, int width, int height)
{
OGLDisplay oglDisplay = display.driverData;
- OGLSystem oglSystem = display.displaySystem.driverData;
bool result = false;
//printf("Inside DisplaySize\n");
#if defined(__WIN32__) || defined(USEPBUFFER)
+ OGLSystem oglSystem = display.displaySystem.driverData;
if(display.alphaBlend)
{
#if defined(__WIN32__)
void Update(Display display, Box updateBox)
{
+#if defined(__WIN32__) || defined(USEPBUFFER)
OGLDisplay oglDisplay = display.driverData;
+#endif
//Logf("DisplayScreen\n");
glFlush();
void FreeBitmap(DisplaySystem displaySystem, Bitmap bitmap)
{
- glDeleteTextures(1, (int *)&bitmap.driverData);
- bitmap.driverData = 0;
-
+ if(bitmap.driverData)
+ {
+ GLuint tex = (GLuint)(uintptr)bitmap.driverData;
+ glDeleteTextures(1, &tex);
+ bitmap.driverData = 0;
+ }
bitmap.driver = ((subclass(DisplayDriver))class(LFBDisplayDriver));
}
OGLSystem oglSystem = displaySystem.driverData;
bool result = false;
Bitmap mipMap { };
- int glBitmap = -1;
+ GLuint glBitmap = 0;
uint w = width, h = height;
if(oglSystem.pow2textures)
delete mipMap;
- bitmap.driverData = (void *)glBitmap;
+ bitmap.driverData = (void *)(uintptr)glBitmap;
bitmap.driver = displaySystem.driver;
bitmap.width = w;
bitmap.height = h;
{
int c, level;
uint w = bitmap.width, h = bitmap.height;
- int glBitmap = -1;
+ GLuint glBitmap = 0;
if(oglSystem.pow2textures)
{
w = pow2i(w);
w = Min(w, oglSystem.maxTextureSize);
h = Min(h, oglSystem.maxTextureSize);
- if(w * 2 < h) w = h / 2;
- else if(h * 2 < w) h = w / 2;
+ if(mipMaps)
+ {
+ while(w * 2 < h) w *= 2;
+ while(h * 2 < w) h *= 2;
+ }
// Switch ARGB to RGBA
//if(bitmap.format != pixelFormatRGBA)
glGetError();
glGenTextures(1, &glBitmap);
- if(glBitmap == -1)
+ if(glBitmap == 0)
{
- int error = glGetError();
+ //int error = glGetError();
return false;
- //Print("");
}
glBindTexture(GL_TEXTURE_2D, glBitmap);
if(!bitmap.keepData)
bitmap.driver.FreeBitmap(bitmap.displaySystem, bitmap);
- bitmap.driverData = (void *)glBitmap;
+ bitmap.driverData = (void *)(uintptr)glBitmap;
bitmap.driver = displaySystem.driver;
if(!result)
else if(oglSurface.xOffset)
glTranslated(oglSurface.xOffset / 64.0/*-0.375*/, 0.0, 0.0);
- glBindTexture(GL_TEXTURE_2D, (uint)bitmap.driverData);
+ glBindTexture(GL_TEXTURE_2D, (GLuint)(uintptr)bitmap.driverData);
glBegin(GL_QUADS);
if(h < 0)
#endif
glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, (uint)bitmap.driverData);
+ glBindTexture(GL_TEXTURE_2D, (GLuint)(uintptr)bitmap.driverData);
glColor4fv(oglSurface.bitmapMult);
void StretchDI(Display display, Surface surface, Bitmap bitmap, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
{
float s2dw,s2dh,d2sw,d2sh;
- bool flipX = false, flipY = false;
+ //bool flipX = false, flipY = false;
//Logf("StretchDI\n");
{
w = Abs(w);
sw = Abs(sw);
- flipX = true;
+ //flipX = true;
}
if(Sgn(h) != Sgn(sh))
{
h = Abs(h);
sh = Abs(sh);
- flipY = true;
+ //flipY = true;
}
s2dw=(float)w / sw;
((subclass(DisplayDriver))class(LFBDisplayDriver)).UnloadFont(displaySystem, font);
}
- Font LoadFont(DisplaySystem displaySystem, char * faceName, float size, FontFlags flags)
+ Font LoadFont(DisplaySystem displaySystem, const char * faceName, float size, FontFlags flags)
{
Font font;
OGLSystem oglSystem = displaySystem.driverData;
return font;
}
- void FontExtent(DisplaySystem displaySystem, Font font, char * text, int len, int * width, int * height)
+ void FontExtent(DisplaySystem displaySystem, Font font, const char * text, int len, int * width, int * height)
{
((subclass(DisplayDriver))class(LFBDisplayDriver)).FontExtent(displaySystem, font, text, len, width, height);
}
- void WriteText(Display display, Surface surface, int x, int y, char * text, int len)
+ void WriteText(Display display, Surface surface, int x, int y, const char * text, int len)
{
OGLSurface oglSurface = surface.driverData;
OGLSystem oglSystem = display.displaySystem.driverData;
oglSurface.opaqueText = opaque;
}
- void TextExtent(Display display, Surface surface, char * text, int len, int * width, int * height)
+ void TextExtent(Display display, Surface surface, const char * text, int len, int * width, int * height)
{
OGLSurface oglSurface = surface.driverData;
OGLSystem oglSystem = display.displaySystem.driverData;
break;
case depthWrite:
if(value) glDepthMask((byte)bool::true); else glDepthMask((byte)bool::false);
- oglDisplay.depthWrite = value;
+ oglDisplay.depthWrite = (bool)value;
break;
case fogColor:
{
break;
}
case fogDensity:
- value *= nearPlane;
- glFogf(GL_FOG_DENSITY, *(float *)(void *)&value);
+ glFogf(GL_FOG_DENSITY, (float)(RenderStateFloat { value }.f * nearPlane));
break;
case blend:
if(value) glEnable(GL_BLEND); else glDisable(GL_BLEND);
{
float pickX = display.display3D.pickX + surface.offset.x;
float pickY = display.height - (display.display3D.pickY + surface.offset.y) - 1;
- Matrix pickMatrix =
+ Matrix pickMatrix
{
{
w / display.display3D.pickWidth, 0, 0, 0,
{
Bitmap map = material.baseMap;
glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, (uint)map.driverData);
+ glBindTexture(GL_TEXTURE_2D, (GLuint)(uintptr)map.driverData);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
//Logf("SelectMesh\n");
#if !defined( __ANDROID__) && !defined(__APPLE__)
- if(display.display3D.mesh && glUnlockArraysEXT)
- glUnlockArraysEXT();
+#if defined(__WIN32__)
+ if(glUnlockArraysEXT)
+#endif
+ if(display.display3D.mesh)
+ glUnlockArraysEXT();
#endif
if(mesh)
{
- OGLDisplay oglDisplay = display.driverData;
OGLMesh oglMesh = mesh.data;
// *** Vertex Stream ***
}
#if !defined(__ANDROID__) && !defined(__APPLE__)
- if(glLockArraysEXT) glLockArraysEXT(0, mesh.nVertices);
+
+#if defined(__WIN32__)
+ if(glLockArraysEXT)
+#endif
+ glLockArraysEXT(0, mesh.nVertices);
#endif
}
else
void DrawPrimitives(Display display, PrimitiveSingle * primitive, Mesh mesh)
{
- OGLDisplay oglDisplay = display.driverData;
//Logf("DrawPrimitives\n");
if(primitive->type.vertexRange)
useSingleGLContext = useSingle;
}
-default dllexport void * __attribute__((stdcall)) IS_GLGetContext(DisplaySystem displaySystem)
+default dllexport void *
+#if defined(__WIN32__)
+__attribute__((stdcall))
+#endif
+IS_GLGetContext(DisplaySystem displaySystem)
{
- void * context = null;
if(displaySystem)
{
OGLSystem system = displaySystem.driverData;