Skip to content

Instantly share code, notes, and snippets.

@od0x0
Created May 12, 2011 22:52
Show Gist options
  • Save od0x0/969635 to your computer and use it in GitHub Desktop.
Save od0x0/969635 to your computer and use it in GitHub Desktop.
#pragma once
#include "AECore.h"
#include "AEMath.h"
#include "AEArray.h"
typedef struct AERenderer AERenderer;
AERenderer* AERendererNew(void);
void AERendererDelete(AERenderer* self);
void AERendererBind(AERenderer* self);
void AERendererSetViewMatrix(AERenderer* self, const float* m4x4);
void AERendererSetModelMatrix(AERenderer* self, const float* m4x4);
void AERendererSetProjectionMatrix(AERenderer* self, const float* m4x4);
void AERendererBindTextures(AERenderer* self, const GLuint* textures, size_t count);
void AERendererBindProgram(AERenderer* self, GLuint program);
#define AERendererShaderTypeVertex 1
#define AERendererShaderTypeFragment 2
GLuint AERendererCreateShader(AERenderer* self, GLuint shaderType, const char* source);
void AERendererDestroyShader(AERenderer* self, GLuint shader);
GLuint AERendererCreateProgram(AERenderer* self, const GLuint* shaders, size_t shaderCount);
void AERendererDestroyProgram(AERenderer* self, GLuint program);
#define AERendererProgramModelViewProjectionMatrixUniformName "ModelViewProjectionMatrix"
#define AERendererProgramTimeUniformName "Time"
#define AERendererProgramTexturesUniformName "Textures"
GLuint AERendererGetProgramUniformLocation(AERenderer* self, GLuint programID, const char* name);
void AERendererSetBoundProgramUniform(AERenderer* self, GLuint uniformLocation, void* value);
GLuint AERendererGetProgramAttributeLocation(AERenderer* self, GLuint programID, const char* name);
typedef enum {
AERendererStorageTypeStream,
AERendererStorageTypeDynamic,
AERendererStorageTypeStatic
}AERendererStorageType;
typedef enum {
AERendererValueTypeUInt8,
AERendererValueTypeUInt16,
AERendererValueTypeFloat32
}AERendererValueType;
typedef enum {
AERendererPolygonTypeTriangle,
AERendererPolygonTypeQuad
}AERendererPolygonType;
void AERendererDrawRange(AERenderer* self, AERendererPolygonType type, size_t start, size_t count);
GLuint AERendererCreateVBO(AERenderer* self, bool isIndexBuffer, AERendererStorageType storageType, AERendererValueType* attributeTypes, int* attributComponentCounts, bool* attributeNormalizationFlags, size_t attributeCount);
void AERendererToggleVBOBinding(AERenderer* self, GLuint vboID, bool on, GLuint* attributeLocations);
void* AERendererMapVBO(AERenderer* self, GLuint vboID, size_t start, size_t count);
void AERendererBindVBO(AERenderer* self, GLuint vboID, GLuint* attributeLocations);
void AERendererDestroyVBO(AERenderer* self, GLuint vboID);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment