Skip to content

Commit

Permalink
[wip] shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
rxdu committed Nov 2, 2024
1 parent bdec33f commit 9ffce16
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/imview/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ add_library(imview
src/fonts.cpp
src/scene_object.cpp
src/panel.cpp
${AUTO_LAYOUT_SRC}
src/layer.cpp
${AUTO_LAYOUT_SRC}
# src/popup.cpp
src/buffer/scrolling_plot_buffer.cpp
# utils
src/utils/image_utils.cpp
# widgets
Expand All @@ -37,8 +36,10 @@ add_library(imview
src/widget/rt_line_plot_widget.cpp
src/widget/gl_scene_widget.cpp
src/widget/details/gl_frame_buffer.cpp
src/widget/details/shader.cpp
# data buffer
src/buffer/buffer_registry.cpp
src/buffer/scrolling_plot_buffer.cpp
# event handling
src/event/event_dispatcher.cpp
src/event/async_event_dispatcher.cpp
Expand Down
44 changes: 44 additions & 0 deletions src/imview/include/imview/widget/details/shader.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* @file shader.hpp
* @date 11/2/24
* @brief
*
* @copyright Copyright (c) 2024 Ruixiang Du (rdu)
*/

#ifndef XMOTION_SHADER_HPP
#define XMOTION_SHADER_HPP

#include <string>
#include <unordered_map>

#include <glm/glm.hpp>

#include "glad/glad.h"

namespace quickviz {
class Shader {
public:
enum class Type {
kUnknown = 0,
kVertex,
kFragment,
};

public:
Shader(const std::string& source, Type type);
~Shader();

// public methods
void Compile();
GLuint GetShaderID() const { return shader_id_; }

private:
std::string LoadSourceFile(const std::string& file_path);

GLuint shader_id_;
Type type_;
};
} // namespace quickviz

#endif // XMOTION_SHADER_HPP
11 changes: 11 additions & 0 deletions src/imview/src/widget/details/shader.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* @file shader.cpp
* @date 11/2/24
* @brief
*
* @copyright Copyright (c) 2024 Ruixiang Du (rdu)
*/

#include "imview/widget/details/shader.hpp"

namespace quickviz {} // namespace quickviz

0 comments on commit 9ffce16

Please sign in to comment.