mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-26 08:29:33 +00:00
Slow steps towards switching to line output.
This commit is contained in:
parent
0af1d668a6
commit
833ab7945b
@ -90,7 +90,7 @@ ScanTarget::ScanTarget() :
|
||||
glBindVertexArray(scan_vertex_array_);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, scan_buffer_name_);
|
||||
test_shader_.reset(new Shader(
|
||||
globals(ShaderType::Scan),
|
||||
glsl_globals(ShaderType::Scan) + glsl_default_vertex_shader(ShaderType::Scan),
|
||||
"#version 150\n"
|
||||
"out vec4 fragColour;"
|
||||
"void main(void) {"
|
||||
@ -356,9 +356,8 @@ void ScanTarget::draw() {
|
||||
|
||||
// TEST: draw all scans.
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
glBindVertexArray(scan_vertex_array_);
|
||||
test_shader_->bind();
|
||||
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, GLsizei(scan_buffer_.size()));
|
||||
// Rectangle rect(-0.8f, -0.8f, 1.6f, 1.6f);
|
||||
// rect.draw(1, 1, 0);
|
||||
}
|
||||
|
@ -117,7 +117,11 @@ class ScanTarget: public Outputs::Display::ScanTarget {
|
||||
from [...]OpenGL::ScanTarget and a vertex function to provide
|
||||
the standard varyings.
|
||||
*/
|
||||
std::string globals(ShaderType type);
|
||||
std::string glsl_globals(ShaderType type);
|
||||
|
||||
/*!
|
||||
*/
|
||||
std::string glsl_default_vertex_shader(ShaderType type);
|
||||
|
||||
/*!
|
||||
Calls @c taret.enable_vertex_attribute_with_pointer to attach all
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
using namespace Outputs::Display::OpenGL;
|
||||
|
||||
std::string ScanTarget::globals(ShaderType type) {
|
||||
std::string ScanTarget::glsl_globals(ShaderType type) {
|
||||
switch(type) {
|
||||
case ShaderType::Scan:
|
||||
return
|
||||
@ -30,8 +30,24 @@ std::string ScanTarget::globals(ShaderType type) {
|
||||
"in float endCompositeAngle;"
|
||||
|
||||
"in float dataY;"
|
||||
"in float lineY;"
|
||||
"in float lineY;";
|
||||
|
||||
case ShaderType::Line:
|
||||
return
|
||||
"#version 150\n"
|
||||
|
||||
"uniform vec2 scale;"
|
||||
"uniform float rowHeight;"
|
||||
|
||||
"in vec2 startPoint;"
|
||||
"in vec2 endPoint;";
|
||||
}
|
||||
}
|
||||
|
||||
std::string ScanTarget::glsl_default_vertex_shader(ShaderType type) {
|
||||
switch(type) {
|
||||
case ShaderType::Scan:
|
||||
return
|
||||
"void main(void) {"
|
||||
"float lateral = float(gl_VertexID & 1);"
|
||||
"float longitudinal = float((gl_VertexID & 2) >> 1);"
|
||||
@ -43,11 +59,7 @@ std::string ScanTarget::globals(ShaderType type) {
|
||||
"}";
|
||||
|
||||
case ShaderType::Line:
|
||||
return
|
||||
"#version 150\n"
|
||||
|
||||
"in vec2 startPoint;"
|
||||
"in vec2 endPoint;";
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user