[DEV] change getting tag policy and remove choice of openGL-ES1
This commit is contained in:
parent
14f878bdd2
commit
9cf545c434
4
CreateTagEwol.sh
Executable file
4
CreateTagEwol.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo $* > Sources/libewol/tag
|
||||
git tag $*
|
@ -1 +1 @@
|
||||
Subproject commit 9ca566ed85228973d9e442ee41d14d59e494a087
|
||||
Subproject commit 197525dfc6cbe138767392466ad4f450aa7b2bd6
|
@ -214,6 +214,7 @@ namespace etk
|
||||
bool FileOpenWrite(void);
|
||||
bool FileClose(void);
|
||||
char* FileGets(char * elementLine, int32_t maxData);
|
||||
// TODO : Set the return and the size of block in 64 bits
|
||||
int32_t FileRead(void * data, int32_t blockSize, int32_t nbBlock);
|
||||
int32_t FileWrite(void * data, int32_t blockSize, int32_t nbBlock);
|
||||
bool FileSeek(long int offset, int origin);
|
||||
|
@ -8,9 +8,8 @@ LOCAL_MODULE := ewol
|
||||
LOCAL_CONFIG_FILES := Config.in ConfigAndroid.in
|
||||
|
||||
# get the tag of the current project :
|
||||
LOCAL_VERSION_TAG=$(shell cd $(LOCAL_PATH) ; git describe --tags)
|
||||
LOCAL_VERSION_TAG_SHORT=$(shell cd $(LOCAL_PATH) ; git describe --tags --abbrev=0)
|
||||
$(info $(LOCAL_MODULE) version TAG : $(LOCAL_VERSION_TAG))
|
||||
LOCAL_VERSION=$(shell cat $(LOCAL_PATH)/tag)
|
||||
$(info [TAG:$(LOCAL_MODULE)] $(LOCAL_VERSION))
|
||||
|
||||
# name of the dependency
|
||||
LOCAL_LIBRARIES := etk freetype tinyxml libpng parsersvg lua libzip
|
||||
@ -20,14 +19,10 @@ LOCAL_C_INCLUDES :=
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||
|
||||
LOCAL_CFLAGS := -Wno-write-strings \
|
||||
-DEWOL_VERSION_TAG_NAME="\"$(LOCAL_VERSION_TAG_SHORT)-$(BUILD_DIRECTORY_MODE)\"" \
|
||||
-DEWOL_VERSION_TAG_NAME="\"$(LOCAL_VERSION_TAG)-$(BUILD_DIRECTORY_MODE)\"" \
|
||||
-DDATA_IN_APK
|
||||
|
||||
ifeq ("$(CONFIG___VIDEO__OPENGL_ES_2)","y")
|
||||
LOCAL_EXPORT_LDLIBS := -lGLESv2
|
||||
else
|
||||
LOCAL_EXPORT_LDLIBS := -lGLESv1_CM
|
||||
endif
|
||||
|
||||
LOCAL_EXPORT_LDLIBS += -ldl -llog
|
||||
|
||||
|
@ -1,17 +1,4 @@
|
||||
menu "General"
|
||||
choice
|
||||
prompt "OpenGl mode"
|
||||
default __VIDEO__OPENGL_ES_1
|
||||
help
|
||||
OpenGL mode possible :
|
||||
0 : openGL basic mode, vertex buffer.
|
||||
1 : OpenGl 2 ==> no vertex bufffer but enable Shader system
|
||||
config __VIDEO__OPENGL_ES_1
|
||||
bool "0: openGl ES 1.0"
|
||||
config __VIDEO__OPENGL_ES_2
|
||||
bool "1: openGl ES 2.0"
|
||||
endchoice
|
||||
|
||||
config __EWOL_APPL_BASIC_TITLE__
|
||||
prompt "Application Title"
|
||||
string
|
||||
|
@ -8,9 +8,8 @@ LOCAL_MODULE := ewol
|
||||
LOCAL_CONFIG_FILES := Config.in
|
||||
|
||||
# get the tag of the current project :
|
||||
LOCAL_VERSION_TAG=$(shell cd $(LOCAL_PATH) ; git describe --tags)
|
||||
LOCAL_VERSION_TAG_SHORT=$(shell cd $(LOCAL_PATH) ; git describe --tags --abbrev=0)
|
||||
$(info $(LOCAL_MODULE) version TAG : $(LOCAL_VERSION_TAG))
|
||||
LOCAL_VERSION=$(shell cat $(LOCAL_PATH)/tag)
|
||||
$(info [TAG:$(LOCAL_MODULE)] $(LOCAL_VERSION))
|
||||
|
||||
# name of the dependency
|
||||
LOCAL_LIBRARIES := etk freetype tinyxml libzip libpng parsersvg lua portaudio
|
||||
@ -25,14 +24,10 @@ LOCAL_EXPORT_LDLIBS := -lGL -lX11
|
||||
|
||||
|
||||
LOCAL_CFLAGS := -Wno-write-strings \
|
||||
-DEWOL_VERSION_TAG_NAME="\"$(LOCAL_VERSION_TAG_SHORT)-$(BUILD_DIRECTORY_MODE)\"" \
|
||||
-DEWOL_VERSION_TAG_NAME="\"$(LOCAL_VERSION_TAG)-$(BUILD_DIRECTORY_MODE)\"" \
|
||||
-Wall
|
||||
|
||||
#ifneq ("$(CONFIG__VIDEO__OPENGL_ES_2)","")
|
||||
LOCAL_CFLAGS += -D__VIDEO__OPENGL_ES_2
|
||||
LOCAL_EXPORT_CFLAGS := -D__VIDEO__OPENGL_ES_2
|
||||
$(info Compilation For openGL-ES-v2 compatibility)
|
||||
#endif
|
||||
LOCAL_EXPORT_CFLAGS :=
|
||||
|
||||
# load the common sources file of the platform
|
||||
include $(LOCAL_PATH)/file.mk
|
||||
|
@ -8,9 +8,8 @@ LOCAL_MODULE := ewol
|
||||
LOCAL_CONFIG_FILES := Config.in
|
||||
|
||||
# get the tag of the current project :
|
||||
LOCAL_VERSION_TAG=$(shell cd $(LOCAL_PATH) ; git describe --tags)
|
||||
LOCAL_VERSION_TAG_SHORT=$(shell cd $(LOCAL_PATH) ; git describe --tags --abbrev=0)
|
||||
$(info $(LOCAL_MODULE) version TAG : $(LOCAL_VERSION_TAG))
|
||||
LOCAL_VERSION=$(shell cat $(LOCAL_PATH)/tag)
|
||||
$(info [TAG:$(LOCAL_MODULE)] $(LOCAL_VERSION))
|
||||
|
||||
# name of the dependency
|
||||
LOCAL_LIBRARIES := etk freetype tinyxml libzip libpng parsersvg lua zlib glew
|
||||
@ -21,7 +20,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||
LOCAL_EXPORT_LDLIBS :=
|
||||
|
||||
LOCAL_CFLAGS := -Wno-write-strings \
|
||||
-DEWOL_VERSION_TAG_NAME="\"$(LOCAL_VERSION_TAG_SHORT)-$(BUILD_DIRECTORY_MODE)\"" \
|
||||
-DEWOL_VERSION_TAG_NAME="\"$(LOCAL_VERSION_TAG)-$(BUILD_DIRECTORY_MODE)\"" \
|
||||
-Wall
|
||||
|
||||
# load the common sources file of the platform
|
||||
|
@ -32,18 +32,16 @@ ewol::Mesh::Mesh(etk::UString genName) :
|
||||
ewol::Resource(genName),
|
||||
m_texture1(NULL)
|
||||
{
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::UString tmpString("textured3D.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
#endif
|
||||
etk::UString tmpString("textured3D.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
}
|
||||
|
||||
ewol::Mesh::~Mesh(void)
|
||||
@ -52,9 +50,7 @@ ewol::Mesh::~Mesh(void)
|
||||
if(NULL!=m_texture1) {
|
||||
ewol::resource::Release(m_texture1);
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
#endif
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
}
|
||||
|
||||
|
||||
@ -73,51 +69,31 @@ void ewol::Mesh::Draw(void)
|
||||
EWOL_WARNING("Texture does not exist ...");
|
||||
return;
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
//EWOL_DEBUG(" Display " << m_coord.Size() << " elements" );
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
tmpMatrix = etk::matrix::Scale(100,100,100)
|
||||
* etk::matrix::rotate(1,0,0,rotx)
|
||||
* etk::matrix::rotate(0,1,0,roty)/*
|
||||
* etk::matrix::Translate(0.01,0,0)
|
||||
* etk::matrix::rotate(0,0,1,rotz)*/
|
||||
* tmpMatrix;
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_texture1->GetId());
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &m_vertices[0]);
|
||||
// Texture :
|
||||
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_uvTextures[0]);
|
||||
// color :
|
||||
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
// Request the draw od the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_vertices.Size());
|
||||
m_GLprogram->UnUse();
|
||||
#else
|
||||
/*
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
//EWOL_WARNING("Draw with texture : " << m_textureId << " ==> ogl=" << ewol::texture::GetGLID(m_textureId));
|
||||
glBindTexture(GL_TEXTURE_2D, m_resource->GetId() );
|
||||
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
|
||||
glEnableClientState( GL_COLOR_ARRAY ); // Enable Color Arrays
|
||||
glVertexPointer( 3, GL_FLOAT, 0, &m_coord[0] );
|
||||
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
||||
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
||||
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
||||
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
||||
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
*/
|
||||
#endif
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
//EWOL_DEBUG(" Display " << m_coord.Size() << " elements" );
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
tmpMatrix = etk::matrix::Scale(100,100,100)
|
||||
* etk::matrix::rotate(1,0,0,rotx)
|
||||
* etk::matrix::rotate(0,1,0,roty)/*
|
||||
* etk::matrix::Translate(0.01,0,0)
|
||||
* etk::matrix::rotate(0,0,1,rotz)*/
|
||||
* tmpMatrix;
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_texture1->GetId());
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &m_vertices[0]);
|
||||
// Texture :
|
||||
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_uvTextures[0]);
|
||||
// color :
|
||||
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
// Request the draw od the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_vertices.Size());
|
||||
m_GLprogram->UnUse();
|
||||
}
|
||||
|
||||
|
@ -36,24 +36,18 @@ namespace ewol
|
||||
class Mesh : public ewol::Resource
|
||||
{
|
||||
protected:
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLColor;
|
||||
int32_t m_GLtexture;
|
||||
int32_t m_GLtexID;
|
||||
#endif
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLColor;
|
||||
int32_t m_GLtexture;
|
||||
int32_t m_GLtexID;
|
||||
etk::Vector<uint32_t> m_indices;
|
||||
etk::Vector< etk::Vector3D<float> > m_vertices;
|
||||
etk::Vector< etk::Vector2D<float> > m_uvTextures;
|
||||
etk::Vector< etk::Vector3D<float> > m_normals;
|
||||
ewol::TextureFile* m_texture1;
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
#else
|
||||
etk::Vector<draw::Color> m_coordColor; //!< internal color of the different point
|
||||
#endif
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
public:
|
||||
Mesh(etk::UString genName);
|
||||
virtual ~Mesh(void);
|
||||
|
@ -237,62 +237,56 @@ bool ewol::resource::Keep(etk::UString& filename, ewol::Font*& object)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
bool ewol::resource::Keep(etk::UString& filename, ewol::Program*& object)
|
||||
{
|
||||
EWOL_VERBOSE("KEEP : Program : file : \"" << filename << "\"");
|
||||
object = static_cast<ewol::Program*>(LocalKeep(filename));
|
||||
if (NULL != object) {
|
||||
return true;
|
||||
}
|
||||
// need to crate a new one ...
|
||||
object = new ewol::Program(filename);
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : " << filename);
|
||||
return false;
|
||||
}
|
||||
LocalAdd(object);
|
||||
bool ewol::resource::Keep(etk::UString& filename, ewol::Program*& object)
|
||||
{
|
||||
EWOL_VERBOSE("KEEP : Program : file : \"" << filename << "\"");
|
||||
object = static_cast<ewol::Program*>(LocalKeep(filename));
|
||||
if (NULL != object) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
// need to crate a new one ...
|
||||
object = new ewol::Program(filename);
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : " << filename);
|
||||
return false;
|
||||
}
|
||||
LocalAdd(object);
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
bool ewol::resource::Keep(etk::UString& filename, ewol::Shader*& object)
|
||||
{
|
||||
EWOL_VERBOSE("KEEP : Shader : file : \"" << filename << "\"");
|
||||
object = static_cast<ewol::Shader*>(LocalKeep(filename));
|
||||
if (NULL != object) {
|
||||
return true;
|
||||
}
|
||||
// need to crate a new one ...
|
||||
object = new ewol::Shader(filename);
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : " << filename);
|
||||
return false;
|
||||
}
|
||||
LocalAdd(object);
|
||||
bool ewol::resource::Keep(etk::UString& filename, ewol::Shader*& object)
|
||||
{
|
||||
EWOL_VERBOSE("KEEP : Shader : file : \"" << filename << "\"");
|
||||
object = static_cast<ewol::Shader*>(LocalKeep(filename));
|
||||
if (NULL != object) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
// need to crate a new one ...
|
||||
object = new ewol::Shader(filename);
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : " << filename);
|
||||
return false;
|
||||
}
|
||||
LocalAdd(object);
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
bool ewol::resource::Keep(etk::UString& filename, ewol::DistantFieldFont*& object)
|
||||
{
|
||||
EWOL_VERBOSE("KEEP : DistanceFieldFont : file : \"" << filename << "\"");
|
||||
object = static_cast<ewol::DistantFieldFont*>(LocalKeep(filename));
|
||||
if (NULL != object) {
|
||||
return true;
|
||||
}
|
||||
// need to crate a new one ...
|
||||
object = new ewol::DistantFieldFont(filename);
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : " << filename);
|
||||
return false;
|
||||
}
|
||||
LocalAdd(object);
|
||||
bool ewol::resource::Keep(etk::UString& filename, ewol::DistantFieldFont*& object)
|
||||
{
|
||||
EWOL_VERBOSE("KEEP : DistanceFieldFont : file : \"" << filename << "\"");
|
||||
object = static_cast<ewol::DistantFieldFont*>(LocalKeep(filename));
|
||||
if (NULL != object) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
// need to crate a new one ...
|
||||
object = new ewol::DistantFieldFont(filename);
|
||||
if (NULL == object) {
|
||||
EWOL_ERROR("allocation error of a resource : " << filename);
|
||||
return false;
|
||||
}
|
||||
LocalAdd(object);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ewol::resource::Keep(ewol::Texture*& object)
|
||||
{
|
||||
@ -439,30 +433,24 @@ void ewol::resource::Release(ewol::Font*& object)
|
||||
Release(object2);
|
||||
object = NULL;
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
void ewol::resource::Release(ewol::Program*& object)
|
||||
{
|
||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||
Release(object2);
|
||||
object = NULL;
|
||||
}
|
||||
#endif
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
void ewol::resource::Release(ewol::Shader*& object)
|
||||
{
|
||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||
Release(object2);
|
||||
object = NULL;
|
||||
}
|
||||
#endif
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
void ewol::resource::Release(ewol::DistantFieldFont*& object)
|
||||
{
|
||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||
Release(object2);
|
||||
object = NULL;
|
||||
}
|
||||
#endif
|
||||
void ewol::resource::Release(ewol::Program*& object)
|
||||
{
|
||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||
Release(object2);
|
||||
object = NULL;
|
||||
}
|
||||
void ewol::resource::Release(ewol::Shader*& object)
|
||||
{
|
||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||
Release(object2);
|
||||
object = NULL;
|
||||
}
|
||||
void ewol::resource::Release(ewol::DistantFieldFont*& object)
|
||||
{
|
||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||
Release(object2);
|
||||
object = NULL;
|
||||
}
|
||||
void ewol::resource::Release(ewol::Texture*& object)
|
||||
{
|
||||
ewol::Resource* object2 = static_cast<ewol::Resource*>(object);
|
||||
|
@ -57,11 +57,9 @@ namespace ewol
|
||||
// return the type of the resource ...
|
||||
bool Keep(etk::UString& filename, ewol::TexturedFont*& object);
|
||||
bool Keep(etk::UString& filename, ewol::Font*& object);
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
bool Keep(etk::UString& filename, ewol::Program*& object);
|
||||
bool Keep(etk::UString& filename, ewol::Shader*& object);
|
||||
bool Keep(etk::UString& filename, ewol::DistantFieldFont*& object);
|
||||
#endif
|
||||
bool Keep(etk::UString& filename, ewol::Program*& object);
|
||||
bool Keep(etk::UString& filename, ewol::Shader*& object);
|
||||
bool Keep(etk::UString& filename, ewol::DistantFieldFont*& object);
|
||||
bool Keep(ewol::Texture*& object); // no name needed here ...
|
||||
bool Keep(etk::UString& filename, ewol::TextureFile*& object, etk::Vector2D<int32_t> size);
|
||||
bool Keep(etk::UString& accesMode, ewol::VirtualBufferObject*& object);
|
||||
@ -71,11 +69,9 @@ namespace ewol
|
||||
void Release(ewol::Resource*& object);
|
||||
void Release(ewol::TexturedFont*& object);
|
||||
void Release(ewol::Font*& object);
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
void Release(ewol::Program*& object);
|
||||
void Release(ewol::Shader*& object);
|
||||
void Release(ewol::DistantFieldFont*& object);
|
||||
#endif
|
||||
void Release(ewol::Program*& object);
|
||||
void Release(ewol::Shader*& object);
|
||||
void Release(ewol::DistantFieldFont*& object);
|
||||
void Release(ewol::Texture*& object);
|
||||
void Release(ewol::TextureFile*& object);
|
||||
void Release(ewol::VirtualBufferObject*& object);
|
||||
|
@ -35,16 +35,14 @@ ewol::OObject2DColored::OObject2DColored(void)
|
||||
{
|
||||
m_triElement = 0;
|
||||
SetColor(1.0, 1.0, 1.0, 1.0);
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::UString tmpString("DATA:color.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
}
|
||||
#endif
|
||||
etk::UString tmpString("DATA:color.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -52,9 +50,7 @@ ewol::OObject2DColored::~OObject2DColored(void)
|
||||
{
|
||||
m_coord.Clear();
|
||||
m_coordColor.Clear();
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
#endif
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
}
|
||||
|
||||
|
||||
@ -63,44 +59,22 @@ void ewol::OObject2DColored::Draw(void)
|
||||
if (m_coord.Size()<=0) {
|
||||
return;
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
//glScalef(m_scaling.x, m_scaling.y, 1.0);
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]);
|
||||
// color :
|
||||
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
// Request the draw of the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_coord.Size());
|
||||
m_GLprogram->UnUse();
|
||||
#else
|
||||
glPushMatrix();
|
||||
// Enable Pointers
|
||||
glEnableClientState( GL_VERTEX_ARRAY );
|
||||
glEnableClientState( GL_COLOR_ARRAY );
|
||||
|
||||
glScalef(m_scaling.x, m_scaling.y, 1.0);
|
||||
|
||||
// Set the vertex pointer to our vertex data
|
||||
glVertexPointer(2, GL_FLOAT, 0, &m_coord[0] );
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||
// Render : draw all of the triangles at once
|
||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
||||
//glDrawElements( GL_TRIANGLES, 0, m_coord.Size());
|
||||
//EWOL_DEBUG("Draw ..." << m_coord.Size()/3 << " triangle(s)");
|
||||
// Disable Pointers
|
||||
glDisableClientState( GL_COLOR_ARRAY );
|
||||
glDisableClientState( GL_VERTEX_ARRAY );
|
||||
glPopMatrix();
|
||||
#endif
|
||||
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
//glScalef(m_scaling.x, m_scaling.y, 1.0);
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]);
|
||||
// color :
|
||||
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
// Request the draw of the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_coord.Size());
|
||||
m_GLprogram->UnUse();
|
||||
}
|
||||
|
||||
void ewol::OObject2DColored::Clear(void)
|
||||
|
@ -37,22 +37,15 @@ namespace ewol {
|
||||
public:
|
||||
virtual void Draw(void);
|
||||
protected:
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLColor;
|
||||
#endif
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
draw::Colorf m_color[3];
|
||||
#else
|
||||
etk::Vector<draw::Color> m_coordColor; //!< internal color of the different point
|
||||
draw::Color m_color[3];
|
||||
#endif
|
||||
int32_t m_triElement;
|
||||
etk::Vector2D<float> m_triangle[3];
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLColor;
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
draw::Colorf m_color[3];
|
||||
int32_t m_triElement;
|
||||
etk::Vector2D<float> m_triangle[3];
|
||||
void GenerateTriangle(void);
|
||||
void ResetCount(void);
|
||||
public:
|
||||
|
@ -72,18 +72,16 @@ ewol::OObject2DTextColored::OObject2DTextColored(etk::UString fontName, int32_t
|
||||
{
|
||||
m_color = draw::color::black;
|
||||
SetFontProperty(fontName, size);
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::UString tmpString("DATA:textured.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
#endif
|
||||
etk::UString tmpString("DATA:textured.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -94,17 +92,15 @@ ewol::OObject2DTextColored::OObject2DTextColored(void) :
|
||||
m_color = draw::color::black;
|
||||
SetFontProperty(ewol::font::GetDefaultFont(), ewol::font::GetDefaultSize());
|
||||
etk::UString tmpString("DATA:textured.prog");
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
#endif
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -114,9 +110,7 @@ ewol::OObject2DTextColored::~OObject2DTextColored(void)
|
||||
ewol::resource::Release(m_font);
|
||||
m_font = NULL;
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
#endif
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
}
|
||||
|
||||
void ewol::OObject2DTextColored::Draw(void)
|
||||
@ -130,42 +124,25 @@ void ewol::OObject2DTextColored::Draw(void)
|
||||
EWOL_WARNING("no font...");
|
||||
return;
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_font->GetId());
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]);
|
||||
// Texture :
|
||||
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
|
||||
// color :
|
||||
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
// Request the draw od the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_coord.Size());
|
||||
m_GLprogram->UnUse();
|
||||
#else
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, m_font->GetId());
|
||||
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
|
||||
glEnableClientState( GL_COLOR_ARRAY ); // Enable Color Arrays
|
||||
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
|
||||
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
||||
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
||||
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
||||
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
||||
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_font->GetId());
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]);
|
||||
// Texture :
|
||||
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
|
||||
// color :
|
||||
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
// Request the draw od the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_coord.Size());
|
||||
m_GLprogram->UnUse();
|
||||
}
|
||||
|
||||
void ewol::OObject2DTextColored::Clear(void)
|
||||
|
@ -45,23 +45,17 @@ namespace ewol {
|
||||
int32_t Text(etk::Vector2D<float> textPos, const etk::UString& unicodeString);
|
||||
int32_t Text(etk::Vector2D<float> textPos, const uniChar_t unicodeChar);
|
||||
protected:
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLColor;
|
||||
int32_t m_GLtexture;
|
||||
int32_t m_GLtexID;
|
||||
#endif
|
||||
ewol::TexturedFont* m_font; //!< ewol font system
|
||||
draw::Color m_color; //!< tmp text color ...
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLColor;
|
||||
int32_t m_GLtexture;
|
||||
int32_t m_GLtexID;
|
||||
ewol::TexturedFont* m_font; //!< ewol font system
|
||||
draw::Color m_color; //!< tmp text color ...
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
#else
|
||||
etk::Vector<draw::Color> m_coordColor; //!< internal color of the different point
|
||||
#endif
|
||||
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
public:
|
||||
void SetFont(etk::UString fontName);
|
||||
void SetSize(int32_t fontSize);
|
||||
|
@ -21,7 +21,6 @@
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
|
||||
#include <ewol/oObject/2DTextShader.h>
|
||||
#include <ewol/openGL/openGL.h>
|
||||
@ -238,4 +237,3 @@ etk::Vector2D<float> ewol::OObject2DTextShader::GetSize(const etk::UString& unic
|
||||
return m_font->GetSize(unicodeString);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -25,8 +25,6 @@
|
||||
#ifndef __EWOL_O_OBJECT_2D_TEXT_SHADER_H__
|
||||
#define __EWOL_O_OBJECT_2D_TEXT_SHADER_H__
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/font/DistantFieldFont.h>
|
||||
#include <ewol/ResourceManager.h>
|
||||
@ -76,5 +74,3 @@ namespace ewol {
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -38,18 +38,16 @@ ewol::OObject2DTextured::OObject2DTextured(etk::UString textureName, float sizeX
|
||||
EWOL_CRITICAL("can not get a resource Texture");
|
||||
}
|
||||
m_resource = resourceFile;
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::UString tmpString("DATA:textured.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
#endif
|
||||
etk::UString tmpString("DATA:textured.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
}
|
||||
|
||||
ewol::OObject2DTextured::OObject2DTextured( float sizeX, float sizeY)
|
||||
@ -64,18 +62,16 @@ ewol::OObject2DTextured::OObject2DTextured( float sizeX, float sizeY)
|
||||
tmpImage.Clear();
|
||||
m_resource->Flush();
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::UString tmpString("DATA:textured.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
#endif
|
||||
etk::UString tmpString("DATA:textured.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -84,9 +80,7 @@ ewol::OObject2DTextured::~OObject2DTextured(void)
|
||||
if (NULL != m_resource) {
|
||||
ewol::resource::Release(m_resource);
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
#endif
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
}
|
||||
|
||||
void ewol::OObject2DTextured::Draw(void)
|
||||
@ -98,44 +92,25 @@ void ewol::OObject2DTextured::Draw(void)
|
||||
EWOL_WARNING("Texture does not exist ...");
|
||||
return;
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId());
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]);
|
||||
// Texture :
|
||||
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
|
||||
// color :
|
||||
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
// Request the draw od the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_coord.Size());
|
||||
m_GLprogram->UnUse();
|
||||
#else
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
//EWOL_WARNING("Draw with texture : " << m_textureId << " ==> ogl=" << ewol::texture::GetGLID(m_textureId));
|
||||
glBindTexture(GL_TEXTURE_2D, m_resource->GetId() );
|
||||
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
|
||||
glEnableClientState( GL_COLOR_ARRAY ); // Enable Color Arrays
|
||||
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
|
||||
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
||||
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
||||
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
||||
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
||||
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId());
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]);
|
||||
// Texture :
|
||||
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
|
||||
// color :
|
||||
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
// Request the draw od the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_coord.Size());
|
||||
m_GLprogram->UnUse();
|
||||
}
|
||||
|
||||
void ewol::OObject2DTextured::Clear(void)
|
||||
|
@ -41,22 +41,16 @@ namespace ewol {
|
||||
void Rectangle(float x, float y, float w, float h, float texX=0.0, float texY=0.0, float texSX=1.0, float texSY=1.0, draw::Color tmpColor=draw::color::white);
|
||||
void Rectangle(float x, float y, float w, float h, draw::Color tmpColor);
|
||||
protected:
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLColor;
|
||||
int32_t m_GLtexture;
|
||||
int32_t m_GLtexID;
|
||||
#endif
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLColor;
|
||||
int32_t m_GLtexture;
|
||||
int32_t m_GLtexID;
|
||||
ewol::Texture* m_resource; //!< texture resources
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
#else
|
||||
etk::Vector<draw::Color> m_coordColor; //!< internal color of the different point
|
||||
#endif
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
public:
|
||||
draw::Image* GetImage(void)
|
||||
{
|
||||
|
@ -36,18 +36,16 @@ ewol::OObject3DTextured::OObject3DTextured(etk::UString textureName, float sizeX
|
||||
if (false == ewol::resource::Keep(textureName, m_resource, etk::Vector2D<int32_t>(sizeX,sizeY)) ) {
|
||||
EWOL_CRITICAL("can not get a resource Texture");
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::UString tmpString("textured3D.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
#endif
|
||||
etk::UString tmpString("textured3D.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
||||
m_GLColor = m_GLprogram->GetAttribute("EW_color");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -56,9 +54,7 @@ ewol::OObject3DTextured::~OObject3DTextured(void)
|
||||
if (NULL != m_resource) {
|
||||
ewol::resource::Release(m_resource);
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
#endif
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
}
|
||||
|
||||
void ewol::OObject3DTextured::Draw(void)
|
||||
@ -70,45 +66,26 @@ void ewol::OObject3DTextured::Draw(void)
|
||||
EWOL_WARNING("Texture does not exist ...");
|
||||
return;
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
//EWOL_DEBUG(" Display " << m_coord.Size() << " elements" );
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId());
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &m_coord[0]);
|
||||
// Texture :
|
||||
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
|
||||
// color :
|
||||
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
// Request the draw od the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_coord.Size());
|
||||
m_GLprogram->UnUse();
|
||||
#else
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
//EWOL_WARNING("Draw with texture : " << m_textureId << " ==> ogl=" << ewol::texture::GetGLID(m_textureId));
|
||||
glBindTexture(GL_TEXTURE_2D, m_resource->GetId() );
|
||||
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
|
||||
glEnableClientState( GL_COLOR_ARRAY ); // Enable Color Arrays
|
||||
glVertexPointer( 3, GL_FLOAT, 0, &m_coord[0] );
|
||||
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
||||
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
||||
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
||||
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
||||
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
//EWOL_DEBUG(" Display " << m_coord.Size() << " elements" );
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_resource->GetId());
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 3/*x,y,z*/, &m_coord[0]);
|
||||
// Texture :
|
||||
m_GLprogram->SendAttribute(m_GLtexture, 2/*u,v*/, &m_coordTex[0]);
|
||||
// color :
|
||||
m_GLprogram->SendAttribute(m_GLColor, 4/*r,g,b,a*/, &m_coordColor[0]);
|
||||
// Request the draw od the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_coord.Size());
|
||||
m_GLprogram->UnUse();
|
||||
}
|
||||
|
||||
void ewol::OObject3DTextured::Clear(void)
|
||||
|
@ -40,22 +40,16 @@ namespace ewol {
|
||||
void Rectangle(float x, float y, float w, float h, float texX=0.0, float texY=0.0, float texSX=1.0, float texSY=1.0, draw::Color tmpColor=draw::color::white);
|
||||
void Rectangle(float x, float y, float w, float h, draw::Color tmpColor);
|
||||
protected:
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLColor;
|
||||
int32_t m_GLtexture;
|
||||
int32_t m_GLtexID;
|
||||
#endif
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLColor;
|
||||
int32_t m_GLtexture;
|
||||
int32_t m_GLtexID;
|
||||
ewol::TextureFile* m_resource; //!< texture resources
|
||||
etk::Vector<etk::Vector3D<float> > m_coord; //!< internal coord of the object
|
||||
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
#else
|
||||
etk::Vector<draw::Color> m_coordColor; //!< internal color of the different point
|
||||
#endif
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,4 @@ namespace ewol {
|
||||
#include <ewol/oObject/2DTextured.h>
|
||||
#include <ewol/oObject/2DColored.h>
|
||||
#include <ewol/oObject/2DTextColored.h>
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
#include <ewol/oObject/2DTextShader.h>
|
||||
#endif
|
||||
|
@ -83,11 +83,7 @@ void ewol::Sprite::Element(etk::Vector3D<float> pos, float size, float angle, dr
|
||||
texD.u = 1.0;
|
||||
texD.v = 0.0;
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
draw::Colorf localColor = tmpColor;
|
||||
#else
|
||||
draw::Color localColor = tmpColor;
|
||||
#endif
|
||||
draw::Colorf localColor = tmpColor;
|
||||
etk::Vector3D<float> point = pos;
|
||||
float yyySin = sin(angle) * size;
|
||||
float xxxCos = cos(angle) * size;
|
||||
|
@ -22,7 +22,6 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
@ -645,4 +644,3 @@ void ewol::Program::UnUse(void)
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -24,71 +24,70 @@
|
||||
|
||||
#ifndef __OPEN_GL__PROGRAM_H__
|
||||
#define __OPEN_GL__PROGRAM_H__
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/Resource.h>
|
||||
#include <ewol/openGL/openGL.h>
|
||||
#include <ewol/openGL/Shader.h>
|
||||
|
||||
namespace ewol
|
||||
{
|
||||
class progAttributeElement
|
||||
{
|
||||
public :
|
||||
etk::UString m_name;
|
||||
GLint m_elementId;
|
||||
bool m_isAttribute;
|
||||
bool m_isLinked;
|
||||
};
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/Resource.h>
|
||||
#include <ewol/openGL/openGL.h>
|
||||
#include <ewol/openGL/Shader.h>
|
||||
|
||||
namespace ewol
|
||||
{
|
||||
class progAttributeElement
|
||||
{
|
||||
public :
|
||||
etk::UString m_name;
|
||||
GLint m_elementId;
|
||||
bool m_isAttribute;
|
||||
bool m_isLinked;
|
||||
};
|
||||
|
||||
class Program : public ewol::Resource
|
||||
{
|
||||
private :
|
||||
bool m_exist;
|
||||
GLuint m_program;
|
||||
etk::Vector<ewol::Shader*> m_shaderList;
|
||||
etk::Vector<ewol::progAttributeElement> m_elementList;
|
||||
bool m_hasTexture;
|
||||
public:
|
||||
Program(etk::UString& filename);
|
||||
virtual ~Program(void);
|
||||
const char* GetType(void) { return "ewol::Program"; };
|
||||
int32_t GetAttribute(etk::UString tmpElement);
|
||||
void SendAttribute(int32_t idElem, int32_t nbElement, void* pointer, int32_t jumpBetweenSample=0);
|
||||
int32_t GetUniform(etk::UString tmpElement);
|
||||
|
||||
class Program : public ewol::Resource
|
||||
{
|
||||
private :
|
||||
bool m_exist;
|
||||
GLuint m_program;
|
||||
etk::Vector<ewol::Shader*> m_shaderList;
|
||||
etk::Vector<ewol::progAttributeElement> m_elementList;
|
||||
bool m_hasTexture;
|
||||
public:
|
||||
Program(etk::UString& filename);
|
||||
virtual ~Program(void);
|
||||
const char* GetType(void) { return "ewol::Program"; };
|
||||
int32_t GetAttribute(etk::UString tmpElement);
|
||||
void SendAttribute(int32_t idElem, int32_t nbElement, void* pointer, int32_t jumpBetweenSample=0);
|
||||
int32_t GetUniform(etk::UString tmpElement);
|
||||
|
||||
void UniformMatrix4fv(int32_t idElem, int32_t nbElement, etk::Matrix4 pointer, bool transpose=true);
|
||||
|
||||
void Uniform1f(int32_t idElem, float value1);
|
||||
void Uniform2f(int32_t idElem, float value1, float value2);
|
||||
void Uniform3f(int32_t idElem, float value1, float value2, float value3);
|
||||
void Uniform4f(int32_t idElem, float value1, float value2, float value3, float value4);
|
||||
|
||||
void Uniform1i(int32_t idElem, int32_t value1);
|
||||
void Uniform2i(int32_t idElem, int32_t value1, int32_t value2);
|
||||
void Uniform3i(int32_t idElem, int32_t value1, int32_t value2, int32_t value3);
|
||||
void Uniform4i(int32_t idElem, int32_t value1, int32_t value2, int32_t value3, int32_t value4);
|
||||
|
||||
void Uniform1fv(int32_t idElem, int32_t nbElement, float *value);
|
||||
void Uniform2fv(int32_t idElem, int32_t nbElement, float *value);
|
||||
void Uniform3fv(int32_t idElem, int32_t nbElement, float *value);
|
||||
void Uniform4fv(int32_t idElem, int32_t nbElement, float *value);
|
||||
|
||||
void Uniform1iv(int32_t idElem, int32_t nbElement, int32_t *value);
|
||||
void Uniform2iv(int32_t idElem, int32_t nbElement, int32_t *value);
|
||||
void Uniform3iv(int32_t idElem, int32_t nbElement, int32_t *value);
|
||||
void Uniform4iv(int32_t idElem, int32_t nbElement, int32_t *value);
|
||||
|
||||
void Use(void);
|
||||
void SetTexture0(int32_t idElem, GLint textureOpenGlID);
|
||||
void UnUse(void);
|
||||
void UpdateContext(void);
|
||||
void RemoveContext(void);
|
||||
void RemoveContextToLate(void);
|
||||
void Reload(void);
|
||||
};
|
||||
};
|
||||
#endif
|
||||
void UniformMatrix4fv(int32_t idElem, int32_t nbElement, etk::Matrix4 pointer, bool transpose=true);
|
||||
|
||||
void Uniform1f(int32_t idElem, float value1);
|
||||
void Uniform2f(int32_t idElem, float value1, float value2);
|
||||
void Uniform3f(int32_t idElem, float value1, float value2, float value3);
|
||||
void Uniform4f(int32_t idElem, float value1, float value2, float value3, float value4);
|
||||
|
||||
void Uniform1i(int32_t idElem, int32_t value1);
|
||||
void Uniform2i(int32_t idElem, int32_t value1, int32_t value2);
|
||||
void Uniform3i(int32_t idElem, int32_t value1, int32_t value2, int32_t value3);
|
||||
void Uniform4i(int32_t idElem, int32_t value1, int32_t value2, int32_t value3, int32_t value4);
|
||||
|
||||
void Uniform1fv(int32_t idElem, int32_t nbElement, float *value);
|
||||
void Uniform2fv(int32_t idElem, int32_t nbElement, float *value);
|
||||
void Uniform3fv(int32_t idElem, int32_t nbElement, float *value);
|
||||
void Uniform4fv(int32_t idElem, int32_t nbElement, float *value);
|
||||
|
||||
void Uniform1iv(int32_t idElem, int32_t nbElement, int32_t *value);
|
||||
void Uniform2iv(int32_t idElem, int32_t nbElement, int32_t *value);
|
||||
void Uniform3iv(int32_t idElem, int32_t nbElement, int32_t *value);
|
||||
void Uniform4iv(int32_t idElem, int32_t nbElement, int32_t *value);
|
||||
|
||||
void Use(void);
|
||||
void SetTexture0(int32_t idElem, GLint textureOpenGlID);
|
||||
void UnUse(void);
|
||||
void UpdateContext(void);
|
||||
void RemoveContext(void);
|
||||
void RemoveContextToLate(void);
|
||||
void Reload(void);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
@ -168,5 +167,4 @@ void ewol::Shader::Reload(void)
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -24,33 +24,32 @@
|
||||
|
||||
#ifndef __OPEN_GL__SHADER_H__
|
||||
#define __OPEN_GL__SHADER_H__
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/Resource.h>
|
||||
#include <ewol/openGL/openGL.h>
|
||||
|
||||
namespace ewol
|
||||
{
|
||||
class Shader : public ewol::Resource
|
||||
{
|
||||
private :
|
||||
bool m_exist;
|
||||
char* m_fileData;
|
||||
GLuint m_shader;
|
||||
GLenum m_type;
|
||||
public:
|
||||
Shader(etk::UString& filename);
|
||||
virtual ~Shader(void);
|
||||
const char* GetType(void) { return "ewol::Shader"; };
|
||||
GLuint GetGL_ID(void) { return m_shader; };
|
||||
GLenum GetShaderType(void) { return m_type; };
|
||||
void UpdateContext(void);
|
||||
void RemoveContext(void);
|
||||
void RemoveContextToLate(void);
|
||||
void Reload(void);
|
||||
};
|
||||
};
|
||||
#endif
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/Resource.h>
|
||||
#include <ewol/openGL/openGL.h>
|
||||
|
||||
namespace ewol
|
||||
{
|
||||
class Shader : public ewol::Resource
|
||||
{
|
||||
private :
|
||||
bool m_exist;
|
||||
char* m_fileData;
|
||||
GLuint m_shader;
|
||||
GLenum m_type;
|
||||
public:
|
||||
Shader(etk::UString& filename);
|
||||
virtual ~Shader(void);
|
||||
const char* GetType(void) { return "ewol::Shader"; };
|
||||
GLuint GetGL_ID(void) { return m_shader; };
|
||||
GLenum GetShaderType(void) { return m_type; };
|
||||
void UpdateContext(void);
|
||||
void RemoveContext(void);
|
||||
void RemoveContextToLate(void);
|
||||
void Reload(void);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -26,48 +26,6 @@
|
||||
#include <ewol/openGL/openGL.h>
|
||||
#include <etk/Vector.h>
|
||||
|
||||
#ifndef __VIDEO__OPENGL_ES_2
|
||||
void glOrthoMatrix(GLfloat left,
|
||||
GLfloat right,
|
||||
GLfloat bottom,
|
||||
GLfloat top,
|
||||
GLfloat nearVal,
|
||||
GLfloat farVal,
|
||||
GLfloat* myMatrix)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
void glOrthoEwol(GLfloat left,
|
||||
GLfloat right,
|
||||
GLfloat bottom,
|
||||
GLfloat top,
|
||||
GLfloat nearVal,
|
||||
GLfloat farVal)
|
||||
{
|
||||
GLfloat myMatrix[4*4];
|
||||
glOrthoMatrix(left, right, bottom, top, nearVal, farVal, myMatrix);
|
||||
glLoadMatrixf(myMatrix);
|
||||
}
|
||||
#endif
|
||||
|
||||
etk::Vector<etk::Matrix4> l_matrixList;
|
||||
|
||||
void ewol::openGL::Init(void)
|
||||
|
@ -32,42 +32,28 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__TARGET_OS__Linux)
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
// TO ENABLE THE SHADER api ...
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#endif
|
||||
// TO ENABLE THE SHADER api ...
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
// This is to prevent the use of these element that is not allowed in the OpenGL ES
|
||||
#undef glVertexPointer
|
||||
#undef glTexCoordPointer
|
||||
#undef glColorPointer
|
||||
#undef glPopMatrix
|
||||
#undef glPushMatrix
|
||||
#undef glMatrixMode
|
||||
#undef glLoadIdentity
|
||||
#undef glTranslatef
|
||||
#endif
|
||||
// TODO : Check it it work
|
||||
// This is to prevent the use of these element that is not allowed in the OpenGL ES
|
||||
#undef glVertexPointer
|
||||
#undef glTexCoordPointer
|
||||
#undef glColorPointer
|
||||
#undef glPopMatrix
|
||||
#undef glPushMatrix
|
||||
#undef glMatrixMode
|
||||
#undef glLoadIdentity
|
||||
#undef glTranslatef
|
||||
#elif defined(__TARGET_OS__Android)
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
// Include openGL ES 2
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#else
|
||||
// Include openGL ES 1
|
||||
#include <GLES/gl.h>
|
||||
#endif
|
||||
// Include openGL ES 2
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#elif defined(__TARGET_OS__Windows)
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
// TO ENABLE THE SHADER api ...
|
||||
//#define GL_GLEXT_PROTOTYPES
|
||||
#define GLEW_STATIC
|
||||
#include <GL/glew.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
// TO ENABLE THE SHADER api ...
|
||||
//#define GL_GLEXT_PROTOTYPES
|
||||
#define GLEW_STATIC
|
||||
#include <GL/glew.h>
|
||||
#elif defined(__TARGET_OS__MacOs)
|
||||
|
||||
#elif defined(__TARGET_OS__IOs)
|
||||
@ -76,10 +62,6 @@ extern "C" {
|
||||
#error you need to specify a __TAGET_OS__ ...
|
||||
#endif
|
||||
|
||||
#ifndef __VIDEO__OPENGL_ES_2
|
||||
// TODO : Remove : deprecated ....
|
||||
void glOrthoEwol(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal);
|
||||
#endif
|
||||
namespace ewol {
|
||||
namespace openGL {
|
||||
void Init(void);
|
||||
|
@ -216,13 +216,11 @@ int Windows_Run(void);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
glewInit();
|
||||
if (!glewIsSupported("GL_VERSION_2_0")) {
|
||||
fprintf(stderr, "OpenGL 2.0 not available\n");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
glewInit();
|
||||
if (!glewIsSupported("GL_VERSION_2_0")) {
|
||||
fprintf(stderr, "OpenGL 2.0 not available\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
ewol::CmdLine::Clean();
|
||||
for( int32_t i=1 ; i<argc; i++) {
|
||||
|
@ -78,29 +78,27 @@ void ewol::Button::Init(void)
|
||||
m_textColorFg = draw::color::black;
|
||||
|
||||
SetCanHaveFocus(true);
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::UString tmpString("THEME:GUI:widgetButton.conf");
|
||||
if (true == ewol::resource::Keep(tmpString, m_config) ) {
|
||||
m_confIdPaddingX = m_config->Request("PaddingX");
|
||||
m_confIdPaddingY = m_config->Request("PaddingY");
|
||||
m_confIdChangeTime = m_config->Request("ChangeTime");
|
||||
}
|
||||
tmpString ="THEME:GUI:widgetButton.prog";
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
// Widget property ==> for the Vertex shader
|
||||
m_GLwidgetProperty.m_size = m_GLprogram->GetUniform("EW_widgetProperty.size");
|
||||
m_GLwidgetProperty.m_insidePos = m_GLprogram->GetUniform("EW_widgetProperty.insidePos");
|
||||
m_GLwidgetProperty.m_insideSize = m_GLprogram->GetUniform("EW_widgetProperty.insideSize");
|
||||
// status property ==> for the fragment shader
|
||||
m_GLstatus.m_stateOld = m_GLprogram->GetUniform("EW_status.stateOld");
|
||||
m_GLstatus.m_stateNew = m_GLprogram->GetUniform("EW_status.stateNew");
|
||||
m_GLstatus.m_transition = m_GLprogram->GetUniform("EW_status.transition");
|
||||
}
|
||||
#endif
|
||||
etk::UString tmpString("THEME:GUI:widgetButton.conf");
|
||||
if (true == ewol::resource::Keep(tmpString, m_config) ) {
|
||||
m_confIdPaddingX = m_config->Request("PaddingX");
|
||||
m_confIdPaddingY = m_config->Request("PaddingY");
|
||||
m_confIdChangeTime = m_config->Request("ChangeTime");
|
||||
}
|
||||
tmpString ="THEME:GUI:widgetButton.prog";
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
// Widget property ==> for the Vertex shader
|
||||
m_GLwidgetProperty.m_size = m_GLprogram->GetUniform("EW_widgetProperty.size");
|
||||
m_GLwidgetProperty.m_insidePos = m_GLprogram->GetUniform("EW_widgetProperty.insidePos");
|
||||
m_GLwidgetProperty.m_insideSize = m_GLprogram->GetUniform("EW_widgetProperty.insideSize");
|
||||
// status property ==> for the fragment shader
|
||||
m_GLstatus.m_stateOld = m_GLprogram->GetUniform("EW_status.stateOld");
|
||||
m_GLstatus.m_stateNew = m_GLprogram->GetUniform("EW_status.stateNew");
|
||||
m_GLstatus.m_transition = m_GLprogram->GetUniform("EW_status.transition");
|
||||
}
|
||||
}
|
||||
|
||||
ewol::Button::Button(void)
|
||||
@ -175,37 +173,35 @@ bool ewol::Button::GetValue(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
|
||||
void ewol::Button::SetPoint(float x, float y)
|
||||
{
|
||||
etk::Vector2D<float> triangle(x, y);
|
||||
m_coord.PushBack(triangle);
|
||||
}
|
||||
|
||||
void ewol::Button::Rectangle(float x, float y, float w, float h)
|
||||
{
|
||||
m_coord.Clear();
|
||||
/* Bitmap position
|
||||
* xA xB
|
||||
* yC *------*
|
||||
* | |
|
||||
* | |
|
||||
* yD *------*
|
||||
*/
|
||||
float dxA = x;
|
||||
float dxB = x + w;
|
||||
float dyC = y;
|
||||
float dyD = y + h;
|
||||
SetPoint(dxA, dyD);
|
||||
SetPoint(dxA, dyC);
|
||||
SetPoint(dxB, dyC);
|
||||
|
||||
SetPoint(dxB, dyC);
|
||||
SetPoint(dxB, dyD);
|
||||
SetPoint(dxA, dyD);
|
||||
}
|
||||
#endif
|
||||
void ewol::Button::SetPoint(float x, float y)
|
||||
{
|
||||
etk::Vector2D<float> triangle(x, y);
|
||||
m_coord.PushBack(triangle);
|
||||
}
|
||||
|
||||
void ewol::Button::Rectangle(float x, float y, float w, float h)
|
||||
{
|
||||
m_coord.Clear();
|
||||
/* Bitmap position
|
||||
* xA xB
|
||||
* yC *------*
|
||||
* | |
|
||||
* | |
|
||||
* yD *------*
|
||||
*/
|
||||
float dxA = x;
|
||||
float dxB = x + w;
|
||||
float dyC = y;
|
||||
float dyD = y + h;
|
||||
SetPoint(dxA, dyD);
|
||||
SetPoint(dxA, dyC);
|
||||
SetPoint(dxB, dyC);
|
||||
|
||||
SetPoint(dxB, dyC);
|
||||
SetPoint(dxB, dyD);
|
||||
SetPoint(dxA, dyD);
|
||||
}
|
||||
|
||||
|
||||
void ewol::Button::OnDraw(DrawProperty& displayProp)
|
||||
|
@ -80,27 +80,25 @@ namespace ewol {
|
||||
class Button : public ewol::Widget
|
||||
{
|
||||
private:
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
// External theme config:
|
||||
ewol::SimpleConfigFile* m_config;
|
||||
int32_t m_confIdPaddingX;
|
||||
int32_t m_confIdPaddingY;
|
||||
int32_t m_confIdChangeTime;
|
||||
// OpenGL shaders programs:
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
// widget property
|
||||
ewol::GLWidgetPosProperty m_GLwidgetProperty; // id of the uniform
|
||||
ewol::WidgetPosProperty m_widgetProperty; // structure of this uniform
|
||||
// state property
|
||||
ewol::GLWidgetStateProperty m_GLstatus;
|
||||
ewol::WidgetStateProperty m_status;
|
||||
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
void SetPoint(float x, float y);
|
||||
void Rectangle(float x, float y, float w, float h);
|
||||
#endif
|
||||
// External theme config:
|
||||
ewol::SimpleConfigFile* m_config;
|
||||
int32_t m_confIdPaddingX;
|
||||
int32_t m_confIdPaddingY;
|
||||
int32_t m_confIdChangeTime;
|
||||
// OpenGL shaders programs:
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
// widget property
|
||||
ewol::GLWidgetPosProperty m_GLwidgetProperty; // id of the uniform
|
||||
ewol::WidgetPosProperty m_widgetProperty; // structure of this uniform
|
||||
// state property
|
||||
ewol::GLWidgetStateProperty m_GLstatus;
|
||||
ewol::WidgetStateProperty m_status;
|
||||
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
void SetPoint(float x, float y);
|
||||
void Rectangle(float x, float y, float w, float h);
|
||||
private:
|
||||
ewol::OObject2DTextColored m_oObjectText;
|
||||
ewol::OObject2DTextured* m_oObjectImage;
|
||||
|
@ -68,20 +68,18 @@ void ewol::Entry::Init(void)
|
||||
ShortCutAdd("ctrl+v", ewolEventEntryPaste);
|
||||
ShortCutAdd("ctrl+a", ewolEventEntrySelect, "ALL");
|
||||
ShortCutAdd("ctrl+shift+a", ewolEventEntrySelect, "NONE");
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::UString tmpString("THEME:GUI:widgetEntry.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLsizeBorder = m_GLprogram->GetUniform("EW_sizeBorder");
|
||||
m_GLsizePadding = m_GLprogram->GetUniform("EW_sizePadding");
|
||||
m_GLsize = m_GLprogram->GetUniform("EW_size");
|
||||
m_GLposText = m_GLprogram->GetUniform("EW_posText");
|
||||
m_GLstate = m_GLprogram->GetUniform("EW_state");
|
||||
}
|
||||
#endif
|
||||
etk::UString tmpString("THEME:GUI:widgetEntry.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord2d");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLsizeBorder = m_GLprogram->GetUniform("EW_sizeBorder");
|
||||
m_GLsizePadding = m_GLprogram->GetUniform("EW_sizePadding");
|
||||
m_GLsize = m_GLprogram->GetUniform("EW_size");
|
||||
m_GLposText = m_GLprogram->GetUniform("EW_posText");
|
||||
m_GLstate = m_GLprogram->GetUniform("EW_state");
|
||||
}
|
||||
}
|
||||
|
||||
ewol::Entry::Entry(void)
|
||||
@ -134,37 +132,34 @@ etk::UString ewol::Entry::GetValue(void)
|
||||
|
||||
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
void ewol::Entry::SetPoint(float x, float y)
|
||||
{
|
||||
etk::Vector2D<float> triangle(x, y);
|
||||
m_coord.PushBack(triangle);
|
||||
}
|
||||
|
||||
void ewol::Entry::SetPoint(float x, float y)
|
||||
{
|
||||
etk::Vector2D<float> triangle(x, y);
|
||||
m_coord.PushBack(triangle);
|
||||
}
|
||||
|
||||
void ewol::Entry::Rectangle(float x, float y, float w, float h)
|
||||
{
|
||||
m_coord.Clear();
|
||||
/* Bitmap position
|
||||
* xA xB
|
||||
* yC *------*
|
||||
* | |
|
||||
* | |
|
||||
* yD *------*
|
||||
*/
|
||||
float dxA = x;
|
||||
float dxB = x + w;
|
||||
float dyC = y;
|
||||
float dyD = y + h;
|
||||
SetPoint(dxA, dyD);
|
||||
SetPoint(dxA, dyC);
|
||||
SetPoint(dxB, dyC);
|
||||
|
||||
SetPoint(dxB, dyC);
|
||||
SetPoint(dxB, dyD);
|
||||
SetPoint(dxA, dyD);
|
||||
}
|
||||
#endif
|
||||
void ewol::Entry::Rectangle(float x, float y, float w, float h)
|
||||
{
|
||||
m_coord.Clear();
|
||||
/* Bitmap position
|
||||
* xA xB
|
||||
* yC *------*
|
||||
* | |
|
||||
* | |
|
||||
* yD *------*
|
||||
*/
|
||||
float dxA = x;
|
||||
float dxB = x + w;
|
||||
float dyC = y;
|
||||
float dyD = y + h;
|
||||
SetPoint(dxA, dyD);
|
||||
SetPoint(dxA, dyC);
|
||||
SetPoint(dxB, dyC);
|
||||
|
||||
SetPoint(dxB, dyC);
|
||||
SetPoint(dxB, dyD);
|
||||
SetPoint(dxA, dyD);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Common widget drawing function (called by the drawing thread [Android, X11, ...])
|
||||
@ -173,28 +168,26 @@ etk::UString ewol::Entry::GetValue(void)
|
||||
*/
|
||||
void ewol::Entry::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
//glScalef(m_scaling.x, m_scaling.y, 1.0);
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]);
|
||||
// all entry parameters :
|
||||
m_GLprogram->Uniform1f(m_GLsizeBorder, m_borderSize);
|
||||
m_GLprogram->Uniform1f(m_GLsizePadding, m_paddingSize);
|
||||
m_GLprogram->Uniform2fv(m_GLsize, 1, &m_size.x);
|
||||
m_GLprogram->Uniform4fv(m_GLposText, 1, m_pos);
|
||||
m_GLprogram->Uniform1i(m_GLstate, 0);
|
||||
// Request the draw of the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_coord.Size());
|
||||
m_GLprogram->UnUse();
|
||||
#endif
|
||||
if (m_GLprogram==NULL) {
|
||||
EWOL_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
//glScalef(m_scaling.x, m_scaling.y, 1.0);
|
||||
m_GLprogram->Use();
|
||||
// set Matrix : translation/positionMatrix
|
||||
etk::Matrix4 tmpMatrix = ewol::openGL::GetMatrix();
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// position :
|
||||
m_GLprogram->SendAttribute(m_GLPosition, 2/*x,y*/, &m_coord[0]);
|
||||
// all entry parameters :
|
||||
m_GLprogram->Uniform1f(m_GLsizeBorder, m_borderSize);
|
||||
m_GLprogram->Uniform1f(m_GLsizePadding, m_paddingSize);
|
||||
m_GLprogram->Uniform2fv(m_GLsize, 1, &m_size.x);
|
||||
m_GLprogram->Uniform4fv(m_GLposText, 1, m_pos);
|
||||
m_GLprogram->Uniform1i(m_GLstate, 0);
|
||||
// Request the draw of the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_coord.Size());
|
||||
m_GLprogram->UnUse();
|
||||
m_oObjectDecoration.Draw();
|
||||
m_oObjectText.Draw();
|
||||
}
|
||||
@ -246,19 +239,11 @@ void ewol::Entry::OnRegenerateDisplay(void)
|
||||
m_oObjectText.Text(textPos, m_data);
|
||||
m_oObjectText.clippingDisable();
|
||||
|
||||
#ifndef __VIDEO__OPENGL_ES_2
|
||||
m_oObjectDecoration.SetColor(m_textColorBg);
|
||||
m_oObjectDecoration.Rectangle( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
m_oObjectDecoration.SetColor(m_textColorFg);
|
||||
m_oObjectDecoration.RectangleBorder( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_borderSize);
|
||||
#else
|
||||
m_pos[0] = m_borderSize+2*drawClipping.x;
|
||||
m_pos[1] = m_borderSize+2*drawClipping.y;
|
||||
m_pos[2] = m_size.x - 2*(m_borderSize+2*drawClipping.x);
|
||||
m_pos[3] = m_size.y - 2*(m_borderSize+2*drawClipping.y);
|
||||
|
||||
Rectangle(0, 0, m_size.x, m_size.y);
|
||||
#endif
|
||||
m_pos[0] = m_borderSize+2*drawClipping.x;
|
||||
m_pos[1] = m_borderSize+2*drawClipping.y;
|
||||
m_pos[2] = m_size.x - 2*(m_borderSize+2*drawClipping.x);
|
||||
m_pos[3] = m_size.y - 2*(m_borderSize+2*drawClipping.y);
|
||||
Rectangle(0, 0, m_size.x, m_size.y);
|
||||
int32_t pos1 = m_displayCursorPosSelection;
|
||||
int32_t pos2 = m_displayCursorPos;
|
||||
if(m_displayCursorPosSelection>m_displayCursorPos) {
|
||||
|
@ -48,21 +48,19 @@ namespace ewol {
|
||||
class Entry : public ewol::Widget
|
||||
{
|
||||
private:
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLsizeBorder;
|
||||
int32_t m_GLsizePadding;
|
||||
int32_t m_GLsize;
|
||||
float m_pos[4];
|
||||
int32_t m_GLposText;
|
||||
int32_t m_GLstate;
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
draw::Colorf m_color[3];
|
||||
void SetPoint(float x, float y);
|
||||
void Rectangle(float x, float y, float w, float h);
|
||||
#endif
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLsizeBorder;
|
||||
int32_t m_GLsizePadding;
|
||||
int32_t m_GLsize;
|
||||
float m_pos[4];
|
||||
int32_t m_GLposText;
|
||||
int32_t m_GLstate;
|
||||
etk::Vector<etk::Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
draw::Colorf m_color[3];
|
||||
void SetPoint(float x, float y);
|
||||
void Rectangle(float x, float y, float w, float h);
|
||||
private:
|
||||
ewol::OObject2DTextColored m_oObjectText; //!< text display
|
||||
ewol::OObject2DColored m_oObjectDecoration; //!< background display
|
||||
|
@ -156,11 +156,7 @@ void ewol::Scene::PeriodicCall(int64_t localTime)
|
||||
void ewol::Scene::GenDraw(DrawProperty displayProp)
|
||||
{
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::openGL::Push();
|
||||
#else
|
||||
glPushMatrix();
|
||||
#endif
|
||||
ewol::openGL::Push();
|
||||
// here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left
|
||||
glViewport( m_origin.x,
|
||||
m_origin.y,
|
||||
@ -169,7 +165,6 @@ void ewol::Scene::GenDraw(DrawProperty displayProp)
|
||||
float ratio = m_size.x / m_size.y;
|
||||
m_zoom = 1.0/1000.0;
|
||||
//EWOL_INFO("ratio : " << ratio);
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Matrix4 tmpProjection;
|
||||
|
||||
if (ratio >= 1.0) {
|
||||
@ -182,31 +177,13 @@ void ewol::Scene::GenDraw(DrawProperty displayProp)
|
||||
etk::Matrix4 tmpMat = tmpProjection * tmpScale;
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
#else
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
if (ratio >= 1.0) {
|
||||
glOrthoEwol(-ratio, ratio, -1, 1, -1, 1);
|
||||
} else {
|
||||
ratio = 1.0/ratio;
|
||||
glOrthoEwol(-1, 1, -ratio, ratio, -1, 1);
|
||||
}
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glScalef(m_zoom, m_zoom, m_zoom);
|
||||
|
||||
#endif
|
||||
// Clear the screen with transparency ...
|
||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
// Call the widget drawing methode
|
||||
OnDraw(displayProp);
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::openGL::Pop();
|
||||
#else
|
||||
glPopMatrix();
|
||||
#endif
|
||||
ewol::openGL::Pop();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -230,11 +230,7 @@ void ewol::Widget::GenDraw(DrawProperty displayProp)
|
||||
// widget is hidden ...
|
||||
return;
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::openGL::Push();
|
||||
#else
|
||||
glPushMatrix();
|
||||
#endif
|
||||
ewol::openGL::Push();
|
||||
if( (displayProp.m_origin.x > m_origin.x)
|
||||
|| (displayProp.m_origin.x + displayProp.m_size.x < m_size.x + m_origin.x) ) {
|
||||
// here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left
|
||||
@ -252,23 +248,12 @@ void ewol::Widget::GenDraw(DrawProperty displayProp)
|
||||
tmpOriginY,
|
||||
tmpclipX,
|
||||
m_size.y);
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Matrix4 tmpTranslate = etk::matrix::Translate(-tmpclipX/2 - (tmpOriginX-m_origin.x), -m_size.y/2, -1.0);
|
||||
etk::Matrix4 tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0);
|
||||
etk::Matrix4 tmpProjection = etk::matrix::Perspective(-tmpclipX/2, tmpclipX/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
etk::Matrix4 tmpMat = tmpProjection * tmpScale * tmpTranslate;
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
#else
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrthoEwol(-tmpclipX/2, tmpclipX/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
//glOrthoEwol(0., m_size.x, 0., -m_size.y, 1., 20.);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(-tmpclipX/2 - (tmpOriginX-m_origin.x), -m_size.y/2, -1.0);
|
||||
#endif
|
||||
etk::Matrix4 tmpTranslate = etk::matrix::Translate(-tmpclipX/2 - (tmpOriginX-m_origin.x), -m_size.y/2, -1.0);
|
||||
etk::Matrix4 tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0);
|
||||
etk::Matrix4 tmpProjection = etk::matrix::Perspective(-tmpclipX/2, tmpclipX/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
etk::Matrix4 tmpMat = tmpProjection * tmpScale * tmpTranslate;
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
// Call the widget drawing methode
|
||||
displayProp.m_origin.x = tmpOriginX;
|
||||
displayProp.m_origin.y = tmpOriginY;
|
||||
@ -280,36 +265,22 @@ void ewol::Widget::GenDraw(DrawProperty displayProp)
|
||||
m_origin.y,
|
||||
m_size.x,
|
||||
m_size.y);
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
#if 1
|
||||
etk::Matrix4 tmpTranslate = etk::matrix::Translate(-m_size.x/2, -m_size.y/2, -1.0);
|
||||
etk::Matrix4 tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0);
|
||||
etk::Matrix4 tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
etk::Matrix4 tmpMat = tmpProjection * tmpScale * tmpTranslate;
|
||||
#else
|
||||
etk::Matrix4 tmpMat = etk::matrix::Perspective(0, m_size.x, 0, m_size.y, -1, 1);
|
||||
#endif
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
#if 1
|
||||
etk::Matrix4 tmpTranslate = etk::matrix::Translate(-m_size.x/2, -m_size.y/2, -1.0);
|
||||
etk::Matrix4 tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0);
|
||||
etk::Matrix4 tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
etk::Matrix4 tmpMat = tmpProjection * tmpScale * tmpTranslate;
|
||||
#else
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
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);
|
||||
etk::Matrix4 tmpMat = etk::matrix::Perspective(0, m_size.x, 0, m_size.y, -1, 1);
|
||||
#endif
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
// Call the widget drawing methode
|
||||
displayProp.m_origin = m_origin;
|
||||
displayProp.m_size = m_size;
|
||||
OnDraw(displayProp);
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::openGL::Pop();
|
||||
#else
|
||||
glPopMatrix();
|
||||
#endif
|
||||
ewol::openGL::Pop();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -364,33 +364,19 @@ void ewol::WidgetScrooled::OnDraw(DrawProperty& displayProp)
|
||||
*/
|
||||
void ewol::WidgetScrooled::GenDraw(DrawProperty displayProp)
|
||||
{
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::openGL::Push();
|
||||
#else
|
||||
glPushMatrix();
|
||||
#endif
|
||||
ewol::openGL::Push();
|
||||
if (SCROLL_MODE_CENTER == m_scroollingMode) {
|
||||
// here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left
|
||||
glViewport( m_origin.x,
|
||||
m_origin.y,
|
||||
m_size.x,
|
||||
m_size.y);
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Matrix4 tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
etk::Matrix4 tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0);
|
||||
etk::Matrix4 tmpTranslate = etk::matrix::Translate(-m_maxSize.x/2, -m_maxSize.y/2, -1.0);
|
||||
etk::Matrix4 tmpMat = tmpProjection * tmpScale * tmpTranslate;
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
#else
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrthoEwol(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glScalef(m_zoom, m_zoom, 1.0);
|
||||
glTranslatef(-m_maxSize.x/2, -m_maxSize.y/2, -1.0);
|
||||
#endif
|
||||
etk::Matrix4 tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
etk::Matrix4 tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0);
|
||||
etk::Matrix4 tmpTranslate = etk::matrix::Translate(-m_maxSize.x/2, -m_maxSize.y/2, -1.0);
|
||||
etk::Matrix4 tmpMat = tmpProjection * tmpScale * tmpTranslate;
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
// Call the widget drawing methode
|
||||
OnDraw(displayProp);
|
||||
} if (SCROLL_MODE_GAME == m_scroollingMode) {
|
||||
@ -400,31 +386,17 @@ void ewol::WidgetScrooled::GenDraw(DrawProperty displayProp)
|
||||
m_size.x,
|
||||
m_size.y);
|
||||
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
etk::Matrix4 tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
etk::Matrix4 tmpTranslate = etk::matrix::Translate(-m_maxSize.x/2, -m_maxSize.y/2, -1.0);
|
||||
etk::Matrix4 tmpMat = tmpProjection * tmpTranslate;
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
#else
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrthoEwol(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
//glScalef(m_zoom, m_zoom, 1.0);
|
||||
glTranslatef(-m_maxSize.x/2, -m_maxSize.y/2, -1.0);
|
||||
#endif
|
||||
etk::Matrix4 tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
|
||||
etk::Matrix4 tmpTranslate = etk::matrix::Translate(-m_maxSize.x/2, -m_maxSize.y/2, -1.0);
|
||||
etk::Matrix4 tmpMat = tmpProjection * tmpTranslate;
|
||||
// set internal matrix system :
|
||||
ewol::openGL::SetMatrix(tmpMat);
|
||||
// Call the widget drawing methode
|
||||
OnDraw(displayProp);
|
||||
} else {
|
||||
ewol::Widget::GenDraw(displayProp);
|
||||
}
|
||||
#ifdef __VIDEO__OPENGL_ES_2
|
||||
ewol::openGL::Pop();
|
||||
#else
|
||||
glPopMatrix();
|
||||
#endif
|
||||
ewol::openGL::Pop();
|
||||
}
|
||||
|
||||
|
||||
|
1
Sources/libewol/tag
Normal file
1
Sources/libewol/tag
Normal file
@ -0,0 +1 @@
|
||||
0.4.2
|
@ -6,15 +6,8 @@ LOCAL_MODULE := glew
|
||||
|
||||
#http://glew.sourceforge.net/index.html
|
||||
|
||||
#ifneq ("$(CONFIG__VIDEO__OPENGL_ES_2)","")
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/glew/include/
|
||||
LOCAL_EXPORT_LDLIBS := $(LOCAL_PATH)/glew/lib/glew32s.lib -lopengl32 -lgdi32
|
||||
# to enable open gl 2 mode
|
||||
LOCAL_CFLAGS += -D__VIDEO__OPENGL_ES_2
|
||||
LOCAL_EXPORT_CFLAGS := -D__VIDEO__OPENGL_ES_2
|
||||
#else
|
||||
# LOCAL_EXPORT_LDLIBS := -lopengl32 -lgdi32
|
||||
#endif
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/glew/include/
|
||||
LOCAL_EXPORT_LDLIBS := $(LOCAL_PATH)/glew/lib/glew32s.lib -lopengl32 -lgdi32
|
||||
|
||||
include $(BUILD_PREBUILT)
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit edfe4d2aa6e50b496ff3c10203984e5b090c516d
|
||||
Subproject commit fcd7a0542ea39a8164ca97b832965adc6fda08ee
|
Loading…
x
Reference in New Issue
Block a user