summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 90b6ce2)
raw | patch | inline | side by side (parent: 90b6ce2)
author | mittorn <mittorn@sibmail.com> | |
Wed, 26 Aug 2015 18:41:03 +0000 (01:41 +0700) | ||
committer | mittorn <mittorn@sibmail.com> | |
Wed, 26 Aug 2015 18:41:03 +0000 (01:41 +0700) |
Android.mk | patch | blob | history | |
GL/glesinterface.h | patch | blob | history | |
eglwrap.c | [moved from eglwrap.cpp with 97% similarity] | patch | blob | history |
nanoWrap.c | [moved from nanoWrap.cpp with 98% similarity] | patch | blob | history |
nanogl.c | [moved from nanogl.cpp with 100% similarity] | patch | blob | history |
diff --git a/Android.mk b/Android.mk
index 11fc7cd270cc5f91635579cb2f63148cdccf542b..b0bf54128268b271c54475b13c2d5f646af08497 100644 (file)
--- a/Android.mk
+++ b/Android.mk
LOCAL_MODULE := NanoGL
-LOCAL_CFLAGS += $(CFLAGS_OPT)
-ifeq ($(TARGET_ARCH_ABI),armeabi-v7a-hard)
-LOCAL_CFLAGS += $(CFLAGS_OPT_ARM) -mfloat-abi=hard -mhard-float -DLOAD_HARDFP -DSOFTFP_LINK
-endif
-ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
-LOCAL_CFLAGS += $(CFLAGS_OPT_ARM) -mfloat-abi=softfp
-endif
-ifeq ($(TARGET_ARCH_ABI),armeabi)
-LOCAL_CFLAGS += $(CFLAGS_OPT_ARMv5)
-endif
-ifeq ($(TARGET_ARCH_ABI),x86)
-LOCAL_CFLAGS += $(CFLAGS_OPT_X86)
-endif
+include $(XASH3D_CONFIG)
LOCAL_CFLAGS +=
LOCAL_C_INCLUDES := $(LOCAL_PATH)/GL
LOCAL_SRC_FILES := \
- nanogl.cpp \
- nanoWrap.cpp \
- eglwrap.cpp
+ nanogl.c \
+ nanoWrap.c \
+ eglwrap.c
LOCAL_LDLIBS := -llog
diff --git a/GL/glesinterface.h b/GL/glesinterface.h
index 46de9e4bda9cb1423fd179c9ce0df6a35ac61255..6f285711770591001b316c99f4beb34cca2cdc7a 100644 (file)
--- a/GL/glesinterface.h
+++ b/GL/glesinterface.h
#define S
#endif
-struct GlESInterface
+typedef struct GlESInterface_s
{
int (*eglChooseConfig) (int dpy, const int *attrib_list, int *configs, int config_size, int *num_config) S;
int (*eglGetDisplay) (int display) S;
int (*eglGetError) (void) S;
- void (*(*eglGetProcAddress) (const char *procname))(...) S;
+ void *(*eglGetProcAddress) (const char *procname) S;
int (*eglInitialize) (int dpy, int *major, int *minor) S;
int (*eglMakeCurrent) (int dpy, int draw, int read, int ctx) S;
int (*eglReleaseTexImage) (int dpy, int surface, int buffer) S;
int (*eglSurfaceAttrib) (int dpy, int surface, int attribute, int value) S;
- };
+ } GlESInterface;
#if !defined (__WINS__)
#if defined(__TARGET_FPU_VFP)
#pragma no_softfp_linkage
diff --git a/eglwrap.cpp b/eglwrap.c
similarity index 97%
rename from eglwrap.cpp
rename to eglwrap.c
index ab575195d31a82fbdf9a95605718ac248a9235c3..b551d05d378e08d770b4190318aef15f314328e5 100644 (file)
rename from eglwrap.cpp
rename to eglwrap.c
index ab575195d31a82fbdf9a95605718ac248a9235c3..b551d05d378e08d770b4190318aef15f314328e5 100644 (file)
--- a/eglwrap.cpp
+++ b/eglwrap.c
#include <string.h>
-extern "C++" GlESInterface* glEsImpl;
-extern "C++" void FlushOnStateChange();
+extern GlESInterface* glEsImpl;
+extern void FlushOnStateChange();
EGLint eglGetError (void)
}
#if defined(__MULTITEXTURE_SUPPORT__)
-extern "C" void glMultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t );
+void glMultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t );
#endif
void * eglGetProcAddress (const char *procname)
diff --git a/nanoWrap.cpp b/nanoWrap.c
similarity index 98%
rename from nanoWrap.cpp
rename to nanoWrap.c
index a30a009de2421771b32292914fa1ae480c96ed7a..c07a9ec70de314285727f88f3a8cc5ede11559e0 100644 (file)
rename from nanoWrap.cpp
rename to nanoWrap.c
index a30a009de2421771b32292914fa1ae480c96ed7a..c07a9ec70de314285727f88f3a8cc5ede11559e0 100644 (file)
--- a/nanoWrap.cpp
+++ b/nanoWrap.c
static struct nanotmuState* activetmuState = &tmuState0;
-extern "C++" GlESInterface* glEsImpl;
+extern GlESInterface* glEsImpl;
static GLenum wrapperPrimitiveMode = GL_QUADS;
GLboolean useTexCoordArray = GL_FALSE;
static GLboolean delayedttmuchange = GL_FALSE;
static GLenum delayedtmutarget = GL_TEXTURE0;
-struct VertexAttrib
+typedef struct VertexAttrib_s
{
float x;
float y;
float s_multi;
float t_multi;
#endif
- };
+ } VertexAttrib;
static VertexAttrib vertexattribs[40000];
memcpy(&nanoglState, &nanoglInitState, sizeof(struct nanoState));
memcpy(&tmuState0,&tmuInitState,sizeof(struct nanotmuState));
memcpy(&tmuState1,&tmuInitState,sizeof(struct nanotmuState));
- memcpy(¤tVertexAttrib,¤tVertexAttribInit,sizeof(struct VertexAttrib));
+ memcpy(¤tVertexAttrib,¤tVertexAttribInit,sizeof(VertexAttrib));
activetmuState = &tmuState0;
wrapperPrimitiveMode = GL_QUADS;
break;
case GL_TRIANGLES:
{
- int vcount = (vertexCount-vertexMark)/3;
- for (int count = 0; count < vcount; count++)
+ int count, vcount = (vertexCount-vertexMark)/3;
+ for (count = 0; count < vcount; count++)
{
*ptrIndexArray++ = indexCount;
*ptrIndexArray++ = indexCount+1;
int vcount = ((vertexCount-vertexMark)-3);
if (vcount && ((long)ptrIndexArray & 0x02))
{
+ unsigned int *longptr;
+ int count;
*ptrIndexArray++ = indexCount-1; // 2
*ptrIndexArray++ = indexCount-2; // 1
*ptrIndexArray++ = indexCount; // 3
vcount-=1;
int odd = vcount&1;
vcount/=2;
- unsigned int* longptr = (unsigned int*) ptrIndexArray;
+ longptr = (unsigned int*) ptrIndexArray;
- for (int count = 0; count < vcount; count++)
+ for (count = 0; count < vcount; count++)
{
*(longptr++) = (indexCount-2) | ((indexCount-1)<<16);
*(longptr++) = (indexCount) | ((indexCount)<<16);
else
{
//already aligned
+ unsigned int *longptr;
+ int count;
int odd = vcount&1;
vcount/=2;
- unsigned int* longptr = (unsigned int*) ptrIndexArray;
+ longptr = (unsigned int*) ptrIndexArray;
- for (int count = 0; count < vcount; count++)
+ for (count = 0; count < vcount; count++)
{
*(longptr++) = (indexCount-1) | ((indexCount-2)<<16);
*(longptr++) = (indexCount) | ((indexCount-1)<<16);
case GL_POLYGON:
case GL_TRIANGLE_FAN:
{
+ int count, vcount = ((vertexCount-vertexMark)-3);
*ptrIndexArray++ = indexCount++;
*ptrIndexArray++ = indexCount++;
*ptrIndexArray++ = indexCount++;
- int vcount = ((vertexCount-vertexMark)-3);
- for (int count = 0; count < vcount; count++)
+
+ for (count = 0; count < vcount; count++)
{
*ptrIndexArray++ = indexbase;
*ptrIndexArray++ = indexCount-1;
@@ -1037,7 +1042,7 @@ void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei wid
glEsImpl->glTexImage2D(target, level, internalformat, width, height,border,format,type,pixels);
}
-void glDrawBuffer(GLenum /*mode*/)
+void glDrawBuffer(GLenum mode)
{
}
@@ -1395,7 +1400,7 @@ void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum forma
glEsImpl->glReadPixels(x,y,width,height,format,type,pixels);
}
-void glReadBuffer( GLenum /*mode*/ )
+void glReadBuffer( GLenum mode )
{
}
#if defined(__MULTITEXTURE_SUPPORT__)
-extern "C" void glMultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t );
+void glMultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t );
void glMultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t )
{
diff --git a/nanogl.cpp b/nanogl.c