Skip to content
Snippets Groups Projects
Commit f9d0272c authored by Philip Trettner's avatar Philip Trettner
Browse files

preparing live coding 1

parent baccaded
No related branches found
No related tags found
No related merge requests found
......@@ -55,3 +55,4 @@ add_subdirectory(extern/glow-extras)
# Live coding sessions
add_subdirectory(rtglive0)
add_subdirectory(rtglive1)
glow-extras @ 60463923
Subproject commit 4f3ad6e165d1ff6227e73734ebda9945bcb8c5b7
Subproject commit 604639239f867fe988208d370aa1f539981a2314
typed-geometry @ 53b43d82
Subproject commit 67ad9a0b5013299e7ef19de751ad5b72027cec1a
Subproject commit 53b43d82d92c1d7e4768c09824c1e437efd0be46
......@@ -10,9 +10,9 @@ file(GLOB_RECURSE SOURCES
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
add_executable(${PROJECT_NAME} ${SOURCES})
add_executable(rtglive0 ${SOURCES})
target_link_libraries(${PROJECT_NAME} PUBLIC
target_link_libraries(rtglive0 PUBLIC
glow
glow-extras
typed-geometry
......@@ -20,22 +20,22 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
imgui
)
target_include_directories(${PROJECT_NAME} PUBLIC "src")
target_include_directories(rtglive0 PUBLIC "src")
# ===============================================
# Compile flags
if (MSVC)
target_compile_options(${PROJECT_NAME} PUBLIC
target_compile_options(rtglive0 PUBLIC
/MP
)
else()
target_compile_options(${PROJECT_NAME} PUBLIC
target_compile_options(rtglive0 PUBLIC
-Wall
-Wno-unused-variable
)
target_link_libraries(${PROJECT_NAME} PUBLIC
target_link_libraries(rtglive0 PUBLIC
-lstdc++fs
)
endif()
# ===============================================
# Configure executable
file(GLOB_RECURSE SOURCES
"src/*.cc"
"src/*.hh"
"data/*.*sh"
"data/*.glsl"
)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
add_executable(rtglive1 ${SOURCES})
target_link_libraries(rtglive1 PUBLIC
glow
glow-extras
typed-geometry
ctracer
imgui
)
target_include_directories(rtglive1 PUBLIC "src")
# ===============================================
# Compile flags
if (MSVC)
target_compile_options(rtglive1 PUBLIC
/MP
)
else()
target_compile_options(rtglive1 PUBLIC
-Wall
-Wno-unused-variable
)
target_link_libraries(rtglive1 PUBLIC
-lstdc++fs
)
endif()
#include "LiveApp.hh"
#include <imgui/imgui.h>
#include <GLFW/glfw3.h>
#include <typed-geometry/tg.hh>
#include <glow-extras/vector/backend/opengl.hh>
#include <glow-extras/vector/graphics2D.hh>
#include <glow-extras/vector/image2D.hh>
#include <glow/common/scoped_gl.hh>
void LiveApp::init()
{
setGui(Gui::ImGui);
GlfwApp::init();
}
void LiveApp::update(float elapsedSeconds)
{
// TODO
}
void LiveApp::render(float elapsedSeconds)
{
auto const w = getWindowWidth();
auto const h = getWindowHeight();
// clear screen
GLOW_SCOPED(clearColor, tg::color3::black);
glViewport(0, 0, w, h);
glClear(GL_COLOR_BUFFER_BIT);
mImage.clear();
auto g = graphics(mImage);
// render scene
// TODO
// render vector image
mRenderer.render(mImage, w, h);
}
void LiveApp::onGui()
{
// TODO
}
bool LiveApp::onKey(int key, int scancode, int action, int mods)
{
// TODO
return false;
}
#pragma once
#include <glow-extras/glfw/GlfwApp.hh>
#include <glow-extras/vector/backend/opengl.hh>
#include <glow-extras/vector/image2D.hh>
#include <typed-geometry/tg-lean.hh>
class LiveApp : public glow::glfw::GlfwApp
{
glow::vector::OGLRenderer mRenderer;
glow::vector::image2D mImage;
public:
void init() override;
void update(float elapsedSeconds) override;
void render(float elapsedSeconds) override;
void onGui() override;
bool onKey(int key, int scancode, int action, int mods) override;
};
#include "LiveApp.hh"
int main()
{
LiveApp app;
app.run();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment