src/layers/gridlayer.cpp

changeset 377
e1c5e4310f8b
parent 264
76a025db4948
--- a/src/layers/gridlayer.cpp	Tue Apr 11 22:39:18 2023 +0300
+++ b/src/layers/gridlayer.cpp	Tue Apr 11 22:51:12 2023 +0300
@@ -71,7 +71,7 @@
 {
 	this->gridMatrix = newGridMatrix;
 	if (this->isInitialized) {
-		this->shader.setUniformMatrix("grid", newGridMatrix);
+		gl::set_shader_matrix_uniform(&this->shader, "grid", newGridMatrix);
 	}
 }
 
@@ -79,7 +79,7 @@
 {
 	this->gridColor = gl::colorToVector4(newGridColor);
 	if (this->isInitialized) {
-		this->shader.setUniformVector("gridColor", this->gridColor);
+		gl::set_shader_vector_uniform(&this->shader, "gridColor", this->gridColor);
 	}
 }
 
@@ -90,7 +90,8 @@
 
 void GridLayer::initializeGL()
 {
-	this->shader.initialize(
+	gl::initialize_basic_shader(
+		&this->shader,
 		::vertexShaderSource,
 		::fragmentShaderSource,
 		QOpenGLBuffer::StaticDraw,
@@ -105,10 +106,10 @@
 	);
 	this->isInitialized = true;
 	constexpr auto data = calcGridData<50>();
-	this->shader.setUniformVector("gridColor", this->gridColor);
+	gl::set_shader_vector_uniform(&this->shader, "gridColor", this->gridColor);
 	this->setGridMatrix(this->gridMatrix);
 	this->settingsChanged();
-	this->shader.bufferData(data.data(), data.size(), sizeof data[0]);
+	gl::buffer_shader_data(&this->shader, data.data(), data.size(), sizeof data[0]);
 }
 
 void GridLayer::paintGL()
@@ -118,12 +119,12 @@
 	glLineStipple(1, 0x8888);
 	glEnable(GL_LINE_STIPPLE);
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-	this->shader.draw(GL_LINES);
+	gl::draw_shader(&this->shader, GL_LINES);
 	glDisable(GL_BLEND);
 	glDisable(GL_LINE_STIPPLE);
 }
 
 void GridLayer::mvpMatrixChanged(const glm::mat4& mvpMatrix)
 {
-	this->shader.setMvpMatrix(mvpMatrix);
+	gl::set_shader_matrix_uniform(&this->shader, "mvp", mvpMatrix);
 }

mercurial