Skip to content

Instantly share code, notes, and snippets.

View Hopson97's full-sized avatar
🦡
Badger badger badger Badger badger badger Badger badger badger mushroom mushroom

Matthew Hopson Hopson97

🦡
Badger badger badger Badger badger badger Badger badger badger mushroom mushroom
View GitHub Profile
@Hopson97
Hopson97 / GLDebugCallback.cpp
Last active June 5, 2021 18:44
OpenGL Debug Callbacks
#include "GLDebugCallback.h"
// by Qookie
void GLAPIENTRY glDebugCallback(GLenum source, GLenum type, GLuint, GLenum severity, GLsizei,
const GLchar* message, const void*)
{
// clang-format off
const char* severityString = "?";
switch (severity) {
glCheck(glEnable(GL_DEPTH_TEST));
framebuffer.bind();
glCheck(glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT));
screen.onRender();
glBindTexture(GL_TEXTURE_2D, 0);
// Begin Post Processing
screenDrawable.bind();
glCheck(glDisable(GL_DEPTH_TEST));
glCheck(glActiveTexture(GL_TEXTURE0));
@Hopson97
Hopson97 / main.cpp
Created July 12, 2020 18:08
Cyber Pong Main
#include "GL/GLDebug.h"
#include "Screen.h"
#include "ScreenInGame.h"
#include "ScreenMainMenu.h"
#include <SFML/Window/Event.hpp>
#include <SFML/Window/Window.hpp>
#include <imgui/imgui.h>
#include <imgui_impl/imgui_impl_opengl3.h>
#include <imgui_impl/imgui_impl_sfml.h>
#include <iostream>
@Hopson97
Hopson97 / fragment.glsl
Created July 6, 2020 16:46
Bad Lighting
#version 330
out vec4 outColour;
uniform vec3 lightPosition;
in vec3 passFragPosition;
in vec3 passNormal;
void main() {
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <cmath>
const float SPEED = 5.0f;
int main()
{
sf::Clock time;
sf::RenderWindow window(sf::VideoMode(1600, 720), "SFML works!");
local backgroundTexture = game.gui.getTexture("res/menu_bg.png")
local logoTexture = game.gui.getTexture("res/logo.png")
local buttonTexture = game.gui.getTexture("res/button.png")
local function singleplayerClicked()
print("Singleplayer clicked")
game.gui.pop()
game.gui.push("hud")
end
#include <iostream>
#include <bitset>
#include <cstdint>
using u32 = uint32_t;
using u8 = uint8_t;
int main() {
u32 vertex = 0;
local air = game.data.getVoxel("openbuilder_air")
local wood = game.data.getVoxel("openbuilder_wood")
local leaf = game.data.getVoxel("openbuilder_leaf")
function createTree(chunk, bx, by, bz)
local trunkHeight = 5
local leavesHeight = trunkHeight - 1;
for y = 0, 1, 1 do
#include <iostream>
#include <SFML/Graphics.hpp>
#include <ctime>
#include <cstdlib>
#include <gtc/noise.hpp>
#include <array>
@Hopson97
Hopson97 / enet_playground.cpp
Last active December 11, 2019 19:46
Playing around with enet
#include <SFML/Graphics.hpp>
#include <thread>
#include <array>
#include <iostream>
#include <SFML/Network/Packet.hpp>
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#define ENET_IMPLEMENTATION
#include "enet.h"