updated oglft to version 0.9

main
Martin Felis (berta) 2010-11-13 18:37:16 +01:00
parent bc53a7fd75
commit cf2fe0e32d
15 changed files with 497 additions and 414 deletions

View File

@ -1,5 +1,3 @@
Authors of OGLFT
Author of OGLFT
Allen Barnett
Oliver Bock
Nigel Stewart
Allen Barnett <oglft@lignumcomputing.com>

View File

@ -7,14 +7,14 @@ Set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake )
FIND_PACKAGE( OpenGL REQUIRED )
FIND_PACKAGE( FreeType2 REQUIRED )
if( ENABLE_QT )
find_package( Qt REQUIRED )
if( DESIRED_QT_VERSION EQUAL 3 )
find_package( KDE3 REQUIRED )
endif( DESIRED_QT_VERSION EQUAL 3 )
endif( ENABLE_QT )
IF( ENABLE_QT )
FIND_PACKAGE( QT REQUIRED )
IF( DESIRED_QT_VERSION EQUAL 3 )
FIND_PACKAGE( KDE3 REQUIRED )
ENDIF( DESIRED_QT_VERSION EQUAL 3 )
ENDIF( ENABLE_QT )
if( ENABLE_GLE )
If( ENABLE_GLE )
find_package( GLE )
endif( ENABLE_GLE )

View File

@ -1,3 +1,9 @@
New in OGLFT version 0.9
* Moved my CVS repository so this is mostly a resync.
* A couple of minor changes to configure.ac for RH Linux 9, too.
New in OGLFT version 0.8
* Added the ability to draw numbers with a format à la printf.

View File

