#include "SDL_tizenmouse.h"
#include "SDL_log.h"
#include "SDL_tizentouch.h"
+#include "SDL_tizenopengles.h"
#include <sys/mman.h>
#include <fcntl.h>
mouse->SetRelativeMouseMode = NULL;
}
+ModelMatrix mMatrix;
+
Eina_Bool
_tizen_cb_event_mousedown_change(void *data, int type, void *event)
{
if(e->x > _this->current_glwin->x && e->x < _this->current_glwin->x + _this->current_glwin->w &&
e->y > _this->current_glwin->y && e->y < _this->current_glwin->y + 52)
{
+ ModelMatrixLoadIdentity(&mMatrix);
_this->current_glwin->indicator_show = SDL_TRUE;
_this->current_glwin->last_indicator_showtime = SDL_GetTicks();
}
if(e->x > _this->current_glwin->x && e->x < _this->current_glwin->x + 52 &&
e->y > _this->current_glwin->y && e->y < _this->current_glwin->y + _this->current_glwin->h)
{
+ ModelMatrixLoadIdentity(&mMatrix);
_this->current_glwin->indicator_show = SDL_TRUE;
_this->current_glwin->last_indicator_showtime = SDL_GetTicks();
}
if(e->x > _this->current_glwin->x && e->x < _this->current_glwin->x + _this->current_glwin->w &&
e->y > _this->current_glwin->y + _this->current_glwin->h -52 && e->y < _this->current_glwin->y + _this->current_glwin->h)
{
+ ModelMatrixLoadIdentity(&mMatrix);
_this->current_glwin->indicator_show = SDL_TRUE;
_this->current_glwin->last_indicator_showtime = SDL_GetTicks();
}
if(e->x > _this->current_glwin->x + _this->current_glwin->w -52 && e->x < _this->current_glwin->x + _this->current_glwin->w &&
e->y > _this->current_glwin->y && e->y < _this->current_glwin->y + _this->current_glwin->h)
{
+ ModelMatrixLoadIdentity(&mMatrix);
_this->current_glwin->indicator_show = SDL_TRUE;
_this->current_glwin->last_indicator_showtime = SDL_GetTicks();
}
unsigned int indicator_vbo[4], indicator_ibo[4];
unsigned short indicator_index;
+extern void ModelMatrixLoadIdentity(ModelMatrix* matrix)
+{
+ matrix->m[0][0] = 1.0f;
+ matrix->m[0][1] = 0.0f;
+ matrix->m[0][2] = 0.0f;
+ matrix->m[0][3] = 0.0f;
+
+ matrix->m[1][0] = 0.0f;
+ matrix->m[1][1] = 1.0f;
+ matrix->m[1][2] = 0.0f;
+ matrix->m[1][3] = 0.0f;
+
+ matrix->m[2][0] = 0.0f;
+ matrix->m[2][1] = 0.0f;
+ matrix->m[2][2] = 1.0f;
+ matrix->m[2][3] = 0.0f;
+
+ matrix->m[3][0] = 0.0f;
+ matrix->m[3][1] = 0.0f;
+ matrix->m[3][2] = 0.0f;
+ matrix->m[3][3] = 1.0f;
+}
+
+static void ModelMatrixTranslate(ModelMatrix* matrix, GLfloat x, GLfloat y, GLfloat z)
+{
+ matrix->m[3][0] += (matrix->m[0][0] * x + matrix->m[1][0] * y + matrix->m[2][0] * z);
+ matrix->m[3][1] += (matrix->m[0][1] * x + matrix->m[1][1] * y + matrix->m[2][1] * z);
+ matrix->m[3][2] += (matrix->m[0][2] * x + matrix->m[1][2] * y + matrix->m[2][2] * z);
+ matrix->m[3][3] += (matrix->m[0][3] * x + matrix->m[1][3] * y + matrix->m[2][3] * z);
+}
void Tizen_glTexImage2d()
{
0, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char*)fileInfo.sharedFile->address);
}
+ ModelMatrix mMatrix;
static int Indicator_GLES_Init(SDL_Window* window)
{
SDL_WindowData *wind = window->driverdata;
GLchar vShaderStr[] =
"attribute vec4 vVertices;\n"
"attribute vec2 vCoord;\n"
+ "uniform mat4 modelMatrix;\n"
"varying vec2 Coord;\n"
"void main()\n"
"{\n"
- " gl_Position = vVertices;\n"
+ " gl_Position = modelMatrix * vVertices;\n"
" Coord = vCoord;\n"
"}\n";
Mainctx.glAttachShader(programObject, vertexShader);
Mainctx.glAttachShader(programObject, fragmentShader);
- Mainctx.glBindAttribLocation(programObject, 0, "vVertices");
- Mainctx.glBindAttribLocation(programObject, 1, "vCoord");
-
Mainctx.glLinkProgram(programObject);
Mainctx.glGetProgramiv(programObject, GL_LINK_STATUS, &linked);
/* Ceates and initializes a buffer object's data store */
Mainctx.glBufferData(GL_ARRAY_BUFFER, 12 * 4, vCoord, GL_STATIC_DRAW);
+ Mainctx.glBindAttribLocation(programObject, 0, "vVertices");
+ Mainctx.glBindAttribLocation(programObject, 1, "vCoord");
+
+ ModelMatrixLoadIdentity(&mMatrix);
Mainctx.glGenTextures(1, &textureID);
if(window->last_indicator_showtime + 3000 < SDL_GetTicks())
{
+ switch(window->indicator_type)
+ {
+ case 0://0
+ ModelMatrixTranslate(&mMatrix, 0.0f, 0.02f, 0.0f);
+ break;
+ case 1://90
+ ModelMatrixTranslate(&mMatrix, -0.02f, 0.0f, 0.0f);
+ break;
+ case 2://180
+ ModelMatrixTranslate(&mMatrix, 0.0f, -0.02f, 0.0f);
+ break;
+ case 3://270
+ ModelMatrixTranslate(&mMatrix, 0.02f, 0.0f, 0.0f);
+ break;
+ }
+ }
+
+ Uint32 time = window->last_indicator_showtime;
+ Uint32 getTick = SDL_GetTicks();
+ if(time + 3000> getTick && time + 4000 < getTick)
+ {
window->indicator_show = SDL_FALSE;
}
Mainctx.glBindBuffer(GL_ARRAY_BUFFER, indicator_ibo[window->indicator_type]);
Mainctx.glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0);
+ Mainctx.glUniformMatrix4fv(Mainctx.glGetUniformLocation(programObject, "modelMatrix"), 1, GL_FALSE, mMatrix.m);
+
Mainctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fileInfo.ImageWidth, fileInfo.ImageHeight,0, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char*)fileInfo.sharedFile->address);
Mainctx.glEnableVertexAttribArray(0);
Mainctx.glEnableVertexAttribArray(1);
Mainctx.glBindTexture(GL_TEXTURE_2D, textureID);
Mainctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fileInfo.ImageWidth, fileInfo.ImageHeight,0, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char*)fileInfo.sharedFile->address);
+
+ ModelMatrixLoadIdentity(&mMatrix);
window->indicator_show = SDL_TRUE;
window->last_indicator_showtime = SDL_GetTicks();
}