以下是一个例子:
#include "mpi.h"
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "GL/glut.h"
static int num_window = 6;
static int col_size = 3;
static int row_size = num_window / col_size;
int node_w = 240, node_h = 180;
float rot_angle[3];
int sign[3]={1, -1, 1};
float step[3]={0.01, 0.025, 0.05};
struct NodeInfo
{
int rank;
int row_idx;
int col_idx;
int window_x;
int window_y;
int scene_x;
int scene_y;
} nodeInfo;
void reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
int rank = nodeInfo.rank;
int scene_x = nodeInfo.scene_x;
int scene_y = nodeInfo.scene_y;
printf("Rank #%d @ (%d, %d)\n", rank, scene_x, scene_y);
glOrtho(scene_x, scene_x + node_w, scene_y, scene_y + node_h, 0.0001, 1000.0);
glMatrixMode(GL_MODELVIE