diff --git a/Rakefile.rb b/Rakefile.rb index 5254fab..0100cb9 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -4,7 +4,11 @@ task :default do Rscons::Environment.new do |env| env.build_root = "build" env.parse_flags!("!sdl2-config --cflags --libs") - env["CXXFLAGS"] += %w[-isystem oglplus/include] + env["CXXFLAGS"] += %w[ + -isystem oglplus/include + -isystem oglplus/implement + -std=gnu++11 + ] env["CPPDEFINES"] += %w[ OGLPLUS_NO_SITE_CONFIG ] diff --git a/main.cc b/main.cc index e304548..3f1b8f8 100644 --- a/main.cc +++ b/main.cc @@ -1,5 +1,8 @@ #include -#include "oglplus/gl.hpp" +#include +#include + +using namespace oglplus; #define WIDTH 800 #define HEIGHT 600 @@ -54,6 +57,36 @@ int main(int argc, char * argv[]) static void init() { + VertexShader vs; + FragmentShader fs; + Program program; + VertexArray cube; + Buffer verts; + + vs.Source("#version 330\n" + "uniform mat4 projection;\n" + "uniform mat4 modelview;\n" + "in vec4 position;\n" + "in vec3 normal;\n" + "in vec2 texture;\n" + "out vec3 normal_i;\n" + "out vec2 texture_i;\n" + "void main(void)\n" + "{\n" + " normal_i = normal;\n" + " texture_i = texture;\n" + " gl_Position = projection * modelview * position\n" + "}"); + vs.Compile(); + fs.Source("#version 330\n" + "in vec3 normal_i;\n" + "in vec2 texture_i;\n" + "out vec4 frag_color;\n" + "void main(void)\n" + "{\n" + " frag_color = vec4(texture_i, 1.0, 1.0);\n" + "}"); + fs.Compile(); } static void display(SDL_Window * window)