Commit f1178162 by Luis Penaranda

explicitly ask for opengl 2.1, also in shaders

1 parent 8e1fbd14
#ifndef GLINCLUDES_H
#define GLINCLUDES_H
// GLew might not be needed on mac, or if a recent version of OpenGL is present
#ifndef __APPLE__
#include <GL/glew.h>
#if (!defined GLEW_VERSION_1_5) || (!defined GL_VERSION_3_1)
#error GLEW 1.5.2 is required
#endif
#endif
// TODO: test on mac
#define GL_GLEXT_PROTOTYPES 1
#ifdef __APPLE__
#include<OpenGL/gl.h>
#include<OpenGL/glu.h>
#include<Glut/glut.h>
#include<OpenGL/glext.h>
//#include<OpenGL/glext.h>
#else
//#include <GL/gl.h>
//#include <GL/glu.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
// is glext really needed?
//#include <GL/glext.h>
#endif
// GLew might not be needed on mac, or if a recent version of OpenGL is present
//#ifndef __APPLE__
#ifndef GL_VERSION_2_1
// OpenGL>=2.1 not found, try GLEW
#include <GL/glew.h>
#ifndef GLEW_VERSION_2_1
#error OpenGL 2.1 or GLEW is required
#endif
#endif
//#endif
#endif // GLINCLUDES_H
#version 120
uniform sampler2D diffuse_texture;
varying vec2 texcoord0;
varying vec4 K_color;
......
#version 120
varying vec2 texcoord0;
vec4 pos;
float u, v, x, y, z;
varying float r, theta, s;
float lambda, phi;
float extent, scale, vis_mode, center_lambda, center_phi;
varying float zbu,zbv,zblambda,zbr,zbR,zbalpha,zbrho;
varying float zblambda,zbr,zbR,zbalpha,zbrho;
void main(void){
......@@ -80,13 +82,14 @@ void main(void){
}
else if (vis_mode==6.0) { // Zorin-Barr
// perspective projection
zbu = x/(-z);
zbv = y/(-z);
u=x/(-z);
v=y/(-z);
// Z-B transformation
// TODO: read zblambda and zbR from the interface
zblambda=0.1;
zbR=1.0;
zbalpha=atan(zbv,zbu);
zbr=sqrt(zbu*zbu+zbv*zbv);
zbalpha=atan(v,u);
zbr=sqrt(u*u+v*v);
zbrho=(zblambda*zbr/zbR)+(1.0-zblambda)*(zbR*(sqrt(zbr*zbr+1.0)-1.0))/(zbr*(sqrt(zbR*zbR+1.0)-1.0));
u=zbrho*cos(zbalpha);
v=zbrho*sin(zbalpha);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!