updated ai shader
This commit is contained in:
parent
ea7f7ec704
commit
d7ad154d20
@ -1,5 +1,4 @@
|
||||
#version 330 core
|
||||
precision mediump float;
|
||||
|
||||
in vec2 uv;
|
||||
|
||||
|
||||
@ -24,6 +24,14 @@ GLuint compile(GLenum t, const std::string& src)
|
||||
const char* c = src.c_str();
|
||||
glShaderSource(s, 1, &c, NULL);
|
||||
glCompileShader(s);
|
||||
|
||||
GLint ok = 0;
|
||||
glGetShaderiv(s, GL_COMPILE_STATUS, &ok);
|
||||
if (!ok) {
|
||||
char log[1024];
|
||||
glGetShaderInfoLog(s, sizeof(log), NULL, log);
|
||||
std::cout << "shader compile failed:\n" << log;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -37,9 +45,9 @@ int main()
|
||||
glewInit();
|
||||
|
||||
// ---------------- LOAD IMAGES ----------------
|
||||
int w,h,c;
|
||||
unsigned char* img1 = stbi_load("frame1.jpg",&w,&h,&c,4);
|
||||
unsigned char* img2 = stbi_load("frame2.jpg",&w,&h,&c,4);
|
||||
int w,h;
|
||||
unsigned char* img1 = stbi_load("frame1.jpg",&w,&h,NULL,4);
|
||||
unsigned char* img2 = stbi_load("frame2.jpg",&w,&h,NULL,4);
|
||||
|
||||
if(!img1 || !img2)
|
||||
{
|
||||
@ -48,9 +56,9 @@ int main()
|
||||
}
|
||||
|
||||
// ---------------- TEXTURES ----------------
|
||||
GLuint texA, texB;
|
||||
glGenTextures(1,&texA);
|
||||
glGenTextures(1,&texB);
|
||||
GLuint tex[2];
|
||||
glGenTextures(2, tex);
|
||||
GLuint texA = tex[0], texB = tex[1];
|
||||
|
||||
auto upload = [&](GLuint t, unsigned char* d)
|
||||
{
|
||||
@ -86,6 +94,14 @@ int main()
|
||||
glAttachShader(prog,f);
|
||||
glLinkProgram(prog);
|
||||
|
||||
GLint linked = 0;
|
||||
glGetProgramiv(prog, GL_LINK_STATUS, &linked);
|
||||
if (!linked) {
|
||||
char log[1024];
|
||||
glGetProgramInfoLog(prog, sizeof(log), NULL, log);
|
||||
std::cout << "program link failed:\n" << log;
|
||||
}
|
||||
|
||||
// ---------------- QUAD (FIXED) ----------------
|
||||
GLuint vao,vbo;
|
||||
|
||||
@ -142,6 +158,8 @@ int main()
|
||||
glReadPixels(0,0,w,h,GL_RGBA,GL_UNSIGNED_BYTE,out.data());
|
||||
|
||||
stbi_write_jpg("frameO.jpg",w,h,4,out.data(),90);
|
||||
stbi_image_free(img1);
|
||||
stbi_image_free(img2);
|
||||
|
||||
std::cout << "done\n";
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user