example/example.cpp File Reference

#include <GL/glut.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <fstream>
#include "faogenlib.h"

Go to the source code of this file.

Classes

struct  plane_vertex
 Example of interleaved vertex data. More...

Functions

void build_plane ()
 Fills plane_geometry and plane_indices.
bool generate_example ()
 faogenlib usage example
void reshape (int w, int h)
void key (unsigned char key, int x, int y)
void idle ()
void display ()
int main (int argc, char *argv[])

Variables

int const plane_size = 100
plane_vertex plane_geometry [plane_size *plane_size]
unsigned short plane_indices [(plane_size-1)*(plane_size-1)*2 *3]
float cube_vertices []
 Example of geometry in separate arrays.
float cube_texcoords []
float cube_normals []
unsigned short cube_indices [6 *2 *3]
float cube_matrix [16]
GLuint cube_texture = 0
float bottom_occludder []
unsigned short bottom_indices []


Detailed Description

Copyright (C) 2006 Grisha Spivak - rusted dreams This is a faogenlib usage example. Most importatnt is generate_example function

Definition in file example.cpp.


Function Documentation

void build_plane  ) 
 

Fills plane_geometry and plane_indices.

Definition at line 252 of file example.cpp.

References plane_vertex::color, plane_vertex::normal, plane_geometry, plane_size, and plane_vertex::pos.

Referenced by main().

void display  ) 
 

Definition at line 329 of file example.cpp.

References bottom_indices, bottom_occludder, cube_indices, cube_matrix, cube_texcoords, cube_vertices, plane_geometry, and plane_indices.

Referenced by main().

bool generate_example  ) 
 

faogenlib usage example

Definition at line 159 of file example.cpp.

References faogenlib::ao_tex_generate(), faogenlib::ao_vert_generate(), bottom_indices, bottom_occludder, faogenlib::create_object_v(), faogenlib::create_object_vn(), faogenlib::create_object_vnt(), cube_indices, cube_matrix, cube_normals, cube_texcoords, cube_texture, cube_vertices, faogenlib::get_tex_results(), faogenlib::get_vert_results(), faogenlib::INDEX_U16, faogenlib::initialize(), faogenlib::num_iterations(), plane_geometry, plane_indices, faogenlib::results_ready(), faogenlib::set_object_matrix(), faogenlib::shutdown(), faogenlib::start_ao_gen_tex(), and faogenlib::start_ao_gen_vert().

Referenced by main().

void idle  ) 
 

Definition at line 310 of file example.cpp.

Referenced by main().

void key unsigned char  key,
int  x,
int  y
 

Definition at line 299 of file example.cpp.

References cube_texture.

Referenced by main().

int main int  argc,
char *  argv[]
 

Definition at line 369 of file example.cpp.

References build_plane(), display(), generate_example(), idle(), key(), and reshape().

void reshape int  w,
int  h
 

Definition at line 290 of file example.cpp.

Referenced by main().


Variable Documentation

unsigned short bottom_indices[]
 

Initial value:

 
{
        0, 4, 1,
        1, 4, 3,
        3, 4, 2,
        2, 4, 0
}

Definition at line 150 of file example.cpp.

Referenced by display(), and generate_example().

float bottom_occludder[]
 

Initial value:

 
{
        -5.f, -5.f, 0.f,
        5.f, -5.f, 0.f,
        -5.f, 5.f, 0.f,
        5.f, 5.f, 0.f,
        0.f, 0.f, -5.f,
}

Definition at line 141 of file example.cpp.

Referenced by display(), and generate_example().

unsigned short cube_indices[6 *2 *3]
 

Initial value:

 
{
        1-1, 3-1, 24-1,
        24-1, 23-1, 1-1,
        9-1, 10-1, 12-1,
        12-1, 11-1, 9-1,
        13-1, 14-1, 16-1,
        16-1, 15-1, 13-1,
        2-1, 4-1, 8-1,
        8-1, 6-1, 2-1,
        21-1, 20-1, 7-1,
        7-1, 22-1, 21-1,
        18-1, 17-1, 5-1,
        5-1, 19-1, 18-1,
}

Definition at line 115 of file example.cpp.

Referenced by display(), and generate_example().

float cube_matrix[16]
 

Initial value:

 
{
        0.8639584f, -0.5035632f, 0.f, 0.f,
        0.5035632f, 0.8639584f, 0.f, 0.f,
        0.f, 0.f, 1.f, 0.f, 
        0.f, 0.f, -0.25f, 1.f
}

