* foo
This commit is contained in:
commit
a46b410717
6 changed files with 33 additions and 10 deletions
|
@ -84,11 +84,12 @@ class GameWindow : public endofthejedi::GLWindow {
|
|||
m_renderer.drawCircle(pos.x, pos.y, 0.01, color.x, color.y, color.z, 6);
|
||||
}
|
||||
|
||||
void drawTrace(const game::Trace *trace)
|
||||
{
|
||||
void drawTrace(const game::Trace *trace) {
|
||||
for (const game::Trace::TracePoint &p : trace->points) {
|
||||
glm::vec3 color = glm::vec3(0.1, 0.3, 1.0) / (1.0f + 500.0f*p.speed);
|
||||
m_renderer.drawCircle(p.position.x, p.position.y, 0.005, color.x, color.y, color.z, 3);
|
||||
glm::vec3 color =
|
||||
glm::vec3(0.1, 0.3, 1.0) / (1.0f + 500.0f * p.speed);
|
||||
m_renderer.drawCircle(p.position.x, p.position.y, 0.005, color.x,
|
||||
color.y, color.z, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,17 +27,34 @@ bool endofthejedi::Shader::check() {
|
|||
glGetProgramiv(m_program, GL_LINK_STATUS, &result);
|
||||
glGetProgramiv(m_program, GL_INFO_LOG_LENGTH, &len);
|
||||
if (len > 1) {
|
||||
char* error = (char*)malloc(len);
|
||||
char *error = (char *)malloc(len);
|
||||
glGetProgramInfoLog(m_program, len, NULL, error);
|
||||
std::string str(error);
|
||||
std::cout << str << "\n";
|
||||
|
||||
}
|
||||
std::cout << "checked program"
|
||||
<< "\n";
|
||||
|
||||
return (bool)result;
|
||||
}
|
||||
|
||||
bool endofthejedi::Shader::checkShader() { return false; }
|
||||
bool endofthejedi::Shader::checkShader(GLuint shader) {
|
||||
GLint len = 0;
|
||||
GLint result = 0;
|
||||
|
||||
glGetProgramiv(m_program, GL_LINK_STATUS, &result);
|
||||
glGetProgramiv(m_program, GL_INFO_LOG_LENGTH, &len);
|
||||
if (len > 1) {
|
||||
char *error = (char *)malloc(len);
|
||||
glGetShaderInfoLog(shader, 0, &len, error);
|
||||
std::string str(error);
|
||||
std::cout << str << "\n";
|
||||
}
|
||||
std::cout << "checked shader"
|
||||
<< "\n";
|
||||
|
||||
return (bool)result;
|
||||
}
|
||||
|
||||
void endofthejedi::Shader::bind() { glUseProgram(m_program); }
|
||||
|
||||
|
@ -48,8 +65,9 @@ void endofthejedi::Shader::load(std::string path, GLenum shadertype) {
|
|||
const char *cheddardata = path.c_str();
|
||||
glShaderSource(cheddar, 1, &cheddardata, NULL);
|
||||
glCompileShader(cheddar);
|
||||
checkShader(cheddar);
|
||||
glAttachShader(m_program, cheddar);
|
||||
glLinkProgram(m_program);
|
||||
glDeleteShader(cheddar);
|
||||
check();
|
||||
glDeleteShader(cheddar);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class Shader {
|
|||
private:
|
||||
GLuint m_program;
|
||||
bool check();
|
||||
bool checkShader();
|
||||
bool checkShader(GLuint shader);
|
||||
protected:
|
||||
public:
|
||||
Shader();
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "game_window.hpp"
|
||||
#include "options.hpp"
|
||||
|
||||
uint64_t optionsFlags;
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#define SET_FLAG(x,y) optionsFlags&=(~((1)<<x));optionsFlags|=((y&1)<<x)
|
||||
#define ISSET_FLAG(x) (optionsFlags&((1)<<x))
|
||||
uint64_t optionsFlags;
|
||||
extern uint64_t optionsFlags;
|
||||
|
||||
/*
|
||||
* usage:
|
||||
|
|
|
@ -10,6 +10,8 @@ static const char *fss =
|
|||
endofthejedi::Renderer::Renderer() {
|
||||
m_shader.load(vss, GL_VERTEX_SHADER);
|
||||
m_shader.load(fss, GL_FRAGMENT_SHADER);
|
||||
|
||||
|
||||
}
|
||||
|
||||
endofthejedi::Renderer::~Renderer() {}
|
||||
|
|
Loading…
Reference in a new issue