Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e309f5369e | ||
|
|
5129eb207b | ||
|
|
22f7af4cf7 | ||
|
|
82d1cb97a1 | ||
|
|
c538021666 | ||
|
|
b749254426 | ||
|
|
ceb538aafe | ||
|
|
34eca0d0af | ||
|
|
9cb2b0f8e8 | ||
|
|
449060a463 |
138
img/foregrounds/deadpool.gifv
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Imgur</title>
|
||||||
|
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
||||||
|
<meta name="copyright" content="Copyright 2016 Imgur, Inc." />
|
||||||
|
<meta id="viewport" name="viewport" content="width=1280, user-scalable=yes" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="//s.imgur.com/min/sharePlayer.css?1473720239" />
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
#content, #video {
|
||||||
|
width: 1280px;
|
||||||
|
height: 720px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chrome, #progress {
|
||||||
|
width: 1280px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<link rel="alternate" type="application/json+oembed" href="http://api.imgur.com/oembed.json?url=http://i.imgur.com/9C2DZaI.gifv" title="Imgur GIF" />
|
||||||
|
<link rel="alternate" type="application/xml+oembed" href="http://api.imgur.com/oembed.xml?url=http://i.imgur.com/9C2DZaI.gifv" title="Imgur GIF" />
|
||||||
|
|
||||||
|
<link rel="canonical" href="http://i.imgur.com/9C2DZaI.gifv" />
|
||||||
|
|
||||||
|
<meta property="og:site_name" content="Imgur" />
|
||||||
|
<meta property="og:title" content="Imgur GIF" />
|
||||||
|
<meta property="og:type" content="video.other" />
|
||||||
|
<meta property="og:url" content="https://i.imgur.com/9C2DZaI.mp4" />
|
||||||
|
<meta property="og:image" content="https://i.imgur.com/9C2DZaIh.jpg" />
|
||||||
|
<meta property="og:description" content="Imgur: The most awesome images on the Internet." />
|
||||||
|
<meta property="og:video:width" content="1280" />
|
||||||
|
<meta property="og:video:height" content="720" />
|
||||||
|
<meta property="og:video" content="https://i.imgur.com/9C2DZaI.mp4" />
|
||||||
|
<meta property="og:video:secure_url" content="https://i.imgur.com/9C2DZaI.mp4" />
|
||||||
|
<meta property="og:video:type" content="video/mp4" />
|
||||||
|
|
||||||
|
|
||||||
|
<meta name="twitter:site" content="@imgur" />
|
||||||
|
<meta name="twitter:domain" content="imgur.com" />
|
||||||
|
<meta name="twitter:app:id:googleplay" content="com.imgur.mobile" />
|
||||||
|
<meta name="twitter:card" content="player" />
|
||||||
|
<meta name="twitter:title" content="Imgur GIF" />
|
||||||
|
<meta name="twitter:description" content="Imgur: The most awesome images on the Internet." />
|
||||||
|
<meta name="twitter:image" content="https://i.imgur.com/9C2DZaIh.jpg" />
|
||||||
|
<meta name="twitter:player" content="https://i.imgur.com/9C2DZaI.gifv?twitter#t" />
|
||||||
|
<meta name="twitter:player:width" content="1280" />
|
||||||
|
<meta name="twitter:player:height" content="720" />
|
||||||
|
<meta name="twitter:player:stream" content="https://i.imgur.com/9C2DZaI.mp4" />
|
||||||
|
<meta name="twitter:player:stream:content_type" content="video/mp4">
|
||||||
|
|
||||||
|
<!--[if lte IE 8]><script type="text/javascript" src="//s.imgur.com/min/iepoly.js?1473720239"></script>
|
||||||
|
<![endif]-->
|
||||||
|
</head>
|
||||||
|
<body id="body">
|
||||||
|
<div id="content">
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.image = '9C2DZaI';
|
||||||
|
window.image_size = '30908885';
|
||||||
|
window.image_width = '1280';
|
||||||
|
window.image_height = '720';
|
||||||
|
window.cdn_url = '//i.imgur.com';
|
||||||
|
|
||||||
|
if(navigator.userAgent.match(/Firefox/)) {
|
||||||
|
document.body.className = document.body.className + ' firefox';
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<div class="vid-container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="post-image">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="video-container">
|
||||||
|
<script type="text/javascript">
|
||||||
|
var videoItem = {
|
||||||
|
looping: true,
|
||||||
|
width: 1280,
|
||||||
|
height: 720,
|
||||||
|
size: 30908885,
|
||||||
|
gifUrl: '//i.imgur.com/9C2DZaI.gif',
|
||||||
|
forceGif: false,
|
||||||
|
prefer_video: true,
|
||||||
|
hash: '9C2DZaI'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<video poster="//i.imgur.com/9C2DZaIh.jpg" preload="auto" autoplay="autoplay" muted="muted" loop="loop" webkit-playsinline></video>
|
||||||
|
<div class="video-elements">
|
||||||
|
<source src="//i.imgur.com/9C2DZaI.mp4" type="video/mp4">
|
||||||
|
</div>
|
||||||
|
<progress value="0" max="100" min="0"></progress>
|
||||||
|
<div class="video-loader"></div>
|
||||||
|
<script id="script9C2DZaI" type="text/javascript" src="//s.imgur.com/min/imageViewerInline.js?1473720239"></script>
|
||||||
|
|
||||||
|
<meta itemprop="thumbnailUrl" content="https://i.imgur.com/9C2DZaIh.jpg" />
|
||||||
|
<meta itemprop="contentURL" content="https://i.imgur.com/9C2DZaI.mp4" />
|
||||||
|
<meta itemprop="embedURL" content="https://i.imgur.com/9C2DZaI.gifv" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var pixel_url = '//i.imgur.com/imageview.gif?a=9C2DZaI&r=' + encodeURIComponent(document.referrer);
|
||||||
|
var pixel = document.createElement('img');
|
||||||
|
pixel.src = pixel_url;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div id="chrome">
|
||||||
|
<div class="icon">
|
||||||
|
<a href="//imgur.com/9C2DZaI"><img src="//i.imgur.com/favicon.ico" /></a>
|
||||||
|
</div>
|
||||||
|
<div class="imgur">
|
||||||
|
<a href="//imgur.com/9C2DZaI">Imgur</a>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<a href="//imgur.com/download/9C2DZaI">download</a>
|
||||||
|
</div>
|
||||||
|
<div class="clear"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript" src="//s.imgur.com/min/sharePlayer.js?1473720239"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var _comscore = _comscore || [];
|
||||||
|
_comscore.push({ c1: "2", c2: "7770950" });
|
||||||
|
(function() {
|
||||||
|
var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true;
|
||||||
|
s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js";
|
||||||
|
el.parentNode.insertBefore(s, el);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<noscript>
|
||||||
|
<img src="http://b.scorecardresearch.com/p?c1=2&c2=7770950&cv=2.0&cj=1" />
|
||||||
|
</noscript>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
img/foregrounds/original-reference/0.jpg
Normal file
|
After Width: | Height: | Size: 820 KiB |
BIN
img/foregrounds/original-reference/0.tiff
Normal file
BIN
img/foregrounds/static-man/0.jpg
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
img/foregrounds/static-plane1/0.jpg
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
img/foregrounds/static-plane2/0.jpg
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
img/foregrounds/surfing.gif
Normal file
|
After Width: | Height: | Size: 743 KiB |
BIN
img/foregrounds/surfing/0.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
img/foregrounds/surfing/1.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
img/foregrounds/surfing/2.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
img/foregrounds/surfing/3.jpg
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
img/foregrounds/surfing/4.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
img/foregrounds/surfing/5.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
img/foregrounds/surfing/6.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
img/foregrounds/surfing/7.jpg
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
img/foregrounds/surfing/8.jpg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
img/foregrounds/surfing/9.jpg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
img/results/original-reference/alpha.PNG
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
img/results/original-reference/done.PNG
Normal file
|
After Width: | Height: | Size: 3.2 MiB |
BIN
img/results/original-reference/trimap.PNG
Normal file
|
After Width: | Height: | Size: 31 KiB |
@@ -1,16 +1,15 @@
|
|||||||
// http://stackoverflow.com/questions/6005076/building-glew-on-windows-with-mingw
|
|
||||||
|
|
||||||
#define GLEW_STATIC
|
#define GLEW_STATIC
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <dirent.h>
|
||||||
#include "loaders.h"
|
#include "loaders.h"
|
||||||
|
|
||||||
int main(int argc, char* args[]) {
|
int main(int argc, char* args[]) {
|
||||||
GLFWwindow* window;
|
GLFWwindow* window;
|
||||||
GLuint texFG, texBG;
|
GLuint texBG;
|
||||||
int textw, texth;
|
int textw, texth;
|
||||||
int textw2, texth2;
|
int textw2, texth2;
|
||||||
|
|
||||||
@@ -23,7 +22,6 @@ int main(int argc, char* args[]) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* Create a windowed mode window and its OpenGL context */
|
/* Create a windowed mode window and its OpenGL context */
|
||||||
glfwSetWindowSizeLimits(window, 640, 480, 640, 480);
|
|
||||||
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
|
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
|
||||||
if (!window) {
|
if (!window) {
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
@@ -52,6 +50,11 @@ int main(int argc, char* args[]) {
|
|||||||
}
|
}
|
||||||
// INIT
|
// INIT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// An array of 3 vectors which represents 3 vertices
|
// An array of 3 vectors which represents 3 vertices
|
||||||
static const GLfloat g_vertex_buffer_data[] = {
|
static const GLfloat g_vertex_buffer_data[] = {
|
||||||
-1.0f, -1.0f, 0.0f, // (bottom - left ) TRIANGLE 1
|
-1.0f, -1.0f, 0.0f, // (bottom - left ) TRIANGLE 1
|
||||||
@@ -78,93 +81,130 @@ int main(int argc, char* args[]) {
|
|||||||
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);
|
||||||
|
|
||||||
// Identify our color buffer
|
// Identify our texture coordinate buffer
|
||||||
GLuint colorbuffer;
|
GLuint colorbuffer;
|
||||||
glGenBuffers(1, &colorbuffer);
|
glGenBuffers(1, &colorbuffer);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(g_uv_buffer_data), g_uv_buffer_data, GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(g_uv_buffer_data), g_uv_buffer_data, GL_STATIC_DRAW);
|
||||||
|
|
||||||
// The framebuffer, which regroups 0, 1, or more textures, and 0 or 1 depth buffer.
|
// The framebuffer, which regroups one texture, and zero depth buffer.
|
||||||
GLuint FramebufferName;
|
GLuint FramebufferName;
|
||||||
glGenFramebuffers(1, &FramebufferName);
|
glGenFramebuffers(1, &FramebufferName);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);
|
glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);
|
||||||
|
|
||||||
|
// load foreground and background textures
|
||||||
|
int lenTexFG = 1;
|
||||||
|
GLint texFGs[lenTexFG];
|
||||||
|
char buffer[50];
|
||||||
texBG = LoadTexture("../img/backgrounds/sky.jpg",&textw2,&texth2);
|
texBG = LoadTexture("../img/backgrounds/sky.jpg",&textw2,&texth2);
|
||||||
texFG = LoadTexture("../img/tests/flieger.jpg",&textw,&texth);
|
for (int i=0; i<lenTexFG; i++) {
|
||||||
printf("Tex1: %d\n", texFG);
|
snprintf(buffer, sizeof(buffer), "../img/foregrounds/original-reference/%d.jpg", i);
|
||||||
glfwSetWindowSize(window, textw, texth);
|
texFGs[i] = LoadTexture(buffer,&textw,&texth);
|
||||||
glViewport(0, 0, textw, texth);
|
}
|
||||||
glfwSetWindowSizeLimits(window, textw, texth, textw, texth);
|
|
||||||
|
|
||||||
// The texture we're going to render to
|
// Generate texture for frame buffer
|
||||||
GLuint renderedTexture;
|
GLuint renderedTexture;
|
||||||
glGenTextures(1, &renderedTexture);
|
glGenTextures(1, &renderedTexture);
|
||||||
glBindTexture(GL_TEXTURE_2D, renderedTexture);
|
glBindTexture(GL_TEXTURE_2D, renderedTexture);
|
||||||
|
// Load texture and set filtering
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, textw, texth, 0,GL_RGB, GL_UNSIGNED_BYTE, 0);
|
glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, textw, texth, 0,GL_RGB, GL_UNSIGNED_BYTE, 0);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
|
|
||||||
// Set "renderedTexture" as our colour attachement #2
|
// Set "renderedTexture" as our color attachment #2 (render to location 2)
|
||||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, renderedTexture, 0);
|
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, renderedTexture, 0);
|
||||||
// Set the list of draw buffers.
|
// Set the list of draw buffers
|
||||||
GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT2};
|
GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT2};
|
||||||
glDrawBuffers(1, DrawBuffers); // "1" is the size of DrawBuffers
|
glDrawBuffers(1, DrawBuffers); // "1" is the size of DrawBuffers
|
||||||
|
|
||||||
// Always check that our framebuffer is ok
|
// Always check that our frame buffer is ok
|
||||||
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Set window size to texture size (window size, opengl context size, resize constraints)
|
||||||
|
glfwSetWindowSize(window, textw, texth);
|
||||||
|
glViewport(0, 0, textw, texth);
|
||||||
|
glfwSetWindowSizeLimits(window, textw, texth, textw, texth);
|
||||||
|
|
||||||
GLuint programID = LoadShaders("trimap.vertexshader", "trimap.fragmentshader");
|
// Load shader programs
|
||||||
GLuint programRefineID = LoadShaders("refinement.vertexshader", "refinement.fragmentshader");
|
GLuint progTrimapID = LoadShaders("trimap.vertexshader", "trimap.fragmentshader");
|
||||||
GLint textureLoc1 = glGetUniformLocation(programID, "myTextureSampler");
|
GLuint progRefineID = LoadShaders("refinement.vertexshader", "refinement.fragmentshader");
|
||||||
GLint widthLoc = glGetUniformLocation(programID, "pixWidth");
|
|
||||||
GLint heigthLoc = glGetUniformLocation(programID, "pixHeight");
|
|
||||||
|
|
||||||
|
// Get shader locations for trimap shader
|
||||||
|
GLint locTriTexForeground = glGetUniformLocation(progTrimapID, "foreground");
|
||||||
|
GLint locTriPixWidth = glGetUniformLocation(progTrimapID, "pixWidth");
|
||||||
|
GLint locTriPixHeight = glGetUniformLocation(progTrimapID, "pixHeight");
|
||||||
|
|
||||||
GLint textureLocTri = glGetUniformLocation(programRefineID, "trimap");
|
// Get shader locations for refinement shader
|
||||||
GLint textureLocFore = glGetUniformLocation(programRefineID, "foreground");
|
GLint locRefTexTrimap = glGetUniformLocation(progRefineID, "trimap");
|
||||||
GLint textureLocBack = glGetUniformLocation(programRefineID, "background");
|
GLint locRefTexForeground = glGetUniformLocation(progRefineID, "foreground");
|
||||||
|
GLint locRefTexBackground = glGetUniformLocation(progRefineID, "background");
|
||||||
|
GLint locRefPixWidth = glGetUniformLocation(progRefineID, "pixWidth");
|
||||||
|
GLint locRefPixHeight = glGetUniformLocation(progRefineID, "pixHeight");
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, texFG);
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, texBG);
|
glBindTexture(GL_TEXTURE_2D, texBG);
|
||||||
glActiveTexture(GL_TEXTURE2);
|
glActiveTexture(GL_TEXTURE2);
|
||||||
glBindTexture(GL_TEXTURE_2D, renderedTexture);
|
glBindTexture(GL_TEXTURE_2D, renderedTexture);
|
||||||
|
|
||||||
|
|
||||||
printf("Shader program ID: %d\n", programID);
|
|
||||||
printf("textureLoc1: %d\n", textureLoc1);
|
|
||||||
printf("textureLocTri: %d\n", textureLocTri);
|
|
||||||
//printf("textureLocFore: %d\n", textureLocFore);
|
|
||||||
printf("widthLoc: %d\n", widthLoc);
|
|
||||||
printf("heigthLoc: %d\n", heigthLoc);
|
|
||||||
printf("Width: %f\n", 1.0f/textw);
|
|
||||||
printf("Height: %f\n", 1.0f/texth);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// INIT END
|
// INIT END
|
||||||
|
|
||||||
|
int loopNumber = -1;
|
||||||
|
double lastTime = glfwGetTime();
|
||||||
|
double lastTimeLoop = glfwGetTime();
|
||||||
|
int nbFrames = 0;
|
||||||
|
|
||||||
/* Loop until the user closes the window */
|
/* Loop until the user closes the window */
|
||||||
while (!glfwWindowShouldClose(window)) {
|
while (!glfwWindowShouldClose(window)) {
|
||||||
/* Render here */
|
|
||||||
|
|
||||||
|
|
||||||
|
// Measure speed
|
||||||
|
double currentTime = glfwGetTime();
|
||||||
|
nbFrames++;
|
||||||
|
if ( currentTime - lastTime >= 1.0 ){
|
||||||
|
// If last prinf() was more than 1 sec ago
|
||||||
|
// printf and reset timer
|
||||||
|
printf("%f ms/frame\n", 1000.0/double(nbFrames));
|
||||||
|
nbFrames = 0;
|
||||||
|
lastTime += 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Foreground texture counter
|
||||||
|
if ( currentTime - lastTimeLoop >= 0.08 ){
|
||||||
|
loopNumber++;
|
||||||
|
if (loopNumber >= lenTexFG) {
|
||||||
|
loopNumber = 0;
|
||||||
|
}
|
||||||
|
lastTimeLoop += 0.08;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set current foreground texture
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, texFGs[loopNumber]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* RENDER TO FRAMEBUFFER */
|
||||||
|
|
||||||
// Render to our framebuffer
|
// Render to our framebuffer
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);
|
glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);
|
||||||
//glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
||||||
//glViewport(0,0,textw,texth); // Render on the whole framebuffer, complete from the lower left corner to the upper right
|
// Clear buffer
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
glUseProgram(programID);
|
// Init trimap shader program
|
||||||
glUniform1f(widthLoc, 1.0f/textw);
|
glUseProgram(progTrimapID);
|
||||||
glUniform1f(heigthLoc, 1.0f/texth);
|
glUniform1f(locTriPixWidth, 1.0f/textw);
|
||||||
glUniform1i(textureLoc1, 0);
|
glUniform1f(locTriPixHeight, 1.0f/texth);
|
||||||
|
glUniform1i(locTriTexForeground, 0);
|
||||||
|
|
||||||
// 1rst attribute buffer : vertices
|
// 1st attribute buffer: vertices
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
|
||||||
glVertexAttribPointer(
|
glVertexAttribPointer(
|
||||||
@@ -175,6 +215,7 @@ int main(int argc, char* args[]) {
|
|||||||
0, // stride
|
0, // stride
|
||||||
(void*)0 // array buffer offset
|
(void*)0 // array buffer offset
|
||||||
);
|
);
|
||||||
|
|
||||||
// 2nd attribute buffer : colors
|
// 2nd attribute buffer : colors
|
||||||
glEnableVertexAttribArray(1);
|
glEnableVertexAttribArray(1);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
|
||||||
@@ -188,24 +229,33 @@ int main(int argc, char* args[]) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Draw the triangle !
|
// Draw the triangles (and render trimap shaders) to framebuffer/texture
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 2*3); // 2*3 indices starting at 0 -> 2 triangles -> 1 square
|
glDrawArrays(GL_TRIANGLES, 0, 2*3); // 2*3 indices starting at 0 -> 2 triangles -> 1 square
|
||||||
|
|
||||||
glDisableVertexAttribArray(0);
|
glDisableVertexAttribArray(0);
|
||||||
|
glUseProgram(0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Render to the screen
|
// Render to the screen
|
||||||
glUseProgram(0);
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
glViewport(0,0,textw, texth); // Render on the whole framebuffer, complete from the lower left corner to the upper right
|
|
||||||
|
|
||||||
|
// Init refinement shader program
|
||||||
|
glUseProgram(progRefineID);
|
||||||
|
glUniform1i(locRefTexForeground, 0);
|
||||||
|
glUniform1i(locRefTexBackground, 1);
|
||||||
|
glUniform1i(locRefTexTrimap, 2);
|
||||||
|
glUniform1f(locRefPixWidth, 1.0f/textw);
|
||||||
|
glUniform1f(locRefPixHeight, 1.0f/texth);
|
||||||
|
|
||||||
glUseProgram(programRefineID);
|
// 1st attribute buffer : vertices
|
||||||
glUniform1i(textureLocTri, 2);
|
|
||||||
glUniform1i(textureLocBack, 1);
|
|
||||||
glUniform1i(textureLocFore, 0);
|
|
||||||
|
|
||||||
|
|
||||||
// 1rst attribute buffer : vertices
|
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
|
||||||
glVertexAttribPointer(
|
glVertexAttribPointer(
|
||||||
@@ -216,7 +266,8 @@ int main(int argc, char* args[]) {
|
|||||||
0, // stride
|
0, // stride
|
||||||
(void*)0 // array buffer offset
|
(void*)0 // array buffer offset
|
||||||
);
|
);
|
||||||
// 2nd attribute buffer : colors
|
|
||||||
|
// 2nd attribute buffer : texture coordinates
|
||||||
glEnableVertexAttribArray(1);
|
glEnableVertexAttribArray(1);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
|
glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
|
||||||
glVertexAttribPointer(
|
glVertexAttribPointer(
|
||||||
@@ -229,7 +280,7 @@ int main(int argc, char* args[]) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Draw the triangle !
|
// Draw the triangles (and render refinement shaders) to screen
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 2*3); // 2*3 indices starting at 0 -> 2 triangles -> 1 square
|
glDrawArrays(GL_TRIANGLES, 0, 2*3); // 2*3 indices starting at 0 -> 2 triangles -> 1 square
|
||||||
glDisableVertexAttribArray(0);
|
glDisableVertexAttribArray(0);
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,16 @@
|
|||||||
1385320478 source:d:\owncloud\documents\programmierung\cpp\opengl-test-two\main.cpp
|
1385320478 source:d:\owncloud\documents\programmierung\cpp\opengl-test-two\main.cpp
|
||||||
<iostream>
|
<iostream>
|
||||||
|
|
||||||
1473703631 source:d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\main.cpp
|
1473869767 source:d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\main.cpp
|
||||||
<GL/glew.h>
|
<GL/glew.h>
|
||||||
<GLFW/glfw3.h>
|
<GLFW/glfw3.h>
|
||||||
<SDL2/SDL.h>
|
<SDL2/SDL.h>
|
||||||
<fstream>
|
<fstream>
|
||||||
<stdexcept>
|
<stdexcept>
|
||||||
|
<dirent.h>
|
||||||
"loaders.h"
|
"loaders.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\glfw\glfw3.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\glfw\glfw3.h
|
||||||
<stddef.h>
|
<stddef.h>
|
||||||
<stdint.h>
|
<stdint.h>
|
||||||
<OpenGL/gl3.h>
|
<OpenGL/gl3.h>
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
<GL/glext.h>
|
<GL/glext.h>
|
||||||
<GL/glu.h>
|
<GL/glu.h>
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl.h
|
||||||
"SDL_main.h"
|
"SDL_main.h"
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_assert.h"
|
"SDL_assert.h"
|
||||||
@@ -62,12 +63,12 @@
|
|||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_main.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_main.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_stdinc.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_stdinc.h
|
||||||
"SDL_config.h"
|
"SDL_config.h"
|
||||||
<sys/types.h>
|
<sys/types.h>
|
||||||
<stdio.h>
|
<stdio.h>
|
||||||
@@ -96,34 +97,34 @@
|
|||||||
<stdlib.h>
|
<stdlib.h>
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_config.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_config.h
|
||||||
"SDL_platform.h"
|
"SDL_platform.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_platform.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_platform.h
|
||||||
"AvailabilityMacros.h"
|
"AvailabilityMacros.h"
|
||||||
"TargetConditionals.h"
|
"TargetConditionals.h"
|
||||||
<winapifamily.h>
|
<winapifamily.h>
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\begin_code.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\begin_code.h
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\close_code.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\close_code.h
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_assert.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_assert.h
|
||||||
"SDL_config.h"
|
"SDL_config.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
<signal.h>
|
<signal.h>
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_atomic.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_atomic.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_platform.h"
|
"SDL_platform.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
<mbarrier.h>
|
<mbarrier.h>
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_audio.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_audio.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"SDL_endian.h"
|
"SDL_endian.h"
|
||||||
@@ -133,24 +134,24 @@
|
|||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_error.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_error.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_endian.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_endian.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
<endian.h>
|
<endian.h>
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_mutex.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_mutex.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_thread.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_thread.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"SDL_atomic.h"
|
"SDL_atomic.h"
|
||||||
@@ -159,18 +160,18 @@
|
|||||||
<process.h>
|
<process.h>
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_rwops.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_rwops.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_clipboard.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_clipboard.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_cpuinfo.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_cpuinfo.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
<intrin.h>
|
<intrin.h>
|
||||||
<intrin.h>
|
<intrin.h>
|
||||||
@@ -182,7 +183,7 @@
|
|||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_events.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_events.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"SDL_video.h"
|
"SDL_video.h"
|
||||||
@@ -196,7 +197,7 @@
|
|||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_video.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_video.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_pixels.h"
|
"SDL_pixels.h"
|
||||||
"SDL_rect.h"
|
"SDL_rect.h"
|
||||||
@@ -204,12 +205,12 @@
|
|||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_pixels.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_pixels.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_rect.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_rect.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"SDL_pixels.h"
|
"SDL_pixels.h"
|
||||||
@@ -217,7 +218,7 @@
|
|||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_surface.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_surface.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_pixels.h"
|
"SDL_pixels.h"
|
||||||
"SDL_rect.h"
|
"SDL_rect.h"
|
||||||
@@ -226,11 +227,11 @@
|
|||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_blendmode.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_blendmode.h
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_keyboard.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_keyboard.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"SDL_keycode.h"
|
"SDL_keycode.h"
|
||||||
@@ -238,27 +239,27 @@
|
|||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_keycode.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_keycode.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_scancode.h"
|
"SDL_scancode.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_scancode.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_scancode.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_mouse.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_mouse.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"SDL_video.h"
|
"SDL_video.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_joystick.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_joystick.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_gamecontroller.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_gamecontroller.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"SDL_rwops.h"
|
"SDL_rwops.h"
|
||||||
@@ -266,11 +267,11 @@
|
|||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_quit.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_quit.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_gesture.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_gesture.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"SDL_video.h"
|
"SDL_video.h"
|
||||||
@@ -278,60 +279,60 @@
|
|||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_touch.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_touch.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"SDL_video.h"
|
"SDL_video.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_filesystem.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_filesystem.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_haptic.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_haptic.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"SDL_joystick.h"
|
"SDL_joystick.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_hints.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_hints.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_loadso.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_loadso.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_log.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_log.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_messagebox.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_messagebox.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_video.h"
|
"SDL_video.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_power.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_power.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_render.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_render.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_rect.h"
|
"SDL_rect.h"
|
||||||
"SDL_video.h"
|
"SDL_video.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_system.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_system.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_keyboard.h"
|
"SDL_keyboard.h"
|
||||||
"SDL_render.h"
|
"SDL_render.h"
|
||||||
@@ -339,24 +340,24 @@
|
|||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_timer.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_timer.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"SDL_error.h"
|
"SDL_error.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_version.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_version.h
|
||||||
"SDL_stdinc.h"
|
"SDL_stdinc.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_image.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\sdl2\sdl_image.h
|
||||||
"SDL.h"
|
"SDL.h"
|
||||||
"SDL_version.h"
|
"SDL_version.h"
|
||||||
"begin_code.h"
|
"begin_code.h"
|
||||||
"close_code.h"
|
"close_code.h"
|
||||||
|
|
||||||
1473015242 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\gl\glew.h
|
1473011642 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\gl\glew.h
|
||||||
<stddef.h>
|
<stddef.h>
|
||||||
<inttypes.h>
|
<inttypes.h>
|
||||||
<stdint.h>
|
<stdint.h>
|
||||||
@@ -739,13 +740,13 @@
|
|||||||
<vector>
|
<vector>
|
||||||
"loaders.h"
|
"loaders.h"
|
||||||
|
|
||||||
1473669189 source:d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\src\loaders.cpp
|
1473700459 source:d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\src\loaders.cpp
|
||||||
<SDL2/SDL.h>
|
<SDL2/SDL.h>
|
||||||
<SDL2/SDL_image.h>
|
<SDL2/SDL_image.h>
|
||||||
<fstream>
|
<fstream>
|
||||||
<vector>
|
<vector>
|
||||||
"loaders.h"
|
"loaders.h"
|
||||||
|
|
||||||
1473669189 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\loaders.h
|
1473700459 d:\owncloud\documents\programmierung\cpp\imanox-chroma-matting\opengl-test-two\include\loaders.h
|
||||||
<GL/glew.h>
|
<GL/glew.h>
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,20 @@ uniform sampler2D trimap;
|
|||||||
uniform sampler2D foreground;
|
uniform sampler2D foreground;
|
||||||
uniform sampler2D background;
|
uniform sampler2D background;
|
||||||
|
|
||||||
|
// Relative width/height of a pixel
|
||||||
|
uniform float pixWidth;
|
||||||
|
uniform float pixHeight;
|
||||||
|
|
||||||
int IS_BACKGROUND = 0;
|
int IS_BACKGROUND = 0;
|
||||||
int IS_UNDEFINED = 1;
|
int IS_UNDEFINED = 1;
|
||||||
int IS_FOREGROUND = 2;
|
int IS_FOREGROUND = 2;
|
||||||
int UNSET = -1;
|
int UNSET = -1;
|
||||||
|
|
||||||
|
float M_PI= 3.14159;
|
||||||
|
int suchbreich=10; //die anzahl der Pixel, die maximal in eine Richtung gegangen wird um einen Sicheren Pixel zu finden
|
||||||
|
vec4 SicheresPixel[50]; //Speichert die das nachste Sichere Pixel, Array grosse=anzahl der Richtungen
|
||||||
|
int anzahl_richtungen=50; //Speichert anzahl der Richtungen muss gleich der Array grosse von SicheresPixel sein
|
||||||
|
|
||||||
vec3 getTriColor(vec2 uvCoord) {
|
vec3 getTriColor(vec2 uvCoord) {
|
||||||
return texture(trimap, uvCoord).rgb;
|
return texture(trimap, uvCoord).rgb;
|
||||||
}
|
}
|
||||||
@@ -39,6 +47,90 @@ int getState(vec3 c) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec4 suche_Pixel_nach_winkel (vec2 uv, float winkel){
|
||||||
|
vec2 pix;
|
||||||
|
float i=1;
|
||||||
|
vec3 color_sichers_Pixel;
|
||||||
|
while(i<suchbreich){
|
||||||
|
pix.x=uv.x+ sin(winkel)*pixWidth*i;
|
||||||
|
pix.y=uv.y+ cos(winkel)*pixWidth*i;
|
||||||
|
color_sichers_Pixel = getTriColor(pix);
|
||||||
|
int status = getState(color_sichers_Pixel);
|
||||||
|
if (status==IS_FOREGROUND) {
|
||||||
|
return vec4(getForeColor(pix), i);
|
||||||
|
//return vec4(1f, 1f, 1f, i);
|
||||||
|
} else if (status==IS_BACKGROUND) {
|
||||||
|
return vec4(getBackColor(pix), i);
|
||||||
|
//return vec4(0f, 0f, 0f, i);
|
||||||
|
}else{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return vec4(0.0f, 0.0f, 0.0f, -1.0f);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float Farbabstand(int i){
|
||||||
|
float d=sqrt(pow(color.x-SicheresPixel[i].x,2)+pow(color.y-SicheresPixel[i].y,2)+pow(color.z-SicheresPixel[i].z, 2));//sqr((x1-x2)^2+(y1-y2)^2+(z1-z2)^2)
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 Pruefe_Pixel_in_Umgebung (vec2 start){
|
||||||
|
float winkel=2*M_PI/anzahl_richtungen;
|
||||||
|
int i=0;
|
||||||
|
float gefundene_pixel=0.0f;
|
||||||
|
float maximal=0;
|
||||||
|
float gesamt_abstand=0.0f;
|
||||||
|
while(i<anzahl_richtungen){
|
||||||
|
SicheresPixel[i]=suche_Pixel_nach_winkel(start, winkel*i);
|
||||||
|
if(SicheresPixel[i].w!=-1){
|
||||||
|
gesamt_abstand+=SicheresPixel[i].w;
|
||||||
|
gefundene_pixel++;
|
||||||
|
if(maximal<SicheresPixel[i].w)
|
||||||
|
maximal=SicheresPixel[i].w;
|
||||||
|
}
|
||||||
|
|
||||||
|
i=i+1;
|
||||||
|
}
|
||||||
|
maximal++;
|
||||||
|
//float d = Farbabstand(1);//eigene Funktion
|
||||||
|
/*float d1=distance(SicheresPixel[1].xyz, color);//mitgelieferte Funktion
|
||||||
|
if (d1==d ){
|
||||||
|
return SicheresPixel[1];
|
||||||
|
}else{
|
||||||
|
return vec3(0.5f);
|
||||||
|
}*/
|
||||||
|
float nenner=0.0f;
|
||||||
|
i=0;
|
||||||
|
while(i<anzahl_richtungen){
|
||||||
|
if(SicheresPixel[i].w!=-1){
|
||||||
|
SicheresPixel[i].w=pow(maximal-SicheresPixel[i].w,2);
|
||||||
|
nenner+=SicheresPixel[i].w;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
i=0;
|
||||||
|
vec3 kombiniert=vec3(0.0f);
|
||||||
|
|
||||||
|
while(i<anzahl_richtungen){
|
||||||
|
if(SicheresPixel[i].w!=-1)
|
||||||
|
kombiniert+=SicheresPixel[i].xyz*SicheresPixel[i].w/nenner;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return kombiniert;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
color = getTriColor(UV);
|
color = getTriColor(UV);
|
||||||
@@ -47,9 +139,15 @@ void main(){
|
|||||||
|
|
||||||
if (status==IS_FOREGROUND) {
|
if (status==IS_FOREGROUND) {
|
||||||
color = getForeColor(UV).rgb;
|
color = getForeColor(UV).rgb;
|
||||||
|
//color = vec3(1.0f, 0.0f, 0.0f);
|
||||||
|
//color = vec3(1.0f);
|
||||||
} else if (status==IS_BACKGROUND) {
|
} else if (status==IS_BACKGROUND) {
|
||||||
color = getBackColor(UV).rgb;
|
color = getBackColor(UV).rgb;
|
||||||
|
//color = vec3(0.0f, 1.0f, 0.0f);
|
||||||
|
//color = vec3(0.0f);
|
||||||
} else {
|
} else {
|
||||||
// render undefined area
|
color = Pruefe_Pixel_in_Umgebung(UV);
|
||||||
|
//color = vec3(0.0f, 0.0f, 1.0f);
|
||||||
|
//color = Pruefe_Pixel_in_Umgebung(UV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ GLuint LoadShaders(const char * vertex_file_path,const char * fragment_file_path
|
|||||||
|
|
||||||
|
|
||||||
// Compile Vertex Shader
|
// Compile Vertex Shader
|
||||||
printf("Compiling shader : %s\n", vertex_file_path);
|
|
||||||
char const * VertexSourcePointer = VertexShaderCode.c_str();
|
char const * VertexSourcePointer = VertexShaderCode.c_str();
|
||||||
glShaderSource(VertexShaderID, 1, &VertexSourcePointer , NULL);
|
glShaderSource(VertexShaderID, 1, &VertexSourcePointer , NULL);
|
||||||
glCompileShader(VertexShaderID);
|
glCompileShader(VertexShaderID);
|
||||||
@@ -103,7 +102,6 @@ GLuint LoadShaders(const char * vertex_file_path,const char * fragment_file_path
|
|||||||
|
|
||||||
|
|
||||||
// Compile Fragment Shader
|
// Compile Fragment Shader
|
||||||
printf("Compiling shader : %s\n", fragment_file_path);
|
|
||||||
char const * FragmentSourcePointer = FragmentShaderCode.c_str();
|
char const * FragmentSourcePointer = FragmentShaderCode.c_str();
|
||||||
glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer , NULL);
|
glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer , NULL);
|
||||||
glCompileShader(FragmentShaderID);
|
glCompileShader(FragmentShaderID);
|
||||||
@@ -120,7 +118,6 @@ GLuint LoadShaders(const char * vertex_file_path,const char * fragment_file_path
|
|||||||
|
|
||||||
|
|
||||||
// Link the program
|
// Link the program
|
||||||
printf("Linking program\n");
|
|
||||||
GLuint ProgramID = glCreateProgram();
|
GLuint ProgramID = glCreateProgram();
|
||||||
glAttachShader(ProgramID, VertexShaderID);
|
glAttachShader(ProgramID, VertexShaderID);
|
||||||
glAttachShader(ProgramID, FragmentShaderID);
|
glAttachShader(ProgramID, FragmentShaderID);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ layout(location = 0) out vec3 color;
|
|||||||
//out vec3 color;
|
//out vec3 color;
|
||||||
|
|
||||||
// Values that stay constant for the whole mesh.
|
// Values that stay constant for the whole mesh.
|
||||||
uniform sampler2D myTextureSampler;
|
uniform sampler2D foreground;
|
||||||
|
|
||||||
// Relative width/height of a pixel
|
// Relative width/height of a pixel
|
||||||
uniform float pixWidth;
|
uniform float pixWidth;
|
||||||
@@ -21,20 +21,16 @@ int IS_UNDEFINED = 1;
|
|||||||
int IS_FOREGROUND = 2;
|
int IS_FOREGROUND = 2;
|
||||||
int UNSET = -1;
|
int UNSET = -1;
|
||||||
|
|
||||||
vec3 greenValue = vec3(0.0f, 1.0f, 0.0f);
|
vec3 greenValue = vec3(73.0f/255.0f, 129.0f/255.0f, 24.0f/255.0f);
|
||||||
vec3 difference = vec3(40.0f/255.0f);
|
vec3 difference = vec3(40.0f/255.0f);
|
||||||
int radius = 10;
|
int radius = 2;
|
||||||
|
|
||||||
|
|
||||||
vec3 getColor(vec2 uvCoord) {
|
vec3 getColor(vec2 uvCoord) {
|
||||||
return texture(myTextureSampler, uvCoord).rgb;
|
return texture(foreground, uvCoord).rgb;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBackground(vec3 c) {
|
bool isBackground(vec3 c) {
|
||||||
/*// 49,206, 11
|
|
||||||
if (all( lessThanEqual(c, vec3(51.0f/255.0f, 208.0f/255.0f, 13.0f/255.0f))) &&
|
|
||||||
all(greaterThanEqual(c, vec3(47.0f/255.0f, 204.0f/255.0f, 9.0f/255.0f)))*/
|
|
||||||
// 0, 255, 0
|
|
||||||
if (all( lessThanEqual(c, greenValue+difference)) &&
|
if (all( lessThanEqual(c, greenValue+difference)) &&
|
||||||
all(greaterThanEqual(c, greenValue-difference))
|
all(greaterThanEqual(c, greenValue-difference))
|
||||||
) {
|
) {
|
||||||
@@ -74,10 +70,10 @@ void main(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status == IS_BACKGROUND) {
|
if (status == IS_BACKGROUND) {
|
||||||
color = vec3(0.0f);
|
color = vec3(0.0f); // black
|
||||||
} else if (status == IS_FOREGROUND) {
|
} else if (status == IS_FOREGROUND) {
|
||||||
color = vec3(1.0f);
|
color = vec3(1.0f); // white
|
||||||
} else {
|
} else {
|
||||||
color = vec3(0.5f);
|
color = vec3(0.5f); // gray
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||