Definition at line 131 of file example.cpp.

Referenced by display(), and generate_example().

float cube_normals[]
 

Initial value:

 
{
        0.f, 0.f, -1.f,
        1.f, 0.f, 0.f,
        0.f, 0.f, -1.f,
        1.f, 0.f, 0.f,
        -1.f, 0.f, 0.f,
        1.f, 0.f, 0.f,
        0.f, 1.f, 0.f,
        1.f, 0.f, 0.f,
        0.f, 0.f, 1.f,
        0.f, 0.f, 1.f,
        0.f, 0.f, 1.f,
        0.f, 0.f, 1.f,
        0.f, -1.f, 0.f,
        0.f, -1.f, 0.f,
        0.f, -1.f, 0.f,
        0.f, -1.f, 0.f,
        -1.f, 0.f, 0.f,
        -1.f, 0.f, 0.f,
        -1.f, 0.f, 0.f,
        0.f, 1.f, 0.f,
        0.f, 1.f, 0.f,
        0.f, 1.f, 0.f,
        0.f, 0.f, -1.f,
        0.f, 0.f, -1.f, 
}

Definition at line 87 of file example.cpp.

Referenced by generate_example().

float cube_texcoords[]
 

Initial value:

 
{
        0.3360113f, 1.f, 
        0.f, 0.6720225f, 
        0.3360113f, 0.6720225f, 
        0.3279775f, 0.6720225f, 
        0.6639888f, 0.3279775f, 
        0.f, 1.f, 
        0.3279775f, 0.3279775f, 
        0.3279775f, 1.f, 
        0.f, 0.3360113f, 
        0.3279775f, 0.3360113f, 
        0.f, 0.6639888f, 
        0.3279775f, 0.6639888f, 
        0.3360113f, 0.3360113f, 
        0.6639888f, 0.3360113f, 
        0.3360113f, 0.6639888f, 
        0.6639888f, 0.6639888f, 
        0.6639888f, 0.f, 
        0.3360113f, 0.f, 
        0.3360113f, 0.3279775f, 
        0.3279775f, 0.f, 
        0.f, 0.f, 
        0.f, 0.3279775f, 
        0.6639888f, 1.f, 
        0.6639888f, 0.6720225f
}

Definition at line 59 of file example.cpp.

Referenced by display(), and generate_example().

GLuint cube_texture = 0
 

Definition at line 139 of file example.cpp.

Referenced by generate_example(), and key().

float cube_vertices[]
 

Initial value:

 
{
        -0.5f, -0.5f, 0.f,
        0.5f, -0.5f, 0.f,
        -0.5f, 0.5f, 0.f,
        0.5f, 0.5f, 0.f,
        -0.5f, -0.5f, 1.f,
        0.5f, -0.5f, 1.f,
        -0.5f, 0.5f, 1.f,
        0.5f, 0.5f, 1.f,
        -0.5f, -0.5f, 1.f,
        0.5f, -0.5f, 1.f,
        -0.5f, 0.5f, 1.f,
        0.5f, 0.5f, 1.f,
        -0.5f, -0.5f, 0.f,
        0.5f, -0.5f, 0.f,
        -0.5f, -0.5f, 1.f,
        0.5f, -0.5f, 1.f,
        -0.5f, -0.5f, 0.f,
        -0.5f, 0.5f, 0.f,
        -0.5f, 0.5f, 1.f,
        -0.5f, 0.5f, 0.f,
        0.5f, 0.5f, 0.f,
        0.5f, 0.5f, 1.f,
        0.5f, -0.5f, 0.f,
        0.5f, 0.5f, 0.f
}
Example of geometry in separate arrays.

Definition at line 31 of file example.cpp.

Referenced by display(), and generate_example().

plane_vertex plane_geometry[plane_size *plane_size]
 

Definition at line 24 of file example.cpp.

Referenced by build_plane(), display(), and generate_example().

unsigned short plane_indices[(plane_size-1)*(plane_size-1)*2 *3]
 

Definition at line 25 of file example.cpp.

Referenced by display(), and generate_example().

int const plane_size = 100
 

Definition at line 23 of file example.cpp.

Referenced by build_plane().


Generated on Fri Aug 15 20:07:46 2008 for faogenlib by  doxygen 1.4.6-NO