home dev games gallery work
Lewpen.com»Research & Development»3D Graphics»OpenGL»Reflective Sphere

Reflective Sphere

Analytical reflections in OpenGL

/ Source / common / 001 / stack.cpp

#include "stack.h"





//---- The stacks used for the different types of data

double stack_double[ STACK_MAXLENGTH ];
int    stack_int   [ STACK_MAXLENGTH ];
void*  stack_ptr   [ STACK_MAXLENGTH ];

int stack_double_pos = 0;
int stack_int_pos    = 0;
int stack_ptr_pos    = 0;





//---- stack_push_double

void stack_push_double( double* the_env_var, double newValue )
{
  stack_double[ stack_double_pos++ ] = *the_env_var;
  *the_env_var = newValue;
}



//---- stack_pop_double

void stack_pop_double( double* the_env_var )
{
  *the_env_var = stack_double[ --stack_double_pos ];
}



//---- stack_push_int

void stack_push_int( int* the_env_var, int newValue )
{
  stack_int[ stack_int_pos++ ] = *the_env_var;
  *the_env_var = newValue;
}



//---- stack_pop_int

void stack_pop_int( int* the_env_var )
{
  *the_env_var = stack_int[ --stack_int_pos ];
}



//---- stack_push_ptr

void stack_push_ptr( void** &the_env_var, void* newValue )
{
  stack_ptr[ stack_ptr_pos++ ] = *the_env_var;
  *the_env_var = newValue;
}



//---- stack_pop_ptr

void stack_pop_ptr( void** the_env_var )
{
  *the_env_var = stack_ptr[ --stack_ptr_pos ];
}
Related Articles

Procedural city block layout

Animated 4-dimensional objects mapped down to 3D

Simulating a cloth falling and slipping over objects

Windows C++ OpenGL example

Games

The Dodge Game
Flatspace

2-Player Games:

Quake 2D
Meteora

Puzzle Games:

Mini Tetris
Sudoku Solver

Development

3D Graphics:

3D Graphics Articles
WebGL Examples
OpenGL Examples
Flash 3D Engine
Java 3D Engine

Development:

Programming Articles
Game Development Examples

Work

Portfolio
Clients
Startups & Projects
Expertise

Links

CubeLogix Studios
PHP Charts & Graphs
Local Legends Football