Skip to content

Instantly share code, notes, and snippets.

glBindTexture(GL_TEXTURE_2D,entity->model->texture->texture);
glUseProgram(entity->model->texture->shader->program);
glBindVertexArray(entity->model->vao);
glUniformMatrix4fv(entity->model->texture->shader->m_mvp,1,GL_FALSE,matrix_position(matrix,entity->pos.x,entity->pos.y,0,0,0,0));
glBindVertexArray(0);
glUseProgram(0);
@flagoworld
flagoworld / csb.php
Last active December 18, 2015 08:29 — forked from anonymous/gist:5754885
<?php
//ARRAY IN:
$in=array(
array('name' => 'john', 'occupation' => 'electrician'),
array('name' => 'jack', 'occupation' => 'plumber'),
array('name' => 'jake', 'occupation' => 'office rat'),
array('name' => 'pete', 'occupation' => 'electrician')
);
<?php
$baz='hello!';
?>
{
beforeSend: function (xhr, s) {
if (Object.prototype.toString.call(s.data).slice(8, -1) != 'FormData') {
s.data = csrfMagicName + '=' + csrfMagicToken + '&' + s.data;
} else {
s.data.append(csrfMagicName, csrfMagicToken);
}
}
}
@flagoworld
flagoworld / impact.c
Last active December 24, 2015 06:58
Damaging a ship works like this, i hope...
//Energy = radiation energy released from impact, MJ
//Shield = shield absorbtion capacity, MJ
//Hull = amount of stress the hull can receive before collapsing, MJ
shield -= energy
if(shield < 0)
{
energy = -shield;
shield = 0;
}
OOKVec3 matrix_unproject(GLuint fbo,OOKVec3 camera,int x,int y,Z_DEPTH z)
{
int viewport[4];
float winZ;
switch(z)
{
case Z_NEAR:
winZ=0.0f;
break;
@flagoworld
flagoworld / main.c
Created November 6, 2013 23:59
swillits
int main(int argc, const char * argv[])
{
printf("Start\n");
for(int i=0;i<123335423;++i)
{
int s=(int)(float)i;
if(s!=i)
printf("%i\n",s);
}
@flagoworld
flagoworld / draw_line.c
Last active December 30, 2015 10:29
Draw line from entity position to 0,0 - no line being drawn, no glErrors
//Draw Lead Angle
glUseProgram(ook->solid_color->program);
glBindVertexArray(lead_angle_vao);
float lead_verts[]=
{
ook->player->target->pos.x,ook->player->target->pos.y,
0,0
};
@flagoworld
flagoworld / ook_galaxy.txt
Created January 19, 2014 02:42
Procedural galaxy generator
Procedural galaxy generator
1. Randomly create systems using algorithm that approximates the shape of a galaxy
⁃ If point is too close to the solar system, don’t add it
⁃ Choose a system type to add
⁃ Star type? Black hole?
⁃ Check for nearby systems
⁃ If system is very close to another system
⁃ Add up to a couple planets, some debris, and another star at the center
<html>
<br>
<body>
<?php
$supers=array
(
"Earth"=>array('The Hulk', 'Captain America', 'Black Widow', 'Hawkeye'),