@ -233,13 +233,13 @@ namespace OGLFT {
if ( new_value < x_min_ ) x_min_ = new_value;
new_value = b.y_min_ + advance_.dy_;
if ( new_value < y_min_ ) y_min_ = new_value;
if ( advance_.dy_ != 0. && new_value < y_min_ ) y_min_ = new_value;
new_value = b.x_max_ + advance_.dx_;
if ( new_value > x_max_ ) x_max_ = new_value;
new_value = b.y_max_ + advance_.dy_;
if ( new_value > y_max_ ) y_max_ = new_value;
if ( advance_.dy_ != 0. && new_value > y_max_ ) y_max_ = new_value;
advance_.dx_ += b.advance_.dx_;
advance_.dy_ += b.advance_.dy_;

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*
* Demo3UnicodeExample.h: Sample font for demo3 example.
* Copyright (C) 2002 lignum Computing, Inc. <oglft@lignumcomputing.com>
* $Id$
* $Id: Demo3UnicodeExample.h,v 1.2 2002/07/11 20:56:06 allen Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* demo.cpp: Demo of the OGLFT library
* Copyright (C) 2002 lignum Computing, Inc. <oglft@lignumcomputing.com>
* $Id$
* $Id: demo.cpp,v 1.4 2002/07/11 20:58:38 allen Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,8 +20,13 @@
#include <unistd.h>
#include <cstdlib>
#include <iostream>
using namespace std;
#include <GL/glut.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <OGLFT.h>
static const char* USAGE = " fontfile";
@ -49,11 +54,12 @@ static OGLFT::TranslucentTexture* translucent_texture_face;
static float dy;
static int viewport_width;
static int viewport_height;
static int x_rot, y_rot, z_rot;
static void init ( int /*argc*/, char* argv[] )
static void init ( int argc, char* argv[] )
{
std::cout << glGetString( GL_VENDOR ) << " " << glGetString( GL_RENDERER ) << " "
<< glGetString( GL_VERSION ) << std::endl;
cout << glGetString( GL_VENDOR ) << " " << glGetString( GL_RENDERER ) << " "
<< glGetString( GL_VERSION ) << endl;
commands_face = new OGLFT::Monochrome( argv[1], point_size / 2. );
commands_face->setHorizontalJustification( OGLFT::Face::CENTER );
@ -63,7 +69,7 @@ static void init ( int /*argc*/, char* argv[] )
monochrome_face->setForegroundColor( 1., 0., 0., 1. );
if ( !monochrome_face->isValid() ) {
std::cerr << "failed to open face. exiting." << std::endl;
cerr << "failed to open face. exiting." << endl;
exit( 1 );
}
@ -112,7 +118,7 @@ static void init ( int /*argc*/, char* argv[] )
// Set various general parameters which don't affect performance (yet).
glClearColor( .75, .75, .75, 1. );
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if defined(GL_RASTER_POSITION_UNCLIPPED_IBM)
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
glEnable( GL_LIGHT0 );
@ -309,7 +315,12 @@ static void display ( void )
glutSwapBuffers();
}
static void key ( unsigned char key, int /*x*/, int /*y*/ )
static void idle ( void )
{
glutPostRedisplay();
}
static void key ( unsigned char key, int x, int y )
{
switch ( key ) {
case 'a':
@ -355,7 +366,7 @@ static void done ( void )
int main ( int argc, char* argv[] )
{
if ( argc != 2 ) {
std::cerr << argv[0] << USAGE << std::endl;
cerr << argv[0] << USAGE << endl;
return 1;
}
@ -371,7 +382,9 @@ int main ( int argc, char* argv[] )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( key );
#if 0
glutIdleFunc( idle );
#endif
glutMainLoop();
return 0;

View File

@ -1,7 +1,7 @@
/*
* demo2.cpp: Second Demo of the OGLFT library
* Copyright (C) 2002 lignum Computing, Inc. <oglft@lignumcomputing.com>
* $Id$
* $Id: demo2.cpp,v 1.7 2003/10/01 14:04:49 allen Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,9 +18,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <iostream>
using namespace std;
#include <stdio.h>
#include <GL/glut.h>
#include <config.h>
#include <OGLFT.h>
#include FT_MULTIPLE_MASTERS_H
@ -39,7 +43,7 @@ static OGLFT::Monochrome* oglft_face;
static int viewport_width;
static int viewport_height;
static void init ( int /*argc*/, char* argv[] )
static void init ( int argc, char* argv[] )
{
std::cout << glGetString( GL_VENDOR ) << " " << glGetString( GL_RENDERER ) << " "
<< glGetString( GL_VERSION ) << std::endl;
@ -74,8 +78,9 @@ static void init ( int /*argc*/, char* argv[] )
oglft_face = new OGLFT::Filled( ft_face, 14 );
#else
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
oglft_face = new OGLFT::Monochrome( ft_face, 14 );
#endif
oglft_face->setHorizontalJustification( OGLFT::Face::LEFT );
@ -126,7 +131,7 @@ static void display ( void )
for ( int j = 0; j <= 4; j++ ) {
FT_Set_MM_Design_Coordinates( ft_face, master_info.num_axis, axis_averages );
snprintf( buffer, sizeof(buffer), " Style at axis = %ld\n", axis_averages[i] );
snprintf( buffer, sizeof(buffer), " Style at axis = %d\n", axis_averages[i] );
y -= 20.;
oglft_face->draw( 0., y, buffer );
@ -140,7 +145,7 @@ static void display ( void )
glutSwapBuffers();
}
static void key ( unsigned char key, int /*x*/, int /*y*/ )
static void key ( unsigned char key, int x, int y )
{
switch ( key ) {
case 'q':
@ -153,6 +158,11 @@ static void key ( unsigned char key, int /*x*/, int /*y*/ )
glutPostRedisplay();
}
static void idle ( void )
{
glutPostRedisplay();
}
static void done ( void )
{
}
@ -176,7 +186,9 @@ int main ( int argc, char* argv[] )
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc( key );
#if 0
glutIdleFunc( idle );
#endif
glutMainLoop();
return 0;

View File

@ -1,7 +1,7 @@
/*
* demo3.cpp: Third Demo of the OGLFT library
* Copyright (C) 2002 lignum Computing, Inc. <oglft@lignumcomputing.com>
* $Id$
* $Id: demo3.cpp,v 1.6 2003/10/01 14:05:08 allen Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,20 +19,21 @@
*/
#include <iostream>
#include <algorithm>
using namespace std;
#include <qapplication.h>
#include <qimage.h>
#include "OGLFT.h"
#include "vignette.h"
#include "vignette.moc"
#include <config.h>
#include <OGLFT.h>
#include <vignette.h>
#include "Demo3UnicodeExample.h"
#include "Demo3UnicodeExample2.h"
#include <Demo3UnicodeExample.h>
#include <Demo3UnicodeExample2.h>
class Vignette0 : public Vignette {
static const unsigned int FRAME_COUNT = 32;
static const unsigned int FRAME_COUNT = 33;
static const unsigned int FRAME_RATE = 16;
const char* text_;
@ -583,7 +584,9 @@ public:
std::cout << "Vignette 5" << std::endl;
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_LIGHT0 );
}
@ -946,13 +949,15 @@ public:
{
std::cout << "Vignette 8" << std::endl;
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
glPushAttrib( GL_POLYGON_BIT );
}
void draw ( unsigned int frame_number )
{
char save_char = '\0';
char save_char;
if ( frame_number < text_length_ ) {
save_char = text_[frame_number];
text_[frame_number] = '\0';
@ -1177,18 +1182,14 @@ public:
face_ = new OGLFT::Translucent( fontfile, 18, 75 );
// Now, create a second face, in this case, using a built-in font.
#if 0
FT_Library library = OGLFT::Library::instance();
FT_Face ft_face;
FT_New_Memory_Face( library, Demo3UnicodeExample_ttf,
int a = FT_New_Memory_Face( library, Demo3UnicodeExample_ttf,
Demo3UnicodeExample_ttf_size, 0, &ft_face );
cout << "The return value from new mem face is " << a << endl;
cout << "Ft face is " << ft_face << endl;
face_->addAuxiliaryFace( ft_face );
#else
// Somewhat simpler with new interface.
face_->addAuxiliaryFace( Demo3UnicodeExample_ttf,
Demo3UnicodeExample_ttf_size );
#endif
face_->setForegroundColor( 0., .5, .75 );
// Manually create the equation in UNICODE points
@ -1237,7 +1238,9 @@ public:
std::cout << "Vignette 11" << std::endl;
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_BLEND );
}
@ -1251,19 +1254,15 @@ public:
glTranslated( left, 0, 0 );
}
void draw ( unsigned int /*frame_number*/ )
void draw ( unsigned int frame_number )
{
face_->setHorizontalJustification( OGLFT::Face::LEFT );
face_->draw( 2., 128., "This frame demonstrates two...no three...features:" );
face_->draw( 2., 96., "1. Drawing a UNICODE string (using Qt's QString)." );
face_->draw( 2., 64., "2. Combining two fonts to cover more UNICODE points." );
face_->draw( 2., 32., "3. Embedding a font in the program." );
face_->setHorizontalJustification( OGLFT::Face::CENTER );
face_->draw( 250., 0., equation_ );
face_->setHorizontalJustification( OGLFT::Face::LEFT );
face_->draw( 2., -32., "Thanks to Oliver Bock for the font-in-memory code!" );
}
void finish ( void )
@ -1293,7 +1292,7 @@ public:
#else
face_ = new OGLFT::Filled( fontfile, 18, 75 );
#endif
face_->setForegroundColor( 0., .75, .75 );
face_->setForegroundColor( 0., .5, .75 );
// Now, create a second face, in this case, using a built-in font.
FT_Library library = OGLFT::Library::instance();
@ -1333,7 +1332,7 @@ public:
glTranslated( left, 0, 0 );
}
void draw ( unsigned int /*frame_number*/ )
void draw ( unsigned int frame_number )
{
face_->setVerticalJustification( OGLFT::Face::TOP );
face_->setHorizontalJustification( OGLFT::Face::CENTER );
@ -1354,7 +1353,7 @@ public:
glPushMatrix();
glTranslated( j*42, -i * 18, 0 );
glColor3f( .25, .25, .25 );
glColor3f( .5, .5, 0. );
glRectd( bbox.x_min_, bbox.y_min_, bbox.x_max_, bbox.y_max_ );
face_->draw( 0, 0, "%p\"", a );
@ -1371,7 +1370,7 @@ public:
glPushMatrix();
glTranslated( 250.+cosr*24, 96.+sinr*24, 0 );
glColor3f( .25, .25, .25 );
glColor3f( .5, .5, 0. );
glRectd( bbox.x_min_, bbox.y_min_, bbox.x_max_, bbox.y_max_ );
face_->draw( 0, 0, "%p\"", 1.015625 );
@ -1389,7 +1388,7 @@ public:
CharacterView::CharacterView ( bool flank_speed, const char* fontfile,
QWidget* parent, const char* name )
: QGLWidget( ), flank_speed_( flank_speed )
: QGLWidget( parent, name ), flank_speed_( flank_speed )
{
vignettes.enqueue( new Vignette0( "Welcome to OGLFT!", fontfile ) );
vignettes.enqueue( new Vignette1( "The OpenGL/FreeType library", fontfile ) );
@ -1400,7 +1399,7 @@ CharacterView::CharacterView ( bool flank_speed, const char* fontfile,
vignettes.enqueue( new Vignette8( "Measuring the text.", fontfile ) );
vignettes.enqueue( new Vignette6( "Per vertex color", fontfile ) );
vignettes.enqueue( new Vignette7( "Per vertex texture coord", fontfile ) );
vignettes.enqueue( new Vignette10( "Each glyph can have it's own display list", fontfile ) );
vignettes.enqueue( new Vignette10( "Each glyph can have its own display list", fontfile ) );
vignettes.enqueue( new Vignette11( "QString Example", fontfile ) );
vignettes.enqueue( new Vignette12( "Formatting Numbers", fontfile ) );
vignettes.enqueue( new Vignette4( "OGLFT", fontfile ) );
@ -1430,7 +1429,7 @@ void CharacterView::redraw ( void )
frame_counter_++;
animation_frame_counter_++;
if ( animation_frame_counter_ >= animation_frame_count_ ) {
if ( animation_frame_counter_ == animation_frame_count_ ) {
redraw_timer_.stop();
vignettes.current()->finish();
delete vignettes.dequeue();
@ -1512,10 +1511,6 @@ void CharacterView::keyPressEvent ( QKeyEvent* e )
case Key_Q:
case Key_Escape:
qApp->exit( 0 );
case Key_Return:
// "Speed up the harvest." L, Skywalker
animation_frame_counter_ = animation_frame_count_;
updateGL();
}
}

View File

@ -1,7 +1,7 @@
/*
* speedtest.cpp: Performance test for the OGLFT library
* Copyright (C) 2002 lignum Computing, Inc. <oglft@lignumcomputing.com>
* $Id$
* $Id: speedtest.cpp,v 1.6 2003/10/01 14:08:30 allen Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,13 +19,15 @@
*/
#include <iostream>
#include <cstdlib>
using namespace std;
#include <qapplication.h>
#include <config.h>
#include <OGLFT.h>
#include "speedtest.h"
#include "speedtest.moc"
class Vignette0 : public Vignette {
@ -35,7 +37,7 @@ class Vignette0 : public Vignette {
OGLFT::Face* face_;
public:
Vignette0 ( const char* text, const char* /*fontfile*/ ) : text_( text )
Vignette0 ( const char* text, const char* fontfile ) : text_( text )
{
}
@ -46,7 +48,7 @@ public:
std::cout << "Vignette 0: Color and depth buffer clearing only" << std::endl;
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
}
@ -75,10 +77,12 @@ public:
{
std::cout << "Vignette 1: MONOCHROME: immediate drawing: " << text_ << std::endl;
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -108,10 +112,12 @@ public:
{
std::cout << "Vignette 2: MONOCHROME: cached glyphs: " << text_ << std::endl;
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -144,11 +150,13 @@ public:
{
std::cout << "Vignette 3: MONOCHROME: display list: " << text_ << std::endl;
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
dlist_ = face_->compile( text_ );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
glRasterPos2f( 0., 0. );
glCallList( dlist_ );
@ -181,10 +189,12 @@ public:
{
std::cout << "Vignette 4: GRAYSCALE: immediate drawing: " << text_ << std::endl;
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -214,10 +224,12 @@ public:
{
std::cout << "Vignette 5: GRAYSCALE: cached glyphs: " << text_ << std::endl;
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -249,11 +261,13 @@ public:
{
std::cout << "Vignette 6: GRAYSCALE: display list: " << text_ << std::endl;
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
dlist_ = face_->compile( text_ );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
glPushMatrix();
glRasterPos2f( 0., 0. );
@ -290,10 +304,12 @@ public:
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -326,10 +342,12 @@ public:
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -364,11 +382,13 @@ public:
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
#if defined( GL_RASTER_POSITION_UNCLIPPED_IBM )
glEnable( GL_RASTER_POSITION_UNCLIPPED_IBM );
#endif
dlist_ = face_->compile( text_ );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
glPushMatrix();
glRasterPos2f( 0., 0. );
@ -405,7 +425,7 @@ public:
std::cout << "Vignette 10: OUTLINE: immediate drawing: " << text_ << std::endl;
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -436,7 +456,7 @@ public:
std::cout << "Vignette 11: OUTLINE: cached glyphs: " << text_ << std::endl;
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -471,7 +491,7 @@ public:
dlist_ = face_->compile( text_ );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
// glPushMatrix();
glCallList( dlist_ );
@ -506,7 +526,7 @@ public:
std::cout << "Vignette 13: FILLED: immediate drawing: " << text_ << std::endl;
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -537,7 +557,7 @@ public:
std::cout << "Vignette 14: FILLED: cached glyphs: " << text_ << std::endl;
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -571,7 +591,7 @@ public:
dlist_ = face_->compile( text_ );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
glPushMatrix();
glCallList( dlist_ );
@ -608,7 +628,7 @@ public:
glEnable( GL_LIGHT0 );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -642,7 +662,7 @@ public:
glEnable( GL_LIGHT0 );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -679,7 +699,7 @@ public:
dlist_ = face_->compile( text_ );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
glPushMatrix();
glCallList( dlist_ );
@ -720,7 +740,7 @@ public:
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -755,7 +775,7 @@ public:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -793,7 +813,7 @@ public:
dlist_ = face_->compile( text_ );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
glPushMatrix();
glCallList( dlist_ );
@ -832,7 +852,7 @@ public:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -867,7 +887,7 @@ public:
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -905,7 +925,7 @@ public:
dlist_ = face_->compile( text_ );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
glPushMatrix();
glCallList( dlist_ );
@ -946,7 +966,7 @@ public:
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -984,7 +1004,7 @@ public:
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
face_->draw( 0., 0., text_ );
}
@ -1025,7 +1045,7 @@ public:
dlist_ = face_->compile( text_ );
}
void draw ( int /*frame_number*/ )
void draw ( int frame_number )
{
glPushMatrix();
glCallList( dlist_ );

View File

@ -1,7 +1,7 @@
/* -*- c++ -*-
* speedtest.h: Header for Performance test for the OGLFT library
* Copyright (C) 2002 lignum Computing, Inc. <oglft@lignumcomputing.com>
* $Id$
* $Id: speedtest.h,v 1.2 2002/02/04 19:01:17 allen Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
/*
* tutorial1.cpp: Tutorial for the OGLFT library
* Copyright (C) 2002 lignum Computing, Inc. <oglft@lignumcomputing.com>
* $Id$
* $Id: tutorial1.cpp,v 1.5 2003/10/01 14:08:49 allen Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,9 +18,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <iostream>
using namespace std;
#include <GL/glut.h>
#include <config.h>
#include <OGLFT.h> // Note: this will depend on where you've installed OGLFT
// Declare a Face variable of the desired style

View File

@ -1,7 +1,7 @@
/*
* tutorial2.cpp: Tutorial for the OGLFT library
* Copyright (C) 2002 lignum Computing, Inc. <oglft@lignumcomputing.com>
* $Id$
* $Id: tutorial2.cpp,v 1.5 2003/10/01 14:09:12 allen Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,9 +18,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <iostream>
using namespace std;
#include <GL/glut.h>
#include <config.h>
#include <OGLFT.h> // Note: this will depend on where you've installed OGLFT
#define USE_BITMAP_FACE
@ -94,13 +95,11 @@ static void idle ( void )
// it by 4 degrees
face->setStringRotation( face->stringRotation() + 4 );
#if !defined(WIN32)
// Too fast even without acceleration
struct timespec request = { 0, 40000000 };
nanosleep( &request, 0 );
#else
Sleep( 40 );
#endif
glutPostRedisplay();
}

View File

@ -1,7 +1,7 @@
/*
* tutorial3.cpp: Tutorial for the OGLFT library
* Copyright (C) 2002 lignum Computing, Inc. <oglft@lignumcomputing.com>
* $Id$
* $Id: tutorial3.cpp,v 1.5 2003/10/01 14:09:28 allen Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,15 +18,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <iostream>
#if defined(_MSC_VER)
#define _USE_MATH_DEFINES
#endif
#include <cmath>
#include <ctime>
#include <vector> // The STL vector
#include <algorithm> // The STL algorithms
#include <GL/glut.h>
using namespace std;
#include <GL/glut.h>
#include <config.h>
#include <OGLFT.h> // Note: this will depend on where you've installed OGLFT
// A Face variable of the desired style
@ -80,8 +79,7 @@ void init ( const char* filename )
// Next, generate a sequence of relative displacements
for ( int i=0; i<13; i++ ) {
float dy = AMPLITUDE * ( sinf( (i+1) * 2.f * (float)M_PI / 13.f ) -
sinf( i * 2.f * (float)M_PI / 13.f ) );
float dy = AMPLITUDE * ( sin( (i+1) * 2 * M_PI / 13 ) - sin( i * 2 * M_PI / 13 ) );
glNewList( dlist, GL_COMPILE );
glTranslatef( 0., dy, 0. );
@ -95,7 +93,7 @@ void init ( const char* filename )
// Next, generate a sequence of absolute displacements
for ( int i=0; i<13; i++ ) {
float y = AMPLITUDE * sinf( i * 2.f * (float)M_PI / 13.f );
float y = AMPLITUDE * sin( i * 2 * M_PI / 13 );
glNewList( dlist, GL_COMPILE );
glTranslatef( 0., y, 0. );
@ -129,7 +127,7 @@ void init ( const char* filename )
// Make it (sea) green
solid->setForegroundColor( 143.f/255.f, 188.f/255.f, 143.f/255.f );
solid->setForegroundColor( 143./255., 188./255., 143./255. );
// Set the window's background color
@ -139,8 +137,8 @@ void init ( const char* filename )
// version of the absolute displacements which we'll cycle through)
for ( int i = 0; i <= 52; i++ ) {
float s = sinf( i * 2.f * (float)M_PI / 52.f );
float c = cosf( i * 2.f * (float)M_PI / 52.f );
float s = sin( i * 2 * M_PI / 52 );
float c = cos( i * 2 * M_PI / 52 );
vertex v;
v.y = AMPLITUDE * s;
v.nx = c;
@ -165,7 +163,7 @@ static void display ( void )
solid->draw( 250., 250., "Hello, World!" );
glTranslatef( 254.f - ( bbox.x_max_ + bbox.x_min_ ) / 2.f, 255.f, 0.f );
glTranslatef( 254.- ( bbox.x_max_ + bbox.x_min_ ) / 2., 255., 0. );
glBegin( GL_QUAD_STRIP );
@ -204,10 +202,10 @@ static void reshape ( int width, int height )
// (note we rotate the model instead of the view so that the lighting
// is fixed relative to the view instead of the model)
glTranslatef( width/2.f, height/2.f, 0.f );
glRotatef( 25.f, 1.f, 0.f, 0.f );
glRotatef( 25.f, 0.f, 1.f, 0.f );
glTranslatef( -width/2.f, -height/2.f, 0. );
glTranslatef( width/2, height/2, 0. );
glRotatef( 25., 1., 0., 0. );
glRotatef( 25., 0., 1., 0. );
glTranslatef( -width/2, -height/2, 0. );
}
static void idle ( void )
@ -234,19 +232,15 @@ static void idle ( void )
solid->characterDisplayLists()[0] = solid->characterDisplayLists()[13+1];
glutPostRedisplay();
#if !defined(WIN32)
// Too fast even without acceleration
struct timespec request = { 0, 80000000 };
nanosleep( &request, 0 );
#else
Sleep( 800 );
#endif
}
static void key ( unsigned char c, int /*x*/, int /*y*/ )
static void key ( unsigned char c, int x, int y )
{
switch ( c ) {
case 'q':
case 27:
exit( 0 );
}

View File

@ -1,7 +1,7 @@
/* -*- c++ -*-
* speedtest.h: Header for Performance test for the OGLFT library
* Copyright (C) 2002 lignum Computing, Inc. <oglft@lignumcomputing.com>
* $Id$
* $Id: vignette.h,v 1.2 2002/02/04 19:01:23 allen Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,16 +22,9 @@
#include <stdlib.h>
#if OGLFT_QT_VERSION == 3
#include <qgl.h>
#include <qqueue.h>
#include <qtimer.h>
#elif OGLFT_QT_VERSION == 4
#include <QGLWidget>
#include <QQueue>
#include <QTimer>
#include <QKeyEvent>
#endif
// Little animation vignettes. The function calls essentially follow
// those of the Qt OpenGL widget and are called at the corresponding times.
@ -74,11 +67,8 @@ Q_OBJECT
unsigned int animation_frame_counter_;
static const unsigned int PERFORMANCE_SAMPLE_RATE_HZ = 1;
#if OGLFT_QT_VERSION == 3
QQueue<Vignette> vignettes;
#elif OGLFT_QT_VERSION == 4
QQueue<Vignette*> vignettes;
#endif
protected slots:
void redraw ( void );