Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
c5e45ef31a |
8
Makefile
8
Makefile
@ -21,11 +21,11 @@ SOURCES += $(wildcard $(IMGUI_DIR)/*.cpp)
|
|||||||
SOURCES += $(wildcard $(IMGUI_DIR)/backends/*.cpp)
|
SOURCES += $(wildcard $(IMGUI_DIR)/backends/*.cpp)
|
||||||
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
LINUX_GL_LIBS = -lGL
|
LINUX_GL_LIBS = -lGL -lGLEW
|
||||||
|
|
||||||
CXXFLAGS = -std=c++20 -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends
|
CXXFLAGS = -std=c++20 -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends
|
||||||
CXXFLAGS += -g -DIMGUI_DEFINE_MATH_OPERATORS -Ofast -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_CHANNEL_MASK_DEPTH=32 -I/opt/homebrew/Cellar/imagemagick/7.1.1-32/include/ImageMagick-7
|
CXXFLAGS += -g -DIMGUI_DEFINE_MATH_OPERATORS
|
||||||
LIBS = -L/opt/homebrew/Cellar/imagemagick/7.1.1-32/lib -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI
|
LIBS =
|
||||||
|
|
||||||
##---------------------------------------------------------------------
|
##---------------------------------------------------------------------
|
||||||
## OPENGL ES
|
## OPENGL ES
|
||||||
@ -52,7 +52,7 @@ endif
|
|||||||
|
|
||||||
ifeq ($(UNAME_S), Darwin) #APPLE
|
ifeq ($(UNAME_S), Darwin) #APPLE
|
||||||
ECHO_MESSAGE = "Mac OS X"
|
ECHO_MESSAGE = "Mac OS X"
|
||||||
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs`
|
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs` -lGLEW
|
||||||
LIBS += -L/usr/local/lib -L/opt/local/lib
|
LIBS += -L/usr/local/lib -L/opt/local/lib
|
||||||
|
|
||||||
CXXFLAGS += `sdl2-config --cflags`
|
CXXFLAGS += `sdl2-config --cflags`
|
||||||
|
@ -32,7 +32,7 @@ EMS =
|
|||||||
##---------------------------------------------------------------------
|
##---------------------------------------------------------------------
|
||||||
|
|
||||||
# ("EMS" options gets added to both CPPFLAGS and LDFLAGS, whereas some options are for linker only)
|
# ("EMS" options gets added to both CPPFLAGS and LDFLAGS, whereas some options are for linker only)
|
||||||
EMS += -s USE_SDL=2 -flto -O2
|
EMS += -s USE_SDL=2 -flto -O2 -s USE_WEBGL2=1
|
||||||
EMS += -s DISABLE_EXCEPTION_CATCHING=1
|
EMS += -s DISABLE_EXCEPTION_CATCHING=1
|
||||||
LDFLAGS += -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_EXIT_RUNTIME=0 -s ASSERTIONS=1 -sEXPORTED_FUNCTIONS=[_main,_malloc,_free] -sEXPORTED_RUNTIME_METHODS=[ccall]
|
LDFLAGS += -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_EXIT_RUNTIME=0 -s ASSERTIONS=1 -sEXPORTED_FUNCTIONS=[_main,_malloc,_free] -sEXPORTED_RUNTIME_METHODS=[ccall]
|
||||||
|
|
||||||
|
58
lib/FrameBuffer.cpp
Normal file
58
lib/FrameBuffer.cpp
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// FrameBuffer.cpp
|
||||||
|
|
||||||
|
#include "FrameBuffer.h"
|
||||||
|
|
||||||
|
FrameBuffer::FrameBuffer(float width, float height) {
|
||||||
|
glGenFramebuffers(1, &fbo);
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||||
|
|
||||||
|
glGenTextures(1, &texture);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB,
|
||||||
|
GL_UNSIGNED_BYTE, NULL);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
||||||
|
texture, 0);
|
||||||
|
|
||||||
|
glGenRenderbuffers(1, &rbo);
|
||||||
|
glBindRenderbuffer(GL_RENDERBUFFER, rbo);
|
||||||
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height);
|
||||||
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
|
||||||
|
GL_RENDERBUFFER, rbo);
|
||||||
|
|
||||||
|
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||||
|
std::cout << "ERROR::FRAMEBUFFER:: Framebuffer is not complete!"
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
FrameBuffer::~FrameBuffer() {
|
||||||
|
glDeleteFramebuffers(1, &fbo);
|
||||||
|
glDeleteTextures(1, &texture);
|
||||||
|
glDeleteRenderbuffers(1, &rbo);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int FrameBuffer::getFrameTexture() { return texture; }
|
||||||
|
|
||||||
|
void FrameBuffer::RescaleFrameBuffer(float width, float height) {
|
||||||
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB,
|
||||||
|
GL_UNSIGNED_BYTE, NULL);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
||||||
|
texture, 0);
|
||||||
|
|
||||||
|
glBindRenderbuffer(GL_RENDERBUFFER, rbo);
|
||||||
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height);
|
||||||
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
|
||||||
|
GL_RENDERBUFFER, rbo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrameBuffer::Bind() const { glBindFramebuffer(GL_FRAMEBUFFER, fbo); }
|
||||||
|
|
||||||
|
void FrameBuffer::Unbind() const { glBindFramebuffer(GL_FRAMEBUFFER, 0); }
|
38
lib/FrameBuffer.h
Normal file
38
lib/FrameBuffer.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// FrameBuffer.h
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
#else
|
||||||
|
#include "GL/glew.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <iostream>
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
|
#include <SDL2/SDL_opengles.h>
|
||||||
|
#else
|
||||||
|
#include <SDL2/SDL_opengl.h>
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <SDL.h>
|
||||||
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
|
#include <SDL_opengles2.h>
|
||||||
|
#else
|
||||||
|
#include <SDL_opengl.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class FrameBuffer {
|
||||||
|
public:
|
||||||
|
FrameBuffer(float width, float height);
|
||||||
|
~FrameBuffer();
|
||||||
|
unsigned int getFrameTexture();
|
||||||
|
void RescaleFrameBuffer(float width, float height);
|
||||||
|
void Bind() const;
|
||||||
|
void Unbind() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int fbo;
|
||||||
|
unsigned int texture;
|
||||||
|
unsigned int rbo;
|
||||||
|
};
|
@ -1,6 +1,6 @@
|
|||||||
|
#include <cstdint>
|
||||||
#include "../ImNodeFlow.h"
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
@ -20,17 +20,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../ImNodeFlow.h"
|
||||||
#include "../image_model.h"
|
#include "../image_model.h"
|
||||||
#include "../imfilebrowser.h"
|
#include "../imfilebrowser.h"
|
||||||
#include "../stb_image.h"
|
#include "../stb_image.h"
|
||||||
#include "../uuid.h"
|
#include "../uuid.h"
|
||||||
#include <cstdint>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <ImageMagick-7/Magick++.h>
|
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
using namespace std::chrono;
|
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
#include "../emscripten_browser_file.h"
|
#include "../emscripten_browser_file.h"
|
||||||
@ -59,7 +53,11 @@ public:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
~Exposure() { stbi_image_free(returnBundle.image); }
|
~Exposure() {
|
||||||
|
if (returnBundle.loaded) {
|
||||||
|
stbi_image_free(returnBundle.image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void draw() override {
|
void draw() override {
|
||||||
ImGui::SetNextItemWidth(100);
|
ImGui::SetNextItemWidth(100);
|
||||||
@ -163,7 +161,11 @@ public:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
~Contrast() { stbi_image_free(returnBundle.image); }
|
~Contrast() {
|
||||||
|
if (returnBundle.loaded) {
|
||||||
|
stbi_image_free(returnBundle.image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void draw() override {
|
void draw() override {
|
||||||
ImGui::SetNextItemWidth(100);
|
ImGui::SetNextItemWidth(100);
|
||||||
@ -239,34 +241,16 @@ private:
|
|||||||
return static_cast<int>(ret_val);
|
return static_cast<int>(ret_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void adjustContrast(uint8_t *pixels, uint8_t *out, int width, int height,
|
|
||||||
double contrastValue) {
|
|
||||||
// Initialize Magick library
|
|
||||||
Magick::InitializeMagick(nullptr);
|
|
||||||
|
|
||||||
// Create a Magick::Image object from the uint8_t* data
|
|
||||||
Magick::Image image(width, height, "RGBA", Magick::CharPixel, pixels);
|
|
||||||
|
|
||||||
// Apply contrast adjustment
|
|
||||||
auto start = high_resolution_clock::now();
|
|
||||||
image.sigmoidalContrast(true, contrastValue); // Increase contrast
|
|
||||||
auto stop = high_resolution_clock::now();
|
|
||||||
auto duration = duration_cast<microseconds>(stop - start);
|
|
||||||
std::cout << duration.count() << std::endl;
|
|
||||||
|
|
||||||
start = high_resolution_clock::now();
|
|
||||||
Magick::Blob blob;
|
|
||||||
image.write(&blob);
|
|
||||||
memcpy(out, blob.data(), width * height * 4);
|
|
||||||
stop = high_resolution_clock::now();
|
|
||||||
duration = duration_cast<microseconds>(stop - start);
|
|
||||||
std::cout << duration.count() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void compute(uint8_t *input, uint8_t *output, int size, int channels) {
|
void compute(uint8_t *input, uint8_t *output, int size, int channels) {
|
||||||
int nBval = brightnessVal + 256;
|
int nBval = brightnessVal + 256;
|
||||||
adjustContrast(input, output, returnBundle.width, returnBundle.height,
|
for (int i = 0; i < size; i += channels) {
|
||||||
nBval);
|
uint8_t r = std::clamp(formula(input[i], brightnessVal), 0, 255);
|
||||||
|
uint8_t g = std::clamp(formula(input[i + 1], brightnessVal), 0, 255);
|
||||||
|
uint8_t b = std::clamp(formula(input[i + 2], brightnessVal), 0, 255);
|
||||||
|
output[i] = r;
|
||||||
|
output[i + 1] = g;
|
||||||
|
output[i + 2] = b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int brightnessVal = 0;
|
int brightnessVal = 0;
|
||||||
@ -286,7 +270,11 @@ public:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
~SimpleBrightness() { stbi_image_free(returnBundle.image); }
|
~SimpleBrightness() {
|
||||||
|
if (returnBundle.loaded) {
|
||||||
|
stbi_image_free(returnBundle.image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void draw() override {
|
void draw() override {
|
||||||
ImGui::SetNextItemWidth(100);
|
ImGui::SetNextItemWidth(100);
|
||||||
@ -490,8 +478,8 @@ public:
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (bundle.fname == "") {
|
if (bundle.fname == "") {
|
||||||
handle_upload_file_local("/Users/tanishqdubey/Pictures/DSC06956.JPG",
|
handle_upload_file_local(
|
||||||
this);
|
"/Users/tanishqdubey/Downloads/Odd-eyed_cat_by_ihasb33r.jpg", this);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (bundle.fname != "") {
|
if (bundle.fname != "") {
|
||||||
|
148
main.cpp
148
main.cpp
@ -8,6 +8,13 @@
|
|||||||
// - Documentation https://dearimgui.com/docs (same as your local docs/
|
// - Documentation https://dearimgui.com/docs (same as your local docs/
|
||||||
// folder).
|
// folder).
|
||||||
// - Introduction, links and more at the top of imgui.cpp
|
// - Introduction, links and more at the top of imgui.cpp
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
#else
|
||||||
|
#include "GL/glew.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||||
@ -43,13 +50,138 @@
|
|||||||
#include "lib/emscripten/emscripten_mainloop_stub.h"
|
#include "lib/emscripten/emscripten_mainloop_stub.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "lib/FrameBuffer.h"
|
||||||
#include "lib/ImNodeFlow.h"
|
#include "lib/ImNodeFlow.h"
|
||||||
#include <ImageMagick-7/Magick++.h>
|
|
||||||
|
|
||||||
static bool init = true;
|
static bool init = true;
|
||||||
|
|
||||||
|
GLuint initShader(const char *vShader, const char *fShader,
|
||||||
|
const char *outputAttributeName) {
|
||||||
|
struct Shader {
|
||||||
|
GLenum type;
|
||||||
|
const char *source;
|
||||||
|
} shaders[2] = {{GL_VERTEX_SHADER, vShader}, {GL_FRAGMENT_SHADER, fShader}};
|
||||||
|
|
||||||
|
GLuint program = glCreateProgram();
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; ++i) {
|
||||||
|
Shader &s = shaders[i];
|
||||||
|
GLuint shader = glCreateShader(s.type);
|
||||||
|
glShaderSource(shader, 1, (const GLchar **)&s.source, NULL);
|
||||||
|
glCompileShader(shader);
|
||||||
|
|
||||||
|
GLint compiled;
|
||||||
|
glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
|
||||||
|
if (!compiled) {
|
||||||
|
std::cerr << " failed to compile:" << std::endl;
|
||||||
|
GLint logSize;
|
||||||
|
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &logSize);
|
||||||
|
char *logMsg = new char[logSize];
|
||||||
|
glGetShaderInfoLog(shader, logSize, NULL, logMsg);
|
||||||
|
std::cerr << logMsg << std::endl;
|
||||||
|
delete[] logMsg;
|
||||||
|
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
glAttachShader(program, shader);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Link output */
|
||||||
|
#ifndef EMSCRIPTEN
|
||||||
|
glBindFragDataLocation(program, 0, outputAttributeName);
|
||||||
|
#endif
|
||||||
|
/* link and error check */
|
||||||
|
glLinkProgram(program);
|
||||||
|
|
||||||
|
GLint linked;
|
||||||
|
glGetProgramiv(program, GL_LINK_STATUS, &linked);
|
||||||
|
if (!linked) {
|
||||||
|
std::cerr << "Shader program failed to link" << std::endl;
|
||||||
|
GLint logSize;
|
||||||
|
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &logSize);
|
||||||
|
char *logMsg = new char[logSize];
|
||||||
|
glGetProgramInfoLog(program, logSize, NULL, logMsg);
|
||||||
|
std::cerr << logMsg << std::endl;
|
||||||
|
delete[] logMsg;
|
||||||
|
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* use program object */
|
||||||
|
glUseProgram(program);
|
||||||
|
|
||||||
|
return program;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t loadShader() {
|
||||||
|
#ifdef EMSCRIPTEN
|
||||||
|
const char *vert = R"(#version 100
|
||||||
|
uniform vec2 offset;
|
||||||
|
attribute vec4 position;
|
||||||
|
attribute vec2 uv;
|
||||||
|
varying vec2 vUV;
|
||||||
|
void main (void)
|
||||||
|
{
|
||||||
|
vUV = uv;
|
||||||
|
gl_Position = position + vec4(offset,0.0,0.0);
|
||||||
|
})";
|
||||||
|
#else
|
||||||
|
const char *vert = R"(#version 150
|
||||||
|
uniform vec2 offset;
|
||||||
|
in vec4 position;
|
||||||
|
in vec2 uv;
|
||||||
|
|
||||||
|
out vec2 vUV;
|
||||||
|
|
||||||
|
void main (void)
|
||||||
|
{
|
||||||
|
vUV = uv;
|
||||||
|
gl_Position = position + vec4(offset,0.0,0.0);
|
||||||
|
})";
|
||||||
|
#endif
|
||||||
|
#ifdef EMSCRIPTEN
|
||||||
|
const char *frag = R"(#version 100
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
varying vec2 vUV;
|
||||||
|
uniform sampler2D tex;
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
gl_FragColor = texture2D(tex,vUV);
|
||||||
|
})";
|
||||||
|
#else
|
||||||
|
const char *frag = R"(#version 150
|
||||||
|
in vec2 vUV;
|
||||||
|
out vec4 fragColor;
|
||||||
|
uniform sampler2D tex;
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
fragColor = texture(tex,vUV);
|
||||||
|
})";
|
||||||
|
#endif
|
||||||
|
std::cout << "Starting to init" << std::endl;
|
||||||
|
uint8_t shaderProgram = initShader(vert, frag, "fragColor");
|
||||||
|
std::cout << "done to init" << std::endl;
|
||||||
|
|
||||||
|
uint8_t uvAttribute = glGetAttribLocation(shaderProgram, "uv");
|
||||||
|
if (uvAttribute < 0) {
|
||||||
|
std::cerr << "Shader did not contain the 'color' attribute." << std::endl;
|
||||||
|
}
|
||||||
|
uint8_t positionAttribute = glGetAttribLocation(shaderProgram, "position");
|
||||||
|
if (positionAttribute < 0) {
|
||||||
|
std::cerr << "Shader did not contain the 'position' attribute."
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return shaderProgram;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t setup() { return loadShader(); }
|
||||||
|
|
||||||
// Main code
|
// Main code
|
||||||
int main(int, char **argv) {
|
int main(int, char **) {
|
||||||
// Setup SDL
|
// Setup SDL
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) !=
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) !=
|
||||||
0) {
|
0) {
|
||||||
@ -57,8 +189,6 @@ int main(int, char **argv) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Magick::InitializeMagick(*argv);
|
|
||||||
|
|
||||||
// Decide GL+GLSL versions
|
// Decide GL+GLSL versions
|
||||||
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
// GL ES 2.0 + GLSL 100
|
// GL ES 2.0 + GLSL 100
|
||||||
@ -142,7 +272,9 @@ int main(int, char **argv) {
|
|||||||
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
||||||
ImFlow::ImNodeFlow editor = ImFlow::ImNodeFlow("Nodes");
|
ImFlow::ImNodeFlow editor = ImFlow::ImNodeFlow("Nodes");
|
||||||
|
|
||||||
|
uint8_t shader = 0;
|
||||||
// Main loop
|
// Main loop
|
||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
// For an Emscripten build we are disabling file-system access, so let's not
|
// For an Emscripten build we are disabling file-system access, so let's not
|
||||||
@ -204,6 +336,8 @@ int main(int, char **argv) {
|
|||||||
ImGui::DockBuilderSetNodeSize(dockspace_id, viewport->Size);
|
ImGui::DockBuilderSetNodeSize(dockspace_id, viewport->Size);
|
||||||
ImGui::DockBuilderDockWindow("Editor", dockspace_id);
|
ImGui::DockBuilderDockWindow("Editor", dockspace_id);
|
||||||
ImGui::DockBuilderFinish(dockspace_id);
|
ImGui::DockBuilderFinish(dockspace_id);
|
||||||
|
|
||||||
|
// setup_shaders();
|
||||||
}
|
}
|
||||||
if (ImGui::BeginMainMenuBar()) {
|
if (ImGui::BeginMainMenuBar()) {
|
||||||
if (ImGui::BeginMenu("Add")) {
|
if (ImGui::BeginMenu("Add")) {
|
||||||
@ -233,6 +367,12 @@ int main(int, char **argv) {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
|
if (shader != 0) {
|
||||||
|
ImGui::Begin("Shader test");
|
||||||
|
ImGui::Text("Shader ID: %d", shader);
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
|
Reference in New Issue
Block a user