X
This commit is contained in:
@@ -96,28 +96,25 @@ void openglInit()
|
||||
{
|
||||
if (!mainwin) {
|
||||
YughError("No window to init OpenGL on.", 1);
|
||||
abort();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sprite_initialize();
|
||||
|
||||
////// MAKE SHADERS
|
||||
outlineShader = MakeShader("outlinevert.glsl", "outline.glsl");
|
||||
|
||||
spriteShader = MakeShader("spritevert.glsl", "spritefrag.glsl");
|
||||
animSpriteShader =
|
||||
MakeShader("animspritevert.glsl", "animspritefrag.glsl");
|
||||
animSpriteShader = MakeShader("animspritevert.glsl", "animspritefrag.glsl");
|
||||
textShader = MakeShader("textvert.glsl", "textfrag.glsl");
|
||||
|
||||
|
||||
|
||||
font_init(textShader);
|
||||
sprite_initialize();
|
||||
debugdraw_init();
|
||||
|
||||
stdFont = MakeFont("notosans.ttf", 300);
|
||||
|
||||
text_settype(stdFont);
|
||||
|
||||
//glEnable(GL_STENCIL_TEST);
|
||||
glClearColor(editorClearColor[0], editorClearColor[1],
|
||||
editorClearColor[2], editorClearColor[3]);
|
||||
glClearColor(editorClearColor[0], editorClearColor[1], editorClearColor[2], editorClearColor[3]);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -131,8 +128,7 @@ void openglInit()
|
||||
glGenBuffers(1, &projUBO);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, projUBO);
|
||||
glBufferData(GL_UNIFORM_BUFFER, 64, NULL, GL_DYNAMIC_DRAW);
|
||||
glBindBufferRange(GL_UNIFORM_BUFFER, 0, projUBO, 0,
|
||||
sizeof(float) * 16);
|
||||
glBindBufferRange(GL_UNIFORM_BUFFER, 0, projUBO, 0, sizeof(float) * 16);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
|
||||
shader_setUBO(spriteShader, "Projection", 0);
|
||||
@@ -154,33 +150,37 @@ void openglRender(struct mSDLWindow *window, struct mCamera *mcamera)
|
||||
glBufferSubData(GL_UNIFORM_BUFFER, 0, 64, projection);
|
||||
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glCullFace(GL_BACK);
|
||||
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glCullFace(GL_BACK);
|
||||
|
||||
// Clear color and depth
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT |
|
||||
GL_STENCIL_BUFFER_BIT);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
////// TEXT && GUI
|
||||
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
//shader_use(textShader);
|
||||
shader_use(textShader);
|
||||
//shader_setmat4(textShader, "projection", window->projection);
|
||||
|
||||
|
||||
|
||||
|
||||
//mfloat_t fontpos[2] = { 25.f, 25.f };
|
||||
//mfloat_t fontcolor[3] = { 0.5f, 0.8f, 0.2f };
|
||||
//renderText("Sample text", fontpos, 0.4f, fontcolor, -1.f);
|
||||
mfloat_t fontpos[2] = { 25.f, 25.f };
|
||||
mfloat_t fontcolor[3] = { 0.5f, 0.8f, 0.2f };
|
||||
renderText("Sample text", fontpos, 4.f, fontcolor, -1.f);
|
||||
|
||||
|
||||
/*
|
||||
///// Sprites
|
||||
|
||||
shader_use(spriteShader);
|
||||
shader_setmat4(spriteShader, "projection", window->projection);
|
||||
for (int i = 0; i < numSprites; i++) {
|
||||
sprite_draw(sprites[i]);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//glDepthFunc(GL_LESS);
|
||||
|
||||
Reference in New Issue
Block a user