Revert julia sliders

This commit is contained in:
hodasemi 2018-10-21 16:40:57 +02:00
parent fdf5073e31
commit 8a4f3a9229
4 changed files with 1 additions and 36 deletions

View file

@ -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++) {

View file

@ -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];
}

View file

@ -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

View file

@ -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