- atan(pos.y,pos.x) - phase ); \
} \
";
// handle to the shader
void print_shader_info_log (GLuint shader){
GLint length;
glGetShaderiv ( shader , GL_INFO_LOG_LENGTH , &length );
if ( length ) {
char* buffer = new char [ length ];
glGetShaderInfoLog ( shader , length , NULL , buffer );
cout << "shader info: " << buffer << flush;
delete [] buffer;
GLint success;
glGetShaderiv( shader, GL_COMPILE_STATUS, &success );
if ( success != GL_TRUE ) exit ( 1 );
}
}
GLuint load_shader ( const char *shader_source, GLenum type){
GLuint shader = glCreateShader( type );
glShaderSource ( shader , 1 , &shader_source , NULL );
glCompileShader ( shader );
print_shader_info_log ( shader );
return shader;
}
Display *x_display;
Window win;
EGLDisplay egl_display;
EGLContext egl_context;
EGLSurface egl_surface;
GLfloat
norm_x = 0.0,
norm_y = 0.0,
offset_x = 0.0,
offset_y = 0.0,
p1_pos_x = 0.0,
p1_pos_y = 0.0;
GLint phase_loc, offset_loc, position_loc;
bool update_pos = false;
const float vertexArray[] = {
0.0, 0.5, 0.0,
-0.5, 0.0, 0.0,
0.0, -0.5, 0.0,
0.5, 0.0, 0.0,
0.0, 0.5, 0.0
};
void render(){
static float phase = 0;
static int donesetup = 0;
static XWindowAttributes gwa;
draw
if ( !donesetup ) {
XWindowAttributes gwa;
XGetWindow