This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* To compile: | |
gcc this-file.c -lcurses | |
*/ | |
#include <curses.h> | |
int main() { | |
initscr(); | |
noecho(); /* do not echo keyboard input */ | |
char input; | |
move (10, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdbool.h> | |
double big_one[500]; | |
double small_one[50]; | |
int main() { | |
bool test; | |
printf ("This main function begins at %X\n", main); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in fshader.glsl | |
precision mediump float; | |
// varying from rasterizer | |
varying vec4 vColor; | |
void main() { | |
gl_FragColor = vColor; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in vshader.glsl | |
/* attributes are supplied by JSCode */ | |
attribute vec2 vertexPos; | |
attribute vec4 vertexCol; | |
/* varying variables are passed to rasterizer */ | |
varying vec4 vColor; | |
void main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const NUM_CIRCLE_POINTS = 36; | |
function main() { | |
let canvas = document.getElementById("my-canvas"); | |
// setupWebGL is defined in webgl-utils.js, it returns a WebGLRenderingContext | |
let gl = WebGLUtils.setupWebGL(canvas); | |
// Load the shader pair. 2nd arg is vertex shader, 3rd arg is fragment shader | |
ShaderUtils.loadFromFile(gl, "vshader.glsl", "fshader.glsl") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const NUM_CIRCLE_POINTS = 12; | |
function main() { | |
let canvas = document.getElementById("my-canvas"); | |
// setupWebGL is defined in webgl-utils.js, it returns a WebGLRenderingContext | |
let gl = WebGLUtils.setupWebGL(canvas); | |
// Load the shader pair. 2nd arg is vertex shader, 3rd arg is fragment shader | |
ShaderUtils.loadFromFile(gl, "vshader.glsl", "fshader.glsl") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
let canvas = document.getElementById("my-canvas"); | |
// setupWebGL is defined in webgl-utils.js, it returns a WebGLRenderingContext | |
let gl = WebGLUtils.setupWebGL(canvas); | |
// Load the shader pair. 2nd arg is vertex shader, 3rd arg is fragment shader | |
ShaderUtils.loadFromFile(gl, "vshader.glsl", "fshader.glsl") | |
.then( (prog) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
let canvas = document.getElementById("my-canvas"); | |
// setupWebGL is defined in webgl-utils.js, it returns a WebGLRenderingContext | |
let gl = WebGLUtils.setupWebGL(canvas); | |
// Load the shader pair. 2nd arg is vertex shader, 3rd arg is fragment shader | |
ShaderUtils.loadFromFile(gl, "vshader.glsl", "fshader.glsl") | |
.then( (prog) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in fshader.glsl | |
void main() { | |
gl_FragColor = vec4 (0.0, 101.0/255.0, 164.0/255.0, 1.0); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in vshader.glsl | |
attribute vec2 vertexPos; // each incoming vertex is (x,y) | |
void main() { | |
//gl_PointSize = 2.0; | |
gl_Position = vec4 (vertexPos, 0.0, 1.0); | |
} |