mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-26 00:47:00 +00:00
use shared_ptr consistently
This commit is contained in:
parent
d7a8cbe0be
commit
655af58ae1
8
glhr.cpp
8
glhr.cpp
@ -230,7 +230,7 @@ EX void projection_multiply(const glmatrix& m) {
|
|||||||
EX void init();
|
EX void init();
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
struct GLprogram : std::enable_shared_from_this<GLprogram> {
|
struct GLprogram {
|
||||||
GLuint _program;
|
GLuint _program;
|
||||||
GLuint vertShader, fragShader;
|
GLuint vertShader, fragShader;
|
||||||
|
|
||||||
@ -453,11 +453,11 @@ EX void colorClear(color_t color) {
|
|||||||
glClearColor(part(color, 3) / 255.0, part(color, 2) / 255.0, part(color, 1) / 255.0, part(color, 0) / 255.0);
|
glClearColor(part(color, 3) / 255.0, part(color, 2) / 255.0, part(color, 1) / 255.0, part(color, 0) / 255.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void full_enable(GLprogram *p) {
|
EX void full_enable(shared_ptr<GLprogram> p) {
|
||||||
auto& cur = current_glprogram;
|
auto& cur = current_glprogram;
|
||||||
flagtype oldflags = cur ? cur->shader_flags : 0;
|
flagtype oldflags = cur ? cur->shader_flags : 0;
|
||||||
if(p == &*cur) return;
|
if(p == cur) return;
|
||||||
cur = p->shared_from_this();
|
cur = p;
|
||||||
GLERR("pre_switch_mode");
|
GLERR("pre_switch_mode");
|
||||||
WITHSHADER({
|
WITHSHADER({
|
||||||
glUseProgram(cur->_program);
|
glUseProgram(cur->_program);
|
||||||
|
@ -276,7 +276,7 @@ void display_data::set_projection(int ed) {
|
|||||||
matched_programs[id] = selected;
|
matched_programs[id] = selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(glhr::current_glprogram != selected) full_enable(&*selected);
|
if(glhr::current_glprogram != selected) full_enable(selected);
|
||||||
|
|
||||||
shader_flags = selected->shader_flags;
|
shader_flags = selected->shader_flags;
|
||||||
auto cd = current_display;
|
auto cd = current_display;
|
||||||
|
Loading…
Reference in New Issue
Block a user