JSFiddle - React, Tailwind, and code Playground

by XGundam05

HTML

<pre id="OpenGL_ply.cpp">
/* Assignment 2:
 *   Load/Display PLY file using primitives
 *
 * @author: Matthew D. Anderson
 * @date:   10-02-2014
 *
 * Usage:
 *   OpenGL_ply.exe [filename] [scale]
 *
 * Results:
 *   Renders Top/Side/Front views
 *   Renders without lighting
 *   Rotation:
 *     Rotations are applied in XYZ order
 *     Rotations are around the axis (X = rotation in YZ plane)
 *     RGB -> XYZ
 *   Orientation:
 *     Orientation is in "Y-Up, Z-Out"
 */

#include <stdlib.h>
#include <gl\glut.h>
#include <stdio.h>
#include <math.h>
#include "ply.h"
#include "SliderControl.h"

#define M_PI 3.14159 /* if not in math.h */

void display();
void reshape(int w, int h);
void init(char *plyFile);
void drawControls();
void mouseCallback(int button, int state, int x, int y);
void mouseMotion(int x, int y);

// Used to loadPly file into memory
void loadPly(char *fileName);

// Used to set the viewport and view orientation
void setView(int view);

// Globals for dealing with the model
// - Not very OOP, but my CPP is rusty >.>
Vertex **vList;
Face **fList;
int vertices = 0;
int faces = 0;

// Used to scale the model on load
float scale = 1.0;

// Globals for viewport width and height
int width = 0;
int height = 0;

// The midpoint of the model
float midX = 0;
float midY = 0;
float midZ = 0;

// Maximum dimension of the model
float maxDim = 0;

// Display list id for the model
GLuint list_id;

// Controls
SliderControl *sliderX, *sliderY, *sliderZ, *active;

void main (int argc, char **argv){
	char *fileName;

	// Initialize GLUT/OpenGL
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
	glutInitWindowPosition(100, 100);
	glutInitWindowSize(640, 480);
	glutCreateWindow("Assignment 1: Matthew Anderson");

	// Initialize
	// Also, assume that the ply file is the FIRST ARGUMENT
	if (argc >= 2)
		fileName = argv[1];
	else
		fileName = "cube";

	// Second argument should be the scaling parameter
	if (argc >= 3)
		scale =...