mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 00:09:18 +02:00
work
This commit is contained in:
@@ -106,6 +106,17 @@ void gl::program::init()
|
||||
}
|
||||
|
||||
glUniform1i(glGetUniformLocation(*this, "shadowmap"), 10); //m7t: do something better
|
||||
|
||||
GLuint index;
|
||||
|
||||
if ((index = glGetUniformBlockIndex(*this, "scene_ubo")) != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(*this, 0, index);
|
||||
|
||||
if ((index = glGetUniformBlockIndex(*this, "model_ubo")) != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(*this, 1, index);
|
||||
|
||||
if ((index = glGetUniformBlockIndex(*this, "light_ubo")) != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(*this, 2, index);
|
||||
}
|
||||
|
||||
gl::program::program()
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace gl
|
||||
void attach(const shader &);
|
||||
void link();
|
||||
|
||||
virtual void init();
|
||||
private:
|
||||
void init();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "shader_mvp.h"
|
||||
|
||||
void gl::program_mvp::init()
|
||||
{
|
||||
GLuint index;
|
||||
|
||||
if ((index = glGetUniformBlockIndex(*this, "scene_ubo")) != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(*this, 0, index);
|
||||
|
||||
if ((index = glGetUniformBlockIndex(*this, "model_ubo")) != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(*this, 1, index);
|
||||
|
||||
if ((index = glGetUniformBlockIndex(*this, "light_ubo")) != GL_INVALID_INDEX)
|
||||
glUniformBlockBinding(*this, 2, index);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "shader.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
class program_mvp : public program
|
||||
{
|
||||
public:
|
||||
using program::program;
|
||||
|
||||
virtual void init() override;
|
||||
};
|
||||
}
|
||||
@@ -5,7 +5,7 @@ gl::ubo::ubo(int size, int index)
|
||||
{
|
||||
glGenBuffers(1, *this);
|
||||
bind();
|
||||
glBufferData(GL_UNIFORM_BUFFER, size, nullptr, GL_DYNAMIC_DRAW);
|
||||
glBufferData(GL_UNIFORM_BUFFER, size, nullptr, GL_STREAM_DRAW);
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, index, *this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user