Commit 50b8b2e1 authored by Nicolas.Rougier's avatar Nicolas.Rougier

Applied Christian patch and added glew lib for windows

parent 79a3d776
......@@ -43,8 +43,12 @@ IF( WIN32 OR WIN64 )
${CMAKE_CURRENT_SOURCE_DIR}/windows )
SET( GLUT_INCLUDE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/windows/glut )
SET( GLUT_GLUT_LIBRARY
SET( GLUT_LIBRARY
${CMAKE_CURRENT_SOURCE_DIR}/windows/glut/glut32.lib )
SET( GLEW_INCLUDE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/windows/glew-1.9.0/include )
SET( GLEW_LIBRARY
${CMAKE_CURRENT_SOURCE_DIR}/windows/glew-1.9.0/lib/glew32.lib )
SET( FREETYPE_INCLUDE_DIR_ft2build
${CMAKE_CURRENT_SOURCE_DIR}/windows/freetype )
SET( FREETYPE_INCLUDE_DIR_freetype2
......@@ -66,15 +70,6 @@ ELSE( WIN32 OR WIN64 )
FIND_PACKAGE( AntTweakBar )
ENDIF( WIN32 OR WIN64 )
# Untested
if(MSVC)
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
set(${flag_var} "${${flag_var}} /TP")
endforeach(flag_var)
endif()
INCLUDE_DIRECTORIES( ${GLUT_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
......@@ -104,16 +99,21 @@ LINK_DIRECTORIES(${PROJECT_SOURCE_DIR})
MACRO( DEMO _target _sources)
add_executable(${_target} ${_sources})
include_directories(${WINDOWS_DIR} ${GLUT_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${ANT_TWEAK_BAR_INCLUDE_PATH})
include_directories(${WINDOWS_DIR} ${GLUT_INCLUDE_DIR} ${GLEW_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${ANT_TWEAK_BAR_INCLUDE_PATH})
target_link_libraries(${_target} ${FREETYPE_GL_LIBRARY})
target_link_libraries(${_target} ${OPENGL_LIBRARY})
target_link_libraries(${_target} ${GLEW_LIBRARY})
target_link_libraries(${_target} freetype-gl)
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})
ENDIF( MATH_LIBRARY )
if(MSVC)
# Compile demos as C++
set_source_files_properties(${_sources} PROPERTIES LANGUAGE CXX)
endif()
ENDMACRO( DEMO )
IF (freetype-gl_BUILD_DEMOS)
......@@ -142,7 +142,7 @@ IF (FONTCONFIG_FOUND)
target_link_libraries(demo-markup ${FONTCONFIG_LIBRARY})
ENDIF (FONTCONFIG_FOUND)
IF (ANT_TWEAK_BAR_FOUND)
IF (ANT_TWEAK_BAR_FOUND AND (NOT (WIN32 OR WIN64)) )
#DEMO( demo-atb-agg "demo-atb-agg.c;markup.h;")
FILE(WRITE ${CMAKE_SOURCE_DIR}/stdc_test.c
"int main(void){return 0;}\n")
......@@ -167,15 +167,15 @@ IF (ANT_TWEAK_BAR_FOUND)
else()
message (STATUS "NOT FOUND: Libstdc++ is not installed. It is needed by demo-atb-agg.c" )
endif()
ENDIF (ANT_TWEAK_BAR_FOUND)
ENDIF (ANT_TWEAK_BAR_FOUND AND (NOT (WIN32 OR WIN64)) )
# Copy font and shaders into build directory for in-place testing
FILE(GLOB Fonts "fonts/Vera.ttf"
"fonts/VeraMoBI.ttf"
"fonts/VeraMoBd.ttf"
"fonts/VeraMoIt.ttf"
"fonts/VeraMono.ttf")
"fonts/VeraMono.ttf"
"fonts/ObelixPro.ttf")
file(COPY ${Fonts} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/fonts)
FILE(GLOB Data "data/256colors.txt")
......
......@@ -63,4 +63,5 @@ Contributors:
* Per Inge Mathisen (Bug report & fix)
* Wojciech Mamrak (Code review, bug report & fix)
* Wael Eloraiby (Put code to the C89 norm and fix CMakefile)
* Christian Forfang (Code review, fix & patch for 3.2 core profile)
* Lukas Murmann (Code review & fix for 3.2 core profile)
......@@ -318,16 +318,24 @@ int main( int argc, char **argv )
buffer = text_buffer_new( LCD_FILTERING_OFF );
vec4 black = {{0.0, 0.0, 0.0, 1.0}};
vec4 none = {{1.0, 1.0, 1.0, 0.0}};
markup_t markup = {
.family = "fonts/VeraMono.ttf",
.size = 15.0, .bold = 0, .italic = 0,
.rise = 0.0, .spacing = 0.0, .gamma = 1.0,
.foreground_color = black, .background_color = none,
.underline = 0, .underline_color = black,
.overline = 0, .overline_color = black,
.strikethrough = 0, .strikethrough_color = black,
.font = 0,
};
markup_t markup;
markup.family = "fonts/VeraMono.ttf",
markup.size = 15.0;
markup.bold = 0;
markup.italic = 0;
markup.rise = 0.0;
markup.spacing = 0.0;
markup.gamma = 1.0;
markup.foreground_color = black;
markup.background_color = none;
markup.underline = 0;
markup.underline_color = black;
markup.overline = 0;
markup.overline_color = black;
markup.strikethrough = 0;
markup.strikethrough_color = black;
markup.font = 0;
vec2 pen = {{10.0, 480.0}};
FILE *file = fopen ( "data/256colors.txt", "r" );
......
......@@ -82,15 +82,15 @@ void display( void )
GLint width = viewport[2];
GLint height = viewport[3];
srandom(4);
srand(4);
vec4 color = {{0.067,0.333, 0.486, 1.0}};
size_t i;
for( i=0; i<40; ++i)
{
float scale = .25 + 4.75 * pow(random()/(float)(RAND_MAX),2);
float angle = 90*(random()%2);
float x = (.05 + .9*(random()/(float)(RAND_MAX)))*width;
float y = (-.05 + .9*(random()/(float)(RAND_MAX)))*height;
float scale = .25 + 4.75 * pow(rand()/(float)(RAND_MAX),2);
float angle = 90*(rand()%2);
float x = (.05 + .9*(rand()/(float)(RAND_MAX)))*width;
float y = (-.05 + .9*(rand()/(float)(RAND_MAX)))*height;
float a = 0.1+.8*(pow((1.0-scale/5),2));
mat4_set_identity( &model );
......
......@@ -42,6 +42,11 @@
#include <Glut/glut.h>
#elif defined(_WIN32) || defined(_WIN64)
#include <GLUT/glut.h>
// Round and INFINITY only defined in C99
double round(double r) {
return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
}
#define INFINITY 99999999999
#else
#include <GL/glut.h>
#endif
......
......@@ -138,16 +138,23 @@ int main( int argc, char **argv )
vec4 white = {{1.0, 1.0, 1.0, 1.0}};
vec4 black = {{0.0, 0.0, 0.0, 1.0}};
vec4 none = {{1.0, 1.0, 1.0, 0.0}};
markup_t markup = {
.family = "fonts/Vera.ttf",
.size = 15.0, .bold = 0, .italic = 0,
.rise = 0.0, .spacing = 0.0, .gamma = 1.0,
.foreground_color = white, .background_color = none,
.underline = 0, .underline_color = none,
.overline = 0, .overline_color = none,
.strikethrough = 0, .strikethrough_color = none,
.font = 0,
};
markup_t markup;
markup.family = "fonts/Vera.ttf";
markup.size = 15.0;
markup.bold = 0;
markup.italic = 0;
markup.rise = 0.0;
markup.spacing = 0.0;
markup.gamma = 1.0;
markup.foreground_color = white;
markup.background_color = none;
markup.underline = 0;
markup.underline_color = none;
markup.overline = 0;
markup.overline_color = none;
markup.strikethrough = 0;
markup.strikethrough_color = none;
markup.font = 0;
size_t i;
vec2 pen = {{32, 508}};
......
......@@ -203,24 +203,25 @@ int main( int argc, char **argv )
vec4 white = {{1.0, 1.0, 1.0, 1.0}};
vec4 none = {{1.0, 1.0, 1.0, 0.0}};
markup_t markup = {
.family = "fonts/Vera.ttf",
.size = 80,
.bold = 0,
.italic = 0,
.rise = 0.0,
.spacing = 0.0,
.gamma = 1.5,
.foreground_color = white,
.background_color = none,
.underline = 0,
.underline_color = white,
.overline = 0,
.overline_color = white,
.strikethrough = 0,
.strikethrough_color = white,
.font = 0,
};
markup_t markup;
markup.family = "fonts/Vera.ttf";
markup.size = 80.0;
markup.bold = 0;
markup.italic = 0;
markup.rise = 0.0;
markup.spacing = 0.0;
markup.gamma = 1.5;
markup.foreground_color = white;
markup.background_color = none;
markup.underline = 0;
markup.underline_color = white;
markup.overline = 0;
markup.overline_color = white;
markup.strikethrough = 0;
markup.strikethrough_color = white;
markup.font = 0;
markup.font = texture_font_new( atlas, "fonts/Vera.ttf", markup.size );
markup.font->outline_type = 1;
......
......@@ -155,16 +155,23 @@ int main( int argc, char **argv )
text_buffer = text_buffer_new( LCD_FILTERING_ON );
vec4 black = {{0.0, 0.0, 0.0, 1.0}};
vec4 none = {{1.0, 1.0, 1.0, 0.0}};
markup_t markup = {
.family = "fonts/Vera.ttf",
.size = 9.0, .bold = 0, .italic = 0,
.rise = 0.0, .spacing = 0.0, .gamma = 1.0,
.foreground_color = black, .background_color = none,
.underline = 0, .underline_color = black,
.overline = 0, .overline_color = black,
.strikethrough = 0, .strikethrough_color = black,
.font = 0,
};
markup_t markup;
markup.family = "fonts/Vera.ttf";
markup.size = 9.0;
markup.bold = 0;
markup.italic = 0;
markup.rise = 0.0;
markup.spacing = 0.0;
markup.gamma = 1.0;
markup.foreground_color = black;
markup.background_color = none;
markup.underline = 0;
markup.underline_color = black;
markup.overline = 0;
markup.overline_color = black;
markup.strikethrough = 0;
markup.strikethrough_color = black;
markup.font = 0;
size_t i;
vec2 pen = {{20, 320}};
......
......@@ -42,7 +42,6 @@
# include <OpenGL/gl.h>
# endif
#elif defined(_WIN32) || defined(_WIN64)
# include <Windows.h>
# include <GL/glew.h>
# include <GL/wglew.h>
#else
......
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
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