CGI/exercise1/include/Viewer.h

57 lines
1.6 KiB
C
Raw Normal View History

2018-11-26 16:58:30 +00:00
// This source code is property of the Computer Graphics and Visualization
// chair of the TU Dresden. Do not distribute!
2018-09-06 12:35:43 +00:00
// Copyright (C) CGV TU Dresden - All Rights Reserved
#pragma once
#include <gui/AbstractViewer.h>
class Viewer : public nse::gui::AbstractViewer
{
2018-11-26 16:58:30 +00:00
public:
2018-09-06 12:35:43 +00:00
Viewer();
void drawContents();
2018-11-26 16:58:30 +00:00
private:
2018-09-06 12:35:43 +00:00
void SetupGUI();
Eigen::Matrix4f modelViewMatrix, projectionMatrix;
//GUI Elements for the various options
2018-11-26 16:58:30 +00:00
nanogui::CheckBox *chkHasFaceCulling; //Shall back face culling be activated?
nanogui::CheckBox *chkHasDepthTesting; //Shall depth testing be activated?
2018-09-06 12:35:43 +00:00
2018-11-26 16:58:30 +00:00
nanogui::Slider *sldJuliaCX; //Seed for the Julia fractal
nanogui::Slider *sldJuliaCY;
nanogui::Slider *sldJuliaZoom; //Zoom factor for the Julia fractal
2018-09-06 12:35:43 +00:00
2018-11-26 16:58:30 +00:00
nanogui::Slider *point1X;
nanogui::Slider *point1Y;
nanogui::Slider *point2X;
nanogui::Slider *point2Y;
nanogui::Slider *point3X;
nanogui::Slider *point3Y;
2018-10-21 14:18:27 +00:00
2018-09-06 12:35:43 +00:00
// The following variables hold OpenGL object IDs
2018-11-26 16:58:30 +00:00
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
2018-09-06 12:35:43 +00:00
uv_map_buffer_id; // ID of the uv_map
2018-10-17 11:00:47 +00:00
GLint view_uniform_id;
GLint proj_uniform_id;
2018-10-17 14:39:10 +00:00
GLint julia_m_id;
GLint julia_c_id;
2018-10-17 11:00:47 +00:00
2018-10-21 14:18:27 +00:00
GLint julia_pos_id;
2018-11-26 16:58:30 +00:00
// Read, Compile and link the shader codes to a shader program
2018-09-06 12:35:43 +00:00
void CreateShaders();
// Create and define the vertex array and add a number of vertex buffers
void CreateVertexBuffers();
};