CGI/exercise1/include/Viewer.h
2018-11-26 17:58:30 +01:00

57 lines
1.6 KiB
C++

// This source code is property of the Computer Graphics and Visualization
// chair of the TU Dresden. Do not distribute!
// Copyright (C) CGV TU Dresden - All Rights Reserved
#pragma once
#include <gui/AbstractViewer.h>
class Viewer : public nse::gui::AbstractViewer
{
public:
Viewer();
void drawContents();
private:
void SetupGUI();
Eigen::Matrix4f modelViewMatrix, projectionMatrix;
//GUI Elements for the various options
nanogui::CheckBox *chkHasFaceCulling; //Shall back face culling be activated?
nanogui::CheckBox *chkHasDepthTesting; //Shall depth testing be activated?
nanogui::Slider *sldJuliaCX; //Seed for the Julia fractal
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
program_id, // ID of the shader program
vertex_array_id, // ID of the vertex array
position_buffer_id, // ID of the position buffer
color_buffer_id, // ID of the color buffer
uv_map_buffer_id; // ID of the uv_map
GLint view_uniform_id;
GLint proj_uniform_id;
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
void CreateVertexBuffers();
};