Commit 859ed454 authored by Nicolas P. Rougier's avatar Nicolas P. Rougier

Merge pull request #49 from burito/master

Removed GLEW for OSX (as it's not needed)
parents f4883105 1588337c
......@@ -69,11 +69,15 @@ ELSE( WIN32 OR WIN64 )
IF ( freetype-gl_LIBS_SUPPLIED )
FIND_PACKAGE( GLUT )
FIND_PACKAGE( Freetype )
FIND_PACKAGE( GLEW )
IF ( NOT APPLE )
FIND_PACKAGE( GLEW )
ENDIF()
ELSE ( freetype-gl_LIBS_SUPPLIED )
FIND_PACKAGE( GLUT REQUIRED )
FIND_PACKAGE( Freetype REQUIRED )
FIND_PACKAGE( GLEW REQUIRED )
IF ( NOT APPLE )
FIND_PACKAGE( GLEW )
ENDIF()
ENDIF ( freetype-gl_LIBS_SUPPLIED )
FIND_PACKAGE( FontConfig )
......@@ -86,7 +90,6 @@ ENDIF( WIN32 OR WIN64 )
INCLUDE_DIRECTORIES( ${GLUT_INCLUDE_DIR}
${OPENGL_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
${GLEW_INCLUDE_PATHS}
${CMAKE_CURRENT_SOURCE_DIR}
${VS789FIX_INCLUDE_DIR}
${GLEW_INCLUDE_PATH})
......@@ -117,11 +120,12 @@ LINK_DIRECTORIES(${PROJECT_SOURCE_DIR})
MACRO( DEMO _target _sources)
add_executable(${_target} ${_sources})
include_directories(${WINDOWS_DIR} ${GLUT_INCLUDE_DIR} ${GLEW_INCLUDE_PATH} ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${ANT_TWEAK_BAR_INCLUDE_PATH})
if(NOT APPLE)
target_link_libraries(${_target} ${GLEW_LIBRARY})
endif()
target_link_libraries(${_target} freetype-gl)
target_link_libraries(${_target} ${OPENGL_LIBRARY})
target_link_libraries(${_target} ${GLUT_LIBRARY})
target_link_libraries(${_target} ${GLEW_LIBRARY})
target_link_libraries(${_target} ${FREETYPE_LIBRARY})
IF( MATH_LIBRARY )
target_link_libraries(${_target} ${MATH_LIBRARY})
......
......@@ -33,11 +33,11 @@
PLATFORM = $(shell uname)
CC = gcc
CFLAGS = -Wno-deprecated-declarations -Wall `freetype-config --cflags` \
-I/usr/X11/include -O3 -I/opt/X11/include
-I/usr/X11/include -O3 -I/opt/X11/include -I/opt/local/include
LIBS = -lGLEW -lGL -lglut -lGLU -lm \
`freetype-config --libs`
ifeq ($(PLATFORM), Darwin)
LIBS = -framework OpenGL -framework GLUT -lGLEW -lm \
LIBS = -framework OpenGL -framework GLUT -lm \
`freetype-config --libs` -L/usr/X11/lib -L/opt/X11/lib
endif
......
......@@ -310,6 +310,7 @@ int main( int argc, char **argv )
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -319,6 +320,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
buffer = text_buffer_new( LCD_FILTERING_OFF );
vec4 black = {{0.0, 0.0, 0.0, 1.0}};
......
......@@ -511,6 +511,7 @@ int main(int argc, char *argv[])
glutCreateWindow( "Font rendering advanced tweaking" );
glutCreateMenu( NULL );
#ifndef __APPLE__
GLenum err = glewInit();
if (GLEW_OK != err)
{
......@@ -519,7 +520,7 @@ int main(int argc, char *argv[])
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
glutDisplayFunc( display );
glutReshapeFunc( reshape );
......
......@@ -217,7 +217,7 @@ int main( int argc, char **argv )
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
glutIdleFunc( idle );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -227,7 +227,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
atlas = texture_atlas_new( 512, 512, 1 );
font = texture_font_new_from_file( atlas, 12, "fonts/VeraMono.ttf" );
buffer = vertex_buffer_new( "vertex:3f,tex_coord:2f,color:4f" );
......
......@@ -159,7 +159,7 @@ int main( int argc, char **argv )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
GLenum err = glewInit();
if (GLEW_OK != err)
{
......@@ -168,7 +168,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
atlas = texture_atlas_new( 1024, 1024, 1 );
buffer = vertex_buffer_new( "vertex:3f,tex_coord:2f,color:4f" );
texture_font_t *font =
......
......@@ -704,7 +704,7 @@ main( int argc, char **argv )
glutKeyboardFunc( on_key_press );
glutSpecialFunc( on_special_key_press );
glutReshapeWindow( 600,400 );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -714,7 +714,7 @@ main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
console = console_new();
console_print( console,
L"OpenGL Freetype console\n"
......
......@@ -149,7 +149,7 @@ int main( int argc, char **argv )
glutKeyboardFunc( keyboard );
//glutTimerFunc( 1000/60, timer, 1000/60 ); // not working on some systems (bug in GLUT)
glutIdleFunc(display);
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -159,7 +159,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
typedef struct { float x,y,z;} xyz;
typedef struct { float r,g,b,a;} rgba;
......
......@@ -271,7 +271,7 @@ main( int argc, char **argv )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -281,7 +281,7 @@ main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
texture_font_t *font = 0;
texture_atlas_t *atlas = texture_atlas_new( 512, 512, 1 );
const char * filename = "fonts/Vera.ttf";
......
......@@ -430,7 +430,7 @@ main( int argc, char **argv )
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
glutTimerFunc( 1000.0/60, timer, 60 );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -440,7 +440,7 @@ main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
program = shader_load( "shaders/distance-field.vert",
"shaders/distance-field-3.frag" );
glUseProgram( program );
......
......@@ -255,7 +255,7 @@ main( int argc, char **argv )
glutMotionFunc( mouse_drag );
glutPassiveMotionFunc( mouse_motion );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -265,7 +265,7 @@ main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
unsigned char *map;
texture_font_t * font;
......
......@@ -155,7 +155,7 @@ int main( int argc, char **argv )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -165,7 +165,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
size_t i;
texture_font_t *font = 0;
texture_atlas_t *atlas = texture_atlas_new( 512, 512, 1 );
......
......@@ -128,7 +128,7 @@ int main( int argc, char **argv )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -138,7 +138,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
buffer = text_buffer_new( LCD_FILTERING_OFF );
vec4 white = {{1.0, 1.0, 1.0, 1.0}};
vec4 black = {{0.0, 0.0, 0.0, 1.0}};
......
......@@ -185,7 +185,7 @@ int main( int argc, char **argv )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -195,7 +195,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
vec4 blue = {{0,0,1,1}};
vec4 black = {{0,0,0,1}};
......
......@@ -172,7 +172,7 @@ int main( int argc, char **argv )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -182,7 +182,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
size_t i;
texture_font_t *font = 0;
atlas = texture_atlas_new( 512, 512, 3 );
......
......@@ -169,7 +169,7 @@ int main( int argc, char **argv )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
GLenum err = glewInit();
if (GLEW_OK != err)
{
......@@ -178,7 +178,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
buffer = text_buffer_new( LCD_FILTERING_ON );
vec4 black = {{0.0, 0.0, 0.0, 1.0}};
......
......@@ -191,7 +191,7 @@ int main( int argc, char **argv )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -201,7 +201,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
atlas = texture_atlas_new( 512, 512, 1 );
buffer = vertex_buffer_new( "vertex:3f,tex_coord:2f,color:4f" );
......
......@@ -138,7 +138,7 @@ int main( int argc, char **argv )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -148,7 +148,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
buffer = vertex_buffer_new( "vertex:3f,color:4f" );
vertex_t vertices[4*2] = { { 15, 0,0, 0,0,0,1},
{ 15,330,0, 0,0,0,1},
......
......@@ -105,7 +105,7 @@ int main( int argc, char **argv )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
#ifndef __APPLE__
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
......@@ -115,7 +115,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE );
}
fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
texture_atlas_t * atlas = texture_atlas_new( 512, 512, 1 );
const char *filename = "fonts/Vera.ttf";
const wchar_t *cache = L" !\"#$%&'()*+,-./0123456789:;<=>?"
......
......@@ -35,7 +35,6 @@
#define __OPEN_GL_H__
#if defined(__APPLE__)
# include <GL/glew.h>
# ifdef GL_ES_VERSION_2_0
# include <OpenGLES/ES2/gl.h>
# else
......
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