diff --git a/exercise1/glsl/shader.frag b/exercise1/glsl/shader.frag index e43a608..eb0c3af 100644 --- a/exercise1/glsl/shader.frag +++ b/exercise1/glsl/shader.frag @@ -5,7 +5,6 @@ in vec4 fragment_color; in vec2 vertex_pos; -in vec2 julia_position; out vec4 color; @@ -16,7 +15,7 @@ const int i_max = 200; void main() { - vec2 z = julia_position * m; + vec2 z = vertex_pos * m; int i; for(i = 0; i < i_max; i++) { diff --git a/exercise1/glsl/shader.vert b/exercise1/glsl/shader.vert index 4e76036..9e11959 100644 --- a/exercise1/glsl/shader.vert +++ b/exercise1/glsl/shader.vert @@ -9,11 +9,8 @@ in vec4 in_color; uniform mat4 view; uniform mat4 proj; -uniform vec2 julia_positions[3]; - out vec4 fragment_color; out vec2 vertex_pos; -out vec2 julia_position; void main() { @@ -21,6 +18,4 @@ void main() gl_Position = proj * view * in_position; fragment_color = in_color; - - julia_position = julia_positions[gl_VertexID]; } \ No newline at end of file diff --git a/exercise1/include/Viewer.h b/exercise1/include/Viewer.h index 8ee0c42..650663d 100644 --- a/exercise1/include/Viewer.h +++ b/exercise1/include/Viewer.h @@ -26,13 +26,6 @@ private: nanogui::Slider* sldJuliaCY; nanogui::Slider* sldJuliaZoom; //Zoom factor for the Julia fractal - nanogui::Slider* point1X; - nanogui::Slider* point1Y; - nanogui::Slider* point2X; - nanogui::Slider* point2Y; - nanogui::Slider* point3X; - nanogui::Slider* point3Y; - // The following variables hold OpenGL object IDs GLuint vertex_shader_id, // ID of the vertex shader fragment_shader_id, // ID of the fragment shader @@ -47,8 +40,6 @@ private: GLint julia_m_id; GLint julia_c_id; - GLint julia_pos_id; - // Read, Compile and link the shader codes to a shader program void CreateShaders(); // Create and define the vertex array and add a number of vertex buffers diff --git a/exercise1/src/Viewer.cpp b/exercise1/src/Viewer.cpp index eedd47b..6343e3e 100644 --- a/exercise1/src/Viewer.cpp +++ b/exercise1/src/Viewer.cpp @@ -15,8 +15,6 @@ #include "glsl.h" -using namespace nse::gui; - Viewer::Viewer() : AbstractViewer("CG1 Exercise 1") { @@ -31,8 +29,6 @@ Viewer::Viewer() julia_m_id = glGetUniformLocation(program_id, "m"); julia_c_id = glGetUniformLocation(program_id, "c"); - julia_pos_id = glGetUniformLocation(program_id, "julia_positions"); - modelViewMatrix.setIdentity(); projectionMatrix.setIdentity(); @@ -54,13 +50,6 @@ void Viewer::SetupGUI() sldJuliaCY = nse::gui::AddLabeledSliderWithDefaultDisplay(mainWindow, "JuliaC.Y", std::make_pair(-1.0f, 1.0f), -0.3f, 2); sldJuliaZoom = nse::gui::AddLabeledSliderWithDefaultDisplay(mainWindow, "Julia Zoom", std::make_pair(0.01f, 10.0f), 1.0f, 2); - point1X = AddLabeledSliderWithDefaultDisplay(mainWindow, "Point1.X", std::make_pair(-1.0f, 1.0f), 0.0f, 2); - point1Y = AddLabeledSliderWithDefaultDisplay(mainWindow, "Point1.Y", std::make_pair(-1.0f, 1.0f), 0.0f, 2); - point2X = AddLabeledSliderWithDefaultDisplay(mainWindow, "Point2.X", std::make_pair(-1.0f, 1.0f), -1.0f, 2); - point2Y = AddLabeledSliderWithDefaultDisplay(mainWindow, "Point2.Y", std::make_pair(-1.0f, 1.0f), -1.0f, 2); - point3X = AddLabeledSliderWithDefaultDisplay(mainWindow, "Point3.X", std::make_pair(-1.0f, 1.0f), 1.0f, 2); - point3Y = AddLabeledSliderWithDefaultDisplay(mainWindow, "Point3.Y", std::make_pair(-1.0f, 1.0f), 1.0f, 2); - performLayout(); } @@ -258,13 +247,6 @@ void Viewer::drawContents() else glDisable(GL_DEPTH_TEST); - // create uniform buffer for julia_positions - float julia_positions[6] = { - point1X->value(), point1Y->value(), - point2X->value(), point2Y->value(), - point3X->value(), point3Y->value() - }; - // Activate the shader program glUseProgram(program_id); @@ -280,8 +262,6 @@ void Viewer::drawContents() glUniform1f(julia_m_id, juliaZoom); glUniform2fv(julia_c_id, 1, juliaC.data()); - glUniform2fv(julia_pos_id, 6, julia_positions); - // Bind the vertex array glBindVertexArray(vertex_array_id); // Draw the bound vertex array. Start at element 0 and draw 3 vertices