Commit f1178162 authored by Luis Penaranda's avatar Luis Penaranda

explicitly ask for opengl 2.1, also in shaders

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