Skip to content

Instantly share code, notes, and snippets.

Avatar

Bartłomiej Filipek fenbf

View GitHub Profile
@haacked
haacked / TestHelper.cs
Created Jan 14, 2012
String Comparison Unit Test Helper
View TestHelper.cs
public static class TestHelpers
{
public static void ShouldEqualWithDiff(this string actualValue, string expectedValue)
{
ShouldEqualWithDiff(actualValue, expectedValue, DiffStyle.Full, Console.Out);
}
public static void ShouldEqualWithDiff(this string actualValue, string expectedValue, DiffStyle diffStyle)
{
ShouldEqualWithDiff(actualValue, expectedValue, diffStyle, Console.Out);
View GpuShadows.java
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.Texture;
@aras-p
aras-p / preprocessor_fun.h
Last active Sep 15, 2020
Things to commit just before leaving your job
View preprocessor_fun.h
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@fenbf
fenbf / CalcTexPixels.cpp
Created Oct 30, 2013
Function that will go through all texture object levels and count pixel counts and memory in bytes. Currently only Compressed textures formats are supported and RGB8 (RGB) or RGBA8 (RGBA)
View CalcTexPixels.cpp
void CalculateTextureObjectPixels(GLuint texID, unsigned long *pixelCount, unsigned long *memoryUsed)
{
int baseLevel = 0, maxLevel = 0;
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, &baseLevel);
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, &maxLevel);
long pixels = 0, bytes = 0, bpp = 0;
int texW = 0, texH = 0, texFmt = 0, compressed = 0, compressedBytes = 0;
for (int level = baseLevel; level <= maxLevel; ++level)
{
@Groovounet
Groovounet / gist:7258805
Created Oct 31, 2013
Checking all the OpenGL capabilities from 2.1 to 4.4
View gist:7258805
struct caps
{
enum profile
{
CORE = 0x00000001,
COMPATIBILITY = 0x00000002,
ES = 0x00000004
};
private:
@bishboria
bishboria / springer-free-maths-books.md
Last active Sep 14, 2020
Springer made a bunch of books available for free, these were the direct links
View Connection.hpp
struct Connection {
void disconnected()
{
m_connection = Disconnected();
}
void interrupted()
{
m_connection = std::visit(InterruptedEvent(*this), m_connection);
}
You can’t perform that action at this time.