diff --git a/Sources/libewol/Android.mk b/Sources/libewol/Android.mk index 25fa28ad..53bf01e6 100644 --- a/Sources/libewol/Android.mk +++ b/Sources/libewol/Android.mk @@ -18,15 +18,14 @@ LOCAL_CFLAGS := -D__PLATFORM__Android \ -DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \ -DVERSION_BUILD_TIME="\"pasd_heure\"" \ -DEWOL_USE_FREE_TYPE \ - -DDATA_IN_APK + -DDATA_IN_APK \ + -frtti # load the common sources file of the platform include $(LOCAL_PATH)/file.mk LOCAL_SRC_FILES := ewol/base/guiAndroid.cpp $(FILE_LIST) -#for freetype : https://github.com/cdave1/freetype2-android - # Ewol Test Software : LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog -lz diff --git a/Sources/libewol/ewol/OObject/2DColored.cpp b/Sources/libewol/ewol/OObject/2DColored.cpp index f645850d..ab7214a3 100644 --- a/Sources/libewol/ewol/OObject/2DColored.cpp +++ b/Sources/libewol/ewol/OObject/2DColored.cpp @@ -53,7 +53,8 @@ void ewol::OObject2DColored::Draw(void) // Enable Pointers glEnableClientState( GL_VERTEX_ARRAY ); glEnableClientState( GL_COLOR_ARRAY ); - + + //glPushMatrix(); // Set the vertex pointer to our vertex data glVertexPointer(2, oglTypeFloat_t, 0, &m_coord[0] ); diff --git a/Sources/libewol/ewol/Widget.cpp b/Sources/libewol/ewol/Widget.cpp index cdeda7dd..310937b0 100644 --- a/Sources/libewol/ewol/Widget.cpp +++ b/Sources/libewol/ewol/Widget.cpp @@ -236,13 +236,49 @@ void ewol::Widget::SetCanHaveFocus(bool canFocusState) } } +#define TEST_CLIPPING_SIZE (10) +//#define TEST_CLIPPING_SIZE (3) +//#define TEST_CLIPPING_SIZE (0) - +#ifdef __PLATFORM__Android +# define clipping_type GLfloat +# define clipping_function glClipPlanef +#else +# define clipping_type GLdouble +# define clipping_function glClipPlane +#endif bool ewol::Widget::GenDraw(void) { + glPushMatrix(); +#if 1 glTranslatef(m_origin.x,m_origin.y, 0); - //EWOL_DEBUG("Draw Custum..."); + //GLfloat + clipping_type eqn1[4] = {0.0, 1.0, 0.0, -TEST_CLIPPING_SIZE}; // less the Y pos ... + clipping_type eqn2[4] = {0.0, -1.0, 0.0, m_size.y-TEST_CLIPPING_SIZE}; // upper the y pos ... + clipping_type eqn3[4] = {1.0, 0.0, 0.0, -TEST_CLIPPING_SIZE}; // less the x pos ... + clipping_type eqn4[4] = {-1.0, 0.0, 0.0, m_size.x-TEST_CLIPPING_SIZE}; // upper the x pos ... + //EWOL_DEBUG("widget size (" << m_size.x << "," << m_size.y << ")" ); + /* clip lower half -- y < 0 */ + glEnable(GL_CLIP_PLANE0); + clipping_function(GL_CLIP_PLANE0, eqn1); + glEnable(GL_CLIP_PLANE1); + clipping_function(GL_CLIP_PLANE1, eqn2); + glEnable(GL_CLIP_PLANE2); + clipping_function(GL_CLIP_PLANE2, eqn3); + glEnable(GL_CLIP_PLANE3); + clipping_function(GL_CLIP_PLANE3, eqn4); +#else + glTranslatef(m_origin.x,m_origin.y, 0); + glEnable(GL_SCISSOR_TEST); + glScissor(TEST_CLIPPING_SIZE, TEST_CLIPPING_SIZE, m_size.x-TEST_CLIPPING_SIZE, m_size.y-TEST_CLIPPING_SIZE); +#endif bool valRet = OnDraw(); - glTranslatef(-m_origin.x,-m_origin.y, 0); + /* + glDisable(GL_CLIP_PLANE3); + glDisable(GL_CLIP_PLANE2); + glDisable(GL_CLIP_PLANE1); + glDisable(GL_CLIP_PLANE0); + */ + glPopMatrix(); return valRet; } diff --git a/Sources/libewol/ewol/Windows.cpp b/Sources/libewol/ewol/Windows.cpp index c0c7785f..038ed7e3 100644 --- a/Sources/libewol/ewol/Windows.cpp +++ b/Sources/libewol/ewol/Windows.cpp @@ -139,14 +139,35 @@ void ewol::Windows::SysDraw(void) glMatrixMode(GL_PROJECTION); glLoadIdentity(); +//#if defined(__PLATFORM__Android) glOrthoEwol(-m_size.x/2, m_size.x/2, m_size.y/2, -m_size.y/2, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(-m_size.x/2, -m_size.y/2, -1.0); +/* +#else + glOrtho(0., m_size.x, 0., -m_size.y, 1., 20.); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0, -m_size.y, -5); +#endif +*/ + //http://www.khronos.org/opengles/documentation/opengles1_0/html/glBlendFunc.html + + //glEnable(GL_POLYGON_SMOOTH); + //glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + //glShadeModel(GL_POLYGON_SMOOTH); + //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + + + //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA); + //glBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR); + GenDraw(); glDisable(GL_BLEND); diff --git a/Sources/libewol/ewol/base/guiAndroid.cpp b/Sources/libewol/ewol/base/guiAndroid.cpp index c29c8d7c..bfac25b0 100644 --- a/Sources/libewol/ewol/base/guiAndroid.cpp +++ b/Sources/libewol/ewol/base/guiAndroid.cpp @@ -95,7 +95,7 @@ void EWOL_NativeRender(void) glMatrixMode(GL_PROJECTION); glLoadIdentity(); //glOrtho(0., width, 0., -height, 1., 20.); - glOrtho(-gui_width/2, gui_width/2, gui_height/2, -gui_height/2, -1, 1); + glOrthoEwol(-gui_width/2, gui_width/2, gui_height/2, -gui_height/2, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); @@ -220,40 +220,6 @@ bool guiAbstraction::IsPressedInput(int32_t inputID) //} } - - -void glOrtho(GLfloat left, - GLfloat right, - GLfloat bottom, - GLfloat top, - GLfloat nearVal, - GLfloat farVal) -{ - GLfloat myMatrix[4*4]; - int iii; - for(iii=0; iii<4*4 ; iii++) { - myMatrix[iii] = 0; - } - myMatrix[0] = 2.0 / (right - left); - myMatrix[5] = 2.0 / (top - bottom); - myMatrix[10] = -2.0 / (farVal - nearVal); -#if 1 - myMatrix[3] = -1*(right + left) / (right - left); - myMatrix[7] = -1*(top + bottom) / (top - bottom); - myMatrix[11] = -1*(farVal + nearVal) / (farVal - nearVal); -#else - // test if matrix is not corectly instanciate ... - myMatrix[12] = -1*(right + left) / (right - left); - myMatrix[13] = -1*(top + bottom) / (top - bottom); - myMatrix[14] = -1*(farVal + nearVal) / (farVal - nearVal); -#endif - myMatrix[15] = 1; - - glLoadMatrixf(myMatrix); - - -} - #include int32_t ewol::CmdLineNb(void) { diff --git a/Sources/libewol/ewol/importgl.h b/Sources/libewol/ewol/importgl.h index eab113df..2825ab5b 100644 --- a/Sources/libewol/ewol/importgl.h +++ b/Sources/libewol/ewol/importgl.h @@ -9,15 +9,12 @@ extern "C" { #if defined(__PLATFORM__Linux) #include #include - void glOrthoEwol(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal); #elif defined(__PLATFORM__DoubleBuffer) #elif defined(__PLATFORM__Android) #include - void glOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal); #elif defined(__PLATFORM__AndroidTablet) #include - void glOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal); #elif defined(__PLATFORM__IPhone) #elif defined(__PLATFORM__IPad) @@ -26,6 +23,7 @@ extern "C" { #error you need to specify a platform ... #endif +void glOrthoEwol(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal); #ifdef __cplusplus }