rename OpenGL "programs" to "shaders"

This commit is contained in:
Josh Holtrop 2016-07-29 21:27:32 -04:00
parent b61513b97e
commit cef49e9e6e
4 changed files with 17 additions and 17 deletions

View File

@ -1,7 +1,7 @@
#include "TextProgram.h" #include "TextShader.h"
#include "Runtime.h" #include "Runtime.h"
TextProgram::TextProgram() TextShader::TextShader()
{ {
std::string v_path = Runtime::find(Runtime::SHADER, "text.v"); std::string v_path = Runtime::find(Runtime::SHADER, "text.v");
std::string f_path = Runtime::find(Runtime::SHADER, "text.f"); std::string f_path = Runtime::find(Runtime::SHADER, "text.f");

View File

@ -1,13 +1,13 @@
#ifndef TEXTPROGRAM_H #ifndef TEXTSHADER_H
#define TEXTPROGRAM_H #define TEXTSHADER_H
#include "glcxx.hpp" #include "glcxx.hpp"
#include <memory> #include <memory>
class TextProgram class TextShader
{ {
public: public:
TextProgram(); TextShader();
void use() { m_program->use(); } void use() { m_program->use(); }

View File

@ -112,10 +112,10 @@ bool Window::create(std::shared_ptr<Buffer> buffer)
return false; return false;
} }
m_programs.text = std::make_shared<TextProgram>(); m_shaders.text = std::make_shared<TextShader>();
m_programs.text->use(); m_shaders.text->use();
m_programs.text->set_texture(0); m_shaders.text->set_texture(0);
m_programs.text->set_color(1.0, 1.0, 1.0, 1.0); m_shaders.text->set_color(1.0, 1.0, 1.0, 1.0);
m_buffer = buffer; m_buffer = buffer;
m_start_piece = m_buffer->piece_table->start_descriptor->next; m_start_piece = m_buffer->piece_table->start_descriptor->next;
@ -251,8 +251,8 @@ void Window::resize()
{ {
SDL_GetWindowSize(m_window, &m_width, &m_height); SDL_GetWindowSize(m_window, &m_width, &m_height);
glViewport(0, 0, m_width, m_height); glViewport(0, 0, m_width, m_height);
m_programs.text->use(); m_shaders.text->use();
m_programs.text->set_viewport_size(m_width, m_height); m_shaders.text->set_viewport_size(m_width, m_height);
m_columns = m_width / m_font.get_advance(); m_columns = m_width / m_font.get_advance();
if (m_columns < 1) if (m_columns < 1)
m_columns = 1; m_columns = 1;
@ -264,7 +264,7 @@ void Window::redraw()
glClearColor (0.0, 0.0, 0.0, 0.0); glClearColor (0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
m_programs.text->use(); m_shaders.text->use();
int advance = m_font.get_advance(); int advance = m_font.get_advance();
int line_height = m_font.get_line_height(); int line_height = m_font.get_line_height();
@ -278,7 +278,7 @@ void Window::redraw()
{ {
uint8_t c = pd->start[i]; uint8_t c = pd->start[i];
auto g = m_font.get_glyph(c); auto g = m_font.get_glyph(c);
m_programs.text->set_position(x, y); m_shaders.text->set_position(x, y);
g->render(); g->render();
if ((i + 1) % m_columns == 0) if ((i + 1) % m_columns == 0)
{ {

View File

@ -2,7 +2,7 @@
#define WINDOW_H #define WINDOW_H
#include <SDL.h> #include <SDL.h>
#include "TextProgram.h" #include "TextShader.h"
#include "Font.h" #include "Font.h"
#include "Buffer.h" #include "Buffer.h"
@ -26,8 +26,8 @@ protected:
int m_height; int m_height;
struct struct
{ {
std::shared_ptr<TextProgram> text; std::shared_ptr<TextShader> text;
} m_programs; } m_shaders;
Font m_font; Font m_font;
int m_columns; int m_columns;