Fixes for OS X: GLSL version must be first line in source, don't init glut

(Qt apparently uses it?)
This commit is contained in:
Andrzej Kapolka 2013-05-15 16:19:42 -07:00
parent f15c670c4e
commit f0055bd419
5 changed files with 14 additions and 11 deletions

View file

@ -1,3 +1,5 @@
#version 120
// //
// For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html: // For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html:
// //
@ -30,8 +32,6 @@
// Copyright (c) 2004 Sean O'Neil // Copyright (c) 2004 Sean O'Neil
// //
#version 120
uniform vec3 v3LightPos; uniform vec3 v3LightPos;
uniform float g; uniform float g;
uniform float g2; uniform float g2;

View file

@ -1,3 +1,5 @@
#version 120
// //
// For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html: // For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html:
// //
@ -30,8 +32,6 @@
// Copyright (c) 2004 Sean O'Neil // Copyright (c) 2004 Sean O'Neil
// //
#version 120
uniform vec3 v3CameraPos; // The camera's current position uniform vec3 v3CameraPos; // The camera's current position
uniform vec3 v3LightPos; // The direction vector to the light source uniform vec3 v3LightPos; // The direction vector to the light source
uniform vec3 v3InvWavelength; // 1 / pow(wavelength, 4) for the red, green, and blue channels uniform vec3 v3InvWavelength; // 1 / pow(wavelength, 4) for the red, green, and blue channels

View file

@ -1,3 +1,5 @@
#version 120
// //
// For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html: // For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html:
// //
@ -30,8 +32,6 @@
// Copyright (c) 2004 Sean O'Neil // Copyright (c) 2004 Sean O'Neil
// //
#version 120
uniform vec3 v3LightPos; uniform vec3 v3LightPos;
uniform float g; uniform float g;
uniform float g2; uniform float g2;

View file

@ -1,3 +1,5 @@
#version 120
// //
// For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html: // For licensing information, see http://http.developer.nvidia.com/GPUGems/gpugems_app01.html:
// //
@ -30,8 +32,6 @@
// Copyright (c) 2004 Sean O'Neil // Copyright (c) 2004 Sean O'Neil
// //
#version 120
uniform vec3 v3CameraPos; // The camera's current position uniform vec3 v3CameraPos; // The camera's current position
uniform vec3 v3LightPos; // The direction vector to the light source uniform vec3 v3LightPos; // The direction vector to the light source
uniform vec3 v3InvWavelength; // 1 / pow(wavelength, 4) for the red, green, and blue channels uniform vec3 v3InvWavelength; // 1 / pow(wavelength, 4) for the red, green, and blue channels

View file

@ -224,15 +224,18 @@ Application::Application(int& argc, char** argv) :
// enable mouse tracking; otherwise, we only get drag events // enable mouse tracking; otherwise, we only get drag events
_glWidget->setMouseTracking(true); _glWidget->setMouseTracking(true);
// initialize glut, which we use for rendering spheres and such
glutInit(&argc, argv);
// initialization continues in initializeGL when OpenGL context is ready // initialization continues in initializeGL when OpenGL context is ready
} }
void Application::initializeGL() { void Application::initializeGL() {
printLog( "Created Display Window.\n" ); printLog( "Created Display Window.\n" );
// initialize glut for shape drawing; Qt apparently initializes it on OS X
#ifndef __APPLE__
int argc = 0;
glutInit(&argc, 0);
#endif
#ifdef _WIN32 #ifdef _WIN32
glewInit(); glewInit();
printLog( "Glew Init complete.\n" ); printLog( "Glew Init complete.\n" );