\doxysection{glview\+\_\+example\+\_\+01.\+c}
\hypertarget{glview_example_01_8c-example}{}\label{glview_example_01_8c-example}
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Elementary.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <Evas\_GL.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\_GLData\ GLData;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ GL\ related\ data\ here..}}
\DoxyCodeLine{\textcolor{keyword}{struct\ }\_GLData}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Evas__GL__API}{Evas\_GL\_API}}\ *glapi;}
\DoxyCodeLine{\ \ \ GLuint\ \ \ \ \ \ \ program;}
\DoxyCodeLine{\ \ \ GLuint\ \ \ \ \ \ \ vtx\_shader;}
\DoxyCodeLine{\ \ \ GLuint\ \ \ \ \ \ \ fgmt\_shader;}
\DoxyCodeLine{\ \ \ GLuint\ \ \ \ \ \ \ vbo;}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ \ \ \ \ \ \ \ \ \ initialized\ :\ 1;}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{float}\ red\ =\ 1.0;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\///}}
\DoxyCodeLine{\textcolor{comment}{//\ a\ helper\ function\ to\ load\ shaders\ from\ a\ shader\ source}}
\DoxyCodeLine{\textcolor{keyword}{static}\ GLuint}
\DoxyCodeLine{load\_shader(\ GLData\ *gld,\ GLenum\ type,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *shader\_src\ )}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Evas__GL__API}{Evas\_GL\_API}}\ *gl\ =\ gld-\/>glapi;}
\DoxyCodeLine{\ \ \ GLuint\ shader;}
\DoxyCodeLine{\ \ \ GLint\ compiled;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ Create\ the\ shader\ object}}
\DoxyCodeLine{\ \ \ shader\ =\ gl-\/>glCreateShader(type);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (shader==0)}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ Load/Compile\ shader\ source}}
\DoxyCodeLine{\ \ \ gl-\/>glShaderSource(shader,\ 1,\ \&shader\_src,\ NULL);}
\DoxyCodeLine{\ \ \ gl-\/>glCompileShader(shader);}
\DoxyCodeLine{\ \ \ gl-\/>glGetShaderiv(shader,\ GL\_COMPILE\_STATUS,\ \&compiled);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!compiled)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ GLint\ info\_len\ =\ 0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ gl-\/>glGetShaderiv(shader,\ GL\_INFO\_LOG\_LENGTH,\ \&info\_len);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (info\_len\ >\ 1)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}*\ info\_log\ =\ malloc(\textcolor{keyword}{sizeof}(\textcolor{keywordtype}{char})\ *\ info\_len);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ gl-\/>glGetShaderInfoLog(shader,\ info\_len,\ NULL,\ info\_log);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}Error\ compiling\ shader:\(\backslash\)n\%s\(\backslash\)n======\(\backslash\)n\%s\(\backslash\)n======\(\backslash\)n"{}},\ info\_log,\ shader\_src\ );}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ free(info\_log);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ gl-\/>glDeleteShader(shader);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ shader;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Initialize\ the\ shader\ and\ program\ object}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{init\_shaders(GLData\ *gld)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Evas__GL__API}{Evas\_GL\_API}}\ *gl\ =\ gld-\/>glapi;}
\DoxyCodeLine{\ \ \ GLbyte\ vShaderStr[]\ =}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}attribute\ vec4\ vPosition;\ \ \ \ \(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}void\ main()\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}\{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}\ \ \ gl\_Position\ =\ vPosition;\ \ \(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}\}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)n"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ GLbyte\ fShaderStr[]\ =}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}\#ifdef\ GL\_ES\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}precision\ mediump\ float;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}\#endif\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}void\ main()\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}\{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}\ \ gl\_FragColor\ =\ vec4\ (\ 1.0,\ 0.0,\ 0.0,\ 1.0\ );\(\backslash\)n"{}}}
\DoxyCodeLine{\ \ \ \ \ \ \textcolor{stringliteral}{"{}\}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)n"{}};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ GLint\ linked;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ Load\ the\ vertex/fragment\ shaders}}
\DoxyCodeLine{\ \ \ gld-\/>vtx\_shader\ \ =\ load\_shader(gld,\ GL\_VERTEX\_SHADER,\ (\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*)vShaderStr);}
\DoxyCodeLine{\ \ \ gld-\/>fgmt\_shader\ =\ load\_shader(gld,\ GL\_FRAGMENT\_SHADER,\ (\textcolor{keyword}{const}\ \textcolor{keywordtype}{char}*)fShaderStr);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ Create\ the\ program\ object}}
\DoxyCodeLine{\ \ \ gld-\/>program\ =\ gl-\/>glCreateProgram(\ );}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (gld-\/>program==0)}
\DoxyCodeLine{\ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ gl-\/>glAttachShader(gld-\/>program,\ gld-\/>vtx\_shader);}
\DoxyCodeLine{\ \ \ gl-\/>glAttachShader(gld-\/>program,\ gld-\/>fgmt\_shader);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ gl-\/>glBindAttribLocation(gld-\/>program,\ 0,\ \textcolor{stringliteral}{"{}vPosition"{}});}
\DoxyCodeLine{\ \ \ gl-\/>glLinkProgram(gld-\/>program);}
\DoxyCodeLine{\ \ \ gl-\/>glGetProgramiv(gld-\/>program,\ GL\_LINK\_STATUS,\ \&linked);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!linked)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ GLint\ info\_len\ =\ 0;}
\DoxyCodeLine{\ \ \ \ \ \ \ \ gl-\/>glGetProgramiv(gld-\/>program,\ GL\_INFO\_LOG\_LENGTH,\ \&info\_len);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (info\_len\ >\ 1)}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{char}*\ info\_log\ =\ malloc(\textcolor{keyword}{sizeof}(\textcolor{keywordtype}{char})\ *\ info\_len);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ gl-\/>glGetProgramInfoLog(gld-\/>program,\ info\_len,\ NULL,\ info\_log);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}Error\ linking\ program:\(\backslash\)n\%s\(\backslash\)n"{}},\ info\_log);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ free(info\_log);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \ \ \ \ \ gl-\/>glDeleteProgram(gld-\/>program);}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ Callbacks}}
\DoxyCodeLine{\textcolor{comment}{//\ intialize\ callback\ that\ gets\ called\ once\ for\ intialization}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_init\_gl(Evas\_Object\ *obj)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ GLData\ *gld\ =\ evas\_object\_data\_get(obj,\ \textcolor{stringliteral}{"{}gld"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Evas__GL__API}{Evas\_GL\_API}}\ *gl\ =\ gld-\/>glapi;}
\DoxyCodeLine{\ \ \ GLfloat\ vVertices[]\ =\ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ 0.0f,\ \ 0.5f,\ 0.0f,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ -\/0.5f,\ -\/0.5f,\ 0.0f,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ 0.5f,\ -\/0.5f,\ 0.0f\ \};}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!init\_shaders(gld))}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}Error\ Initializing\ Shaders\(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ gl-\/>glGenBuffers(1,\ \&gld-\/>vbo);}
\DoxyCodeLine{\ \ \ gl-\/>glBindBuffer(GL\_ARRAY\_BUFFER,\ gld-\/>vbo);}
\DoxyCodeLine{\ \ \ gl-\/>glBufferData(GL\_ARRAY\_BUFFER,\ 3\ *\ 3\ *\ 4,\ vVertices,\ GL\_STATIC\_DRAW);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ delete\ callback\ gets\ called\ when\ glview\ is\ deleted}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_del\_gl(Evas\_Object\ *obj)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ GLData\ *gld\ =\ evas\_object\_data\_get(obj,\ \textcolor{stringliteral}{"{}gld"{}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!gld)}
\DoxyCodeLine{\ \ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ printf(\textcolor{stringliteral}{"{}Unable\ to\ get\ GLData.\ \(\backslash\)n"{}});}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{\ \ \ \ \ \}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Evas__GL__API}{Evas\_GL\_API}}\ *gl\ =\ gld-\/>glapi;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ gl-\/>glDeleteShader(gld-\/>vtx\_shader);}
\DoxyCodeLine{\ \ \ gl-\/>glDeleteShader(gld-\/>fgmt\_shader);}
\DoxyCodeLine{\ \ \ gl-\/>glDeleteProgram(gld-\/>program);}
\DoxyCodeLine{\ \ \ gl-\/>glDeleteBuffers(1,\ \&gld-\/>vbo);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ evas\_object\_data\_del((Evas\_Object*)obj,\ \textcolor{stringliteral}{"{}..gld"{}});}
\DoxyCodeLine{\ \ \ free(gld);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ resize\ callback\ gets\ called\ every\ time\ object\ is\ resized}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_resize\_gl(Evas\_Object\ *obj)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ w,\ h;}
\DoxyCodeLine{\ \ \ GLData\ *gld\ =\ evas\_object\_data\_get(obj,\ \textcolor{stringliteral}{"{}gld"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Evas__GL__API}{Evas\_GL\_API}}\ *gl\ =\ gld-\/>glapi;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Glview__Group_ga58a8ed33d880aaad30a52aad3b221d9b}{elm\_glview\_size\_get}}(obj,\ \&w,\ \&h);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ GL\ Viewport\ stuff.\ you\ can\ avoid\ doing\ this\ if\ viewport\ is\ all\ the}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ same\ as\ last\ frame\ if\ you\ want}}
\DoxyCodeLine{\ \ \ gl-\/>glViewport(0,\ 0,\ w,\ h);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ draw\ callback\ is\ where\ all\ the\ main\ GL\ rendering\ happens}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_draw\_gl(Evas\_Object\ *obj)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{struct__Evas__GL__API}{Evas\_GL\_API}}\ *gl\ =\ \mbox{\hyperlink{group__Elm__Glview__Group_ga8b94eab0772d81016192ce033c943a7a}{elm\_glview\_gl\_api\_get}}(obj);}
\DoxyCodeLine{\ \ \ GLData\ *gld\ =\ evas\_object\_data\_get(obj,\ \textcolor{stringliteral}{"{}gld"{}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!gld)\ \textcolor{keywordflow}{return};}
\DoxyCodeLine{\ \ \ \textcolor{keywordtype}{int}\ w,\ h;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Glview__Group_ga58a8ed33d880aaad30a52aad3b221d9b}{elm\_glview\_size\_get}}(obj,\ \&w,\ \&h);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ gl-\/>glViewport(0,\ 0,\ w,\ h);}
\DoxyCodeLine{\ \ \ gl-\/>glClearColor(red,0.8,0.3,1);}
\DoxyCodeLine{\ \ \ gl-\/>glClear(GL\_COLOR\_BUFFER\_BIT);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ Draw\ a\ Triangle}}
\DoxyCodeLine{\ \ \ gl-\/>glEnable(GL\_BLEND);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ gl-\/>glUseProgram(gld-\/>program);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ gl-\/>glBindBuffer(GL\_ARRAY\_BUFFER,\ gld-\/>vbo);}
\DoxyCodeLine{\ \ \ gl-\/>glVertexAttribPointer(0,\ 3,\ GL\_FLOAT,\ GL\_FALSE,}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0,\ 0);}
\DoxyCodeLine{\ \ \ gl-\/>glEnableVertexAttribArray(0);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ gl-\/>glDrawArrays(GL\_TRIANGLES,\ 0,\ 3);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ Optional\ -\/\ Flush\ the\ GL\ pipeline}}
\DoxyCodeLine{\ \ \ gl-\/>glFinish();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ red\ -\/=\ 0.1;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (red\ <\ 0.0)\ red\ =\ 1.0;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{//\ just\ need\ to\ notify\ that\ glview\ has\ changed\ so\ it\ can\ render}}
\DoxyCodeLine{\textcolor{keyword}{static}\ \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}}
\DoxyCodeLine{\_anim(\textcolor{keywordtype}{void}\ *data)}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Glview__Group_ga1e1544c2e0a7531f07e8cae105c38e3b}{elm\_glview\_changed\_set}}(data);}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_on\_done(\textcolor{keywordtype}{void}\ *data,\ Evas\_Object\ *obj\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{void}\ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9217cf1d90690dbd1960db155d1c7476}{evas\_object\_del}}((Evas\_Object*)data);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_gabada1ccecc6a712df48e90cbf9915c35}{elm\_exit}}();}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static}\ \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_del(\textcolor{keywordtype}{void}\ *data\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ Evas\ *evas\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ Evas\_Object\ *obj,\ \textcolor{keywordtype}{void}\ *event\_info\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{structEcore__Animator}{Ecore\_Animator}}\ *ani\ =\ evas\_object\_data\_get(obj,\ \textcolor{stringliteral}{"{}ani"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Ecore__Animator__Group_gac1b19c4289efbb15193077098a13b30e}{ecore\_animator\_del}}(ani);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{EAPI\_MAIN\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{elm\_main(\textcolor{keywordtype}{int}\ argc\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{char}\ **argv\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Evas\_Object\ *win,\ *bx,\ *bt,\ *gl;}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{structEcore__Animator}{Ecore\_Animator}}\ *ani;}
\DoxyCodeLine{\ \ \ GLData\ *gld\ =\ NULL;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (!(gld\ =\ calloc(1,\ \textcolor{keyword}{sizeof}(GLData))))\ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga7a05f37fd3a019da5e26c5fc91fcd937}{elm\_policy\_set}}(\mbox{\hyperlink{group__Elm__General_ggaa16f3378ecdbf660fa378402e3c5a0a9a02fadb6faada04b19d0fa42c11a8d32a}{ELM\_POLICY\_QUIT}},\ \mbox{\hyperlink{group__Elm__General_gga46af37e6ac2c406321060be827117196abbe0962d88ae12afe1a173da881f56cd}{ELM\_POLICY\_QUIT\_LAST\_WINDOW\_CLOSED}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ win\ =\ \mbox{\hyperlink{group__Elm__Win__Group_ga23d9d1ffa0a65a1a1dd482d570db1ba0}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"{}glview\ simple"{}},\ \textcolor{stringliteral}{"{}GLView\ Simple"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Win__Group_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win,\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ bx\ =\ \mbox{\hyperlink{group__Elm__Box__Group_ga49ec615c90bf8bead2158d5ffab2e445}{elm\_box\_add}}(win);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(bx,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Win__Group_ga505d6bd217e5ee01e82b548ec35986eb}{elm\_win\_resize\_object\_add}}(win,\ bx);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(bx);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//-\///-\///-\///\ THIS\ IS\ WHERE\ GL\ INIT\ STUFF\ HAPPENS\ (ALA\ EGL)}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//-\///}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ create\ a\ new\ glview\ object}}
\DoxyCodeLine{\ \ \ gl\ =\ \mbox{\hyperlink{group__Elm__Glview__Group_ga096e864474d695e946c88e6352265042}{elm\_glview\_add}}(win);}
\DoxyCodeLine{\ \ \ gld-\/>glapi\ =\ \mbox{\hyperlink{group__Elm__Glview__Group_ga8b94eab0772d81016192ce033c943a7a}{elm\_glview\_gl\_api\_get}}(gl);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(gl,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(gl,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ mode\ is\ simply\ for\ supporting\ alpha,\ depth\ buffering,\ and\ stencil}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ buffering.}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Glview__Group_ga82348ac294c3743da572ba7dc8aa6b1f}{elm\_glview\_mode\_set}}(gl,\ \mbox{\hyperlink{group__Elm__Glview__Group_gga4d0a2281e13c66d7274987ef24e7abe7a00c61dd95cd14bfb20b575e85913990a}{ELM\_GLVIEW\_ALPHA}}\ |\ \mbox{\hyperlink{group__Elm__Glview__Group_gga4d0a2281e13c66d7274987ef24e7abe7ae9ce1787f812b721ab0403ebaad3e442}{ELM\_GLVIEW\_DEPTH}});}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ resize\ policy\ tells\ glview\ what\ to\ do\ with\ the\ surface\ when\ it}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ resizes.\ \ ELM\_GLVIEW\_RESIZE\_POLICY\_RECREATE\ will\ tell\ it\ to}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ destroy\ the\ current\ surface\ and\ recreate\ it\ to\ the\ new\ size}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Glview__Group_gae75f6350beb7accb8fa8f2b5f6731be4}{elm\_glview\_resize\_policy\_set}}(gl,\ ELM\_GLVIEW\_RESIZE\_POLICY\_RECREATE);}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ render\ policy\ tells\ glview\ how\ it\ would\ like\ glview\ to\ render}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ gl\ code.\ ELM\_GLVIEW\_RENDER\_POLICY\_ON\_DEMAND\ will\ have\ the\ gl}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ calls\ called\ in\ the\ pixel\_get\ callback,\ which\ only\ gets\ called}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ if\ the\ object\ is\ visible,\ hence\ ON\_DEMAND.\ \ ALWAYS\ mode\ renders}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ it\ despite\ the\ visibility\ of\ the\ object.}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Glview__Group_gaff708b4fd60786608f3ab626d68b5b34}{elm\_glview\_render\_policy\_set}}(gl,\ ELM\_GLVIEW\_RENDER\_POLICY\_ON\_DEMAND);}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ initialize\ callback\ function\ gets\ registered\ here}}
\DoxyCodeLine{\ \ \ elm\_glview\_init\_func\_set(gl,\ \_init\_gl);}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ delete\ callback\ function\ gets\ registered\ here}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Glview__Group_gae6bc093d6804c3131df752e80aca724c}{elm\_glview\_del\_func\_set}}(gl,\ \_del\_gl);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Glview__Group_ga4f3cc094a7f467595c6c5d4ebb8a02cd}{elm\_glview\_resize\_func\_set}}(gl,\ \_resize\_gl);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Glview__Group_ga0a2bcda5d7e37ed2dbfd43da47046f05}{elm\_glview\_render\_func\_set}}(gl,\ \_draw\_gl);}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//-\///}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//-\///-\///-\///\ END\ GL\ INIT\ BLOB}}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx,\ gl);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(gl);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Focus_ga05e39b5e60ad861c63100c811855ef55}{elm\_object\_focus\_set}}(gl,\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ animating\ -\/\ just\ a\ demo.\ as\ long\ as\ you\ trigger\ an\ update\ on\ the\ image}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ object\ via\ elm\_glview\_changed\_set()\ it\ will\ be\ updated.}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ NOTE:\ if\ you\ delete\ gl,\ this\ animator\ will\ keep\ running\ trying\ to\ access}}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ gl\ so\ you'd\ better\ delete\ this\ animator\ with\ ecore\_animator\_del().}}
\DoxyCodeLine{\ \ \ ani\ =\ \mbox{\hyperlink{group__Ecore__Animator__Group_ga0eca52138288075de4487d31dd3942ff}{ecore\_animator\_add}}(\_anim,\ gl);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Extras_ga3061f8abe8f1a1f657d622ae0409d8e3}{evas\_object\_data\_set}}(gl,\ \textcolor{stringliteral}{"{}ani"{}},\ ani);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Extras_ga3061f8abe8f1a1f657d622ae0409d8e3}{evas\_object\_data\_set}}(gl,\ \textcolor{stringliteral}{"{}gld"{}},\ gld);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Events_gac71a1038dad71da36f57b70c8ad10252}{evas\_object\_event\_callback\_add}}(gl,\ \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a4471afbcbb4a754b7b0bbde00fb9a277}{EVAS\_CALLBACK\_DEL}},\ \_del,\ gl);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ add\ an\ 'OK'\ button\ to\ end\ the\ program}}
\DoxyCodeLine{\ \ \ bt\ =\ \mbox{\hyperlink{group__Elm__Button_gaf5caf46d74c4e122a18da323935d25e4}{elm\_button\_add}}(win);}
\DoxyCodeLine{\ \ \ elm\_object\_text\_set(bt,\ \textcolor{stringliteral}{"{}OK"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gaaf1d3e26e36b316977336066b6f56632}{evas\_object\_size\_hint\_align\_set}}(bt,\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}},\ \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga9379629ad8ad2860aa786d838a4a106a}{evas\_object\_size\_hint\_weight\_set}}(bt,\ \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}},\ 0.0);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx,\ bt);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(bt);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(bt,\ \textcolor{stringliteral}{"{}clicked"{}},\ \_on\_done,\ win);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(win,\ 320,\ 480);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(win);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{comment}{//\ run\ the\ mainloop\ and\ process\ events\ and\ callbacks}}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_gadf2553f83e6b0b9c7fbe054019a664a1}{elm\_run}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\}}
\DoxyCodeLine{\mbox{\hyperlink{group__Elm__General_ga50fe52d513f7e89c9c770afd76de7ad9}{ELM\_MAIN}}()}

\end{DoxyCodeInclude}
 