start using OGLplus
This commit is contained in:
parent
2e5ac958b7
commit
f65ef8554b
@ -4,7 +4,11 @@ task :default do
|
|||||||
Rscons::Environment.new do |env|
|
Rscons::Environment.new do |env|
|
||||||
env.build_root = "build"
|
env.build_root = "build"
|
||||||
env.parse_flags!("!sdl2-config --cflags --libs")
|
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[
|
env["CPPDEFINES"] += %w[
|
||||||
OGLPLUS_NO_SITE_CONFIG
|
OGLPLUS_NO_SITE_CONFIG
|
||||||
]
|
]
|
||||||
|
35
main.cc
35
main.cc
@ -1,5 +1,8 @@
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include "oglplus/gl.hpp"
|
#include <oglplus/gl.hpp>
|
||||||
|
#include <oglplus/all.hpp>
|
||||||
|
|
||||||
|
using namespace oglplus;
|
||||||
|
|
||||||
#define WIDTH 800
|
#define WIDTH 800
|
||||||
#define HEIGHT 600
|
#define HEIGHT 600
|
||||||
@ -54,6 +57,36 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
static void init()
|
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)
|
static void display(SDL_Window * window)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user