本文整理汇总了C++中Context::FrontFace方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::FrontFace方法的具体用法?C++ Context::FrontFace怎么用?C++ Context::FrontFace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context::FrontFace方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attr
//.........这里部分代码省略.........
"void main(void)"
"{"
" vertNormal = ("
" ModelMatrix *"
" vec4(-Normal, 0.0)"
" ).xyz;"
" vertLight = ("
" vec4(LightPos, 0.0)-"
" ModelMatrix * Position"
" ).xyz;"
" vertTexCoord = "
" TexProjectionMatrix *"
" ModelMatrix *"
" Position;"
" gl_Position = "
" ProjectionMatrix *"
" CameraMatrix *"
" ModelMatrix *"
" Position;"
"}"
);
// compile it
vs.Compile();
// set the fragment shader source
fs.Source(
"#version 330\n"
"uniform sampler2D TexUnit;"
"in vec3 vertNormal;"
"in vec3 vertLight;"
"in vec4 vertTexCoord;"
"out vec4 fragColor;"
"void main(void)"
"{"
" float l = length(vertLight);"
" float d = l != 0.0 ? dot("
" vertNormal, "
" normalize(vertLight)"
" ) / l : 0.0;"
" float i = 0.1 + 4.2*max(d, 0.0);"
" vec2 coord = vertTexCoord.st/vertTexCoord.q;"
" vec4 t = texture(TexUnit, coord*0.5 + 0.5);"
" fragColor = vec4(t.rgb*i*sqrt(1.0-t.a), 1.0);"
"}"
);
// compile it
fs.Compile();
// attach the shaders to the program
prog.AttachShader(vs);
prog.AttachShader(fs);
// link and use it
prog.Link();
prog.Use();
// bind the VAO for the cube
cube.Bind();
verts.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_cube.Positions(data);
Buffer::Data(Buffer::Target::Array, data);
VertexArrayAttrib attr(prog, "Position");
attr.Setup<GLfloat>(n_per_vertex);
attr.Enable();
}
normals.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_cube.Normals(data);
Buffer::Data(Buffer::Target::Array, data);
VertexArrayAttrib attr(prog, "Normal");
attr.Setup<GLfloat>(n_per_vertex);
attr.Enable();
}
// setup the texture
gl.Direct(Texture::Target::_2D, tex)
.Image2D(images::LoadTexture("flower_glass"))
.GenerateMipmap()
.BorderColor(Vec4f(1.0f, 1.0f, 1.0f, 0.0f))
.MinFilter(TextureMinFilter::LinearMipmapLinear)
.MagFilter(TextureMagFilter::Linear)
.WrapS(TextureWrap::ClampToBorder)
.WrapT(TextureWrap::ClampToBorder)
.Bind();
UniformSampler(prog, "TexUnit").Set(0);
Uniform<Mat4f>(prog, "CameraMatrix").Set(
CamMatrixf::LookingAt(Vec3f(0.0f, 1.0f, 2.0f), Vec3f())
);
gl.ClearColor(0.1f, 0.1f, 0.1f, 0.0f);
gl.ClearDepth(1.0f);
gl.Enable(Capability::DepthTest);
gl.Enable(Capability::CullFace);
gl.FrontFace(make_cube.FaceWinding());
}
示例2: attr
//.........这里部分代码省略.........
"void main(void)"
"{"
" float l = dot(vertLight, vertLight);"
" float d = l != 0.0 ? dot("
" vertNormal, "
" normalize(vertLight)"
" ) / l : 0.0;"
" vec3 c = vec3(0.9, 0.8, 0.2);"
" vec4 t = texture(TexUnit, vertTexCoord);"
" float a = 1.0 - sqrt(abs(d)), e;"
" if(gl_FrontFacing)"
" {"
" e = d >= 0.0 ?"
" d * mix(0.5, 1.0, t.a):"
" (-0.9*d) * (1.0 - t.a);"
" }"
" else"
" {"
" e = d >= 0.0 ?"
" (0.6*d) * (1.0 - t.a):"
" (-0.7*d) * mix(0.5, 1.0, t.a);"
" }"
" float i = 0.1 + 9.0*e;"
" fragColor = vec4("
" t.r*c.r*i, "
" t.g*c.g*i, "
" t.b*c.b*i, "
" clamp(pow(t.a,2) + a*0.4, 0.0, 1.0)"
" );"
"}"
);
// compile it
fs.Compile();
// attach the shaders to the program
prog.AttachShader(vs);
prog.AttachShader(fs);
// link and use it
prog.Link();
prog.Use();
// bind the VAO for the cube
cube.Bind();
verts.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_cube.Positions(data);
Buffer::Data(Buffer::Target::Array, data);
VertexAttribArray attr(prog, "Position");
attr.Setup(n_per_vertex, DataType::Float);
attr.Enable();
}
normals.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_cube.Normals(data);
Buffer::Data(Buffer::Target::Array, data);
VertexAttribArray attr(prog, "Normal");
attr.Setup(n_per_vertex, DataType::Float);
attr.Enable();
}
texcoords.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_cube.TexCoordinates(data);
Buffer::Data(Buffer::Target::Array, data);
VertexAttribArray attr(prog, "TexCoord");
attr.Setup(n_per_vertex, DataType::Float);
attr.Enable();
}
// setup the texture
{
auto bound_tex = Bind(tex, Texture::Target::_2D);
bound_tex.Image2D(images::LoadTexture("honeycomb"));
bound_tex.GenerateMipmap();
bound_tex.MinFilter(TextureMinFilter::LinearMipmapLinear);
bound_tex.MagFilter(TextureMagFilter::Linear);
bound_tex.WrapS(TextureWrap::MirroredRepeat);
bound_tex.WrapT(TextureWrap::MirroredRepeat);
}
//
UniformSampler(prog, "TexUnit").Set(0);
Uniform<Vec3f>(prog, "LightPos").Set(Vec3f(1.0f, 2.0f, 3.0f));
//
gl.ClearColor(0.1f, 0.1f, 0.1f, 0.0f);
gl.ClearDepth(1.0f);
gl.Enable(Capability::DepthTest);
gl.Enable(Capability::Blend);
gl.BlendFunc(
BlendFn::SrcAlpha,
BlendFn::OneMinusSrcAlpha
);
gl.Enable(Capability::CullFace);
gl.FrontFace(make_cube.FaceWinding());
}
示例3: attr
//.........这里部分代码省略.........
// compile it
vs.Compile();
// set the fragment shader source
fs.Source(
"#version 150\n"
"in vec3 vertColor;"
"in vec3 vertNormal;"
"in vec3 vertViewDir;"
"out vec4 fragColor;"
"uniform vec3 LightPos[3];"
"void main(void)"
"{"
" float amb = 0.2;"
" float diff = 0.0;"
" float spec = 0.0;"
" for(int i=0;i!=3;++i)"
" {"
" diff += max("
" dot(vertNormal, LightPos[i])/"
" dot(LightPos[i], LightPos[i]),"
" 0.0"
" );"
" float k = dot(vertNormal, LightPos[i]);"
" vec3 r = 2.0*k*vertNormal - LightPos[i];"
" spec += pow(max("
" dot(normalize(r), vertViewDir),"
" 0.0"
" ), 32.0 * dot(r, r));"
" }"
" fragColor = "
" vec4(vertColor, 1.0)*(amb+diff)+"
" vec4(1.0, 1.0, 1.0, 1.0)*spec;"
"}"
);
// compile it
fs.Compile();
// attach the shaders to the program
prog.AttachShader(vs);
prog.AttachShader(fs);
// link and use it
prog.Link();
prog.Use();
// bind the VAO for the torus
torus.Bind();
// bind the VBO for the torus vertex positions
positions.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_torus.Positions(data);
// upload the data
Buffer::Data(Buffer::Target::Array, data);
// setup the vertex attribs array for the vertices
VertexArrayAttrib attr(prog, "Position");
attr.Setup<GLfloat>(n_per_vertex);
attr.Enable();
}
// bind the VBO for the torus normals
normals.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_torus.Normals(data);
// upload the data
Buffer::Data(Buffer::Target::Array, data);
// setup the vertex attribs array for the vertices
VertexArrayAttrib attr(prog, "Normal");
attr.Setup<GLfloat>(n_per_vertex);
attr.Enable();
}
// bind the VBO for the torus colors
colors.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_torus.Tangents(data);
// upload the data
Buffer::Data(Buffer::Target::Array, data);
// setup the vertex attribs array for the vertices
VertexArrayAttrib attr(prog, "Color");
attr.Setup<GLfloat>(n_per_vertex);
attr.Enable();
}
// set the light positions
Uniform<Vec3f> light_pos(prog, "LightPos");
light_pos[0].Set(Vec3f(2.0f,-1.0f, 0.0f));
light_pos[1].Set(Vec3f(0.0f, 3.0f,-1.0f));
light_pos[2].Set(Vec3f(0.0f,-1.0f, 4.0f));
//
gl.ClearColor(0.8f, 0.8f, 0.7f, 0.0f);
gl.ClearDepth(1.0f);
gl.Enable(Capability::DepthTest);
gl.Enable(Capability::CullFace);
gl.FrontFace(make_torus.FaceWinding());
gl.CullFace(Face::Back);
}
示例4: attr
//.........这里部分代码省略.........
" float d = l > 0? dot("
" vertNormal, "
" normalize(vertLight)"
" ) / l : 0.0;"
" float i = 0.2 + 3.2*max(d, 0.0);"
" fragColor = texture(TexUnit, vertTexCoord)*i;"
"}"
).Compile();
// attach the shaders to the program
prog.AttachShader(vs).AttachShader(fs);
// link and use it
prog.Link().Use();
// bind the VAO for the torus
torus.Bind();
// bind the VBO for the torus vertices
verts.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_torus.Positions(data);
// upload the data
Buffer::Data(Buffer::Target::Array, data);
// setup the vertex attribs array for the vertices
VertexAttribArray attr(prog, "Position");
attr.Setup(n_per_vertex, DataType::Float);
attr.Enable();
}
// bind the VBO for the torus normals
normals.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_torus.Normals(data);
// upload the data
Buffer::Data(Buffer::Target::Array, data);
// setup the vertex attribs array for the vertices
VertexAttribArray attr(prog, "Normal");
attr.Setup(n_per_vertex, DataType::Float);
attr.Enable();
}
// bind the VBO for the torus texture coordinates
texcoords.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_torus.TexCoordinates(data);
// upload the data
Buffer::Data(Buffer::Target::Array, data);
// setup the vertex attribs array for the vertices
VertexAttribArray attr(prog, "TexCoord");
attr.Setup(n_per_vertex, DataType::Float);
attr.Enable();
}
// setup the texture
Texture::Target tex_tgt = Texture::Target::_2D;
tex.Bind(tex_tgt);
{
GLuint s = 256;
std::vector<GLubyte> tex_data(s*s);
for(GLuint v=0;v!=s;++v)
for(GLuint u=0;u!=s;++u)
tex_data[v*s+u] = rand() % 0x100;
Texture::Image2D(
tex_tgt,
0,
PixelDataInternalFormat::Red,
s, s,
0,
PixelDataFormat::Red,
PixelDataType::UnsignedByte,
tex_data.data()
);
Texture::MinFilter(tex_tgt, TextureMinFilter::Linear);
Texture::MagFilter(tex_tgt, TextureMagFilter::Linear);
Texture::WrapS(tex_tgt, TextureWrap::Repeat);
Texture::WrapT(tex_tgt, TextureWrap::Repeat);
Texture::SwizzleG(tex_tgt, TextureSwizzle::Red);
Texture::SwizzleB(tex_tgt, TextureSwizzle::Red);
}
// typechecked uniform with exact data type
// on compilers supporting strongly typed enums
// you can use:
//Typechecked<Uniform<SLtoCpp<SLDataType::Sampler2D>>>(prog, "TexUnit").Set(0);
// without strongly typed enums you need to do:
typedef SLtoCpp<OGLPLUS_CONST_ENUM_VALUE(SLDataType::Sampler2D)> GLSLsampler2D;
Typechecked<Uniform<GLSLsampler2D>>(prog, "TexUnit").Set(0);
//
Uniform<Vec3f>(prog, "LightPos").Set(4.0f, 4.0f, -8.0f);
gl.ClearColor(0.8f, 0.8f, 0.7f, 0.0f);
gl.ClearDepth(1.0f);
gl.Enable(Capability::DepthTest);
gl.Enable(Capability::CullFace);
gl.FrontFace(make_torus.FaceWinding());
gl.CullFace(Face::Back);
}
示例5: attr
//.........这里部分代码省略.........
VertexAttribArray attr(transf_prog, "Position");
attr.Setup<GLfloat>(n_per_vertex);
attr.Enable();
}
normals.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_torus.Normals(data);
Buffer::Data(Buffer::Target::Array, data);
VertexAttribArray attr(transf_prog, "Normal");
attr.Setup<GLfloat>(n_per_vertex);
attr.Enable();
}
texcoords.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_torus.TexCoordinates(data);
Buffer::Data(Buffer::Target::Array, data);
VertexAttribArray attr(transf_prog, "TexCoord");
attr.Setup<GLfloat>(n_per_vertex);
attr.Enable();
}
face_fs.Source(
"#version 330\n"
"in vec3 geomNormal;"
"in vec3 geomLight;"
"in float geomGlow;"
"flat in int geomTop;"
"uniform vec3 TopColor, SideColor;"
"const vec3 LightColor = vec3(1.0, 1.0, 1.0);"
"out vec4 fragColor;"
"void main(void)"
"{"
" float d = max(dot("
" normalize(geomLight),"
" normalize(geomNormal)"
" ), 0.0);"
" vec3 color;"
" if(geomTop != 0)"
" {"
" color = TopColor * d +"
" LightColor * pow(d, 8.0);"
" }"
" else"
" {"
" color = SideColor * geomGlow +"
" LightColor *"
" pow(d, 2.0) * 0.2;"
" }"
" fragColor = vec4(color, 1.0);"
"}"
);
face_fs.Compile();
face_prog.AttachShader(face_fs);
face_prog.MakeSeparable();
face_prog.Link();
ProgramUniform<Vec3f>(face_prog, "TopColor").Set(0.2f, 0.2f, 0.2f);
ProgramUniform<Vec3f>(face_prog, "SideColor").Set(0.9f, 0.9f, 0.2f);
face_pp.Bind();
face_prog.Use();
face_pp.UseStages(transf_prog).Vertex().Geometry();
face_pp.UseStages(face_prog).Fragment();
frame_fs.Source(
"#version 330\n"
"out vec4 fragColor;"
"void main(void)"
"{"
" fragColor = vec4(0.2, 0.1, 0.0, 1.0);"
"}"
);
frame_fs.Compile();
frame_prog.AttachShader(frame_fs);
frame_prog.MakeSeparable();
frame_prog.Link();
frame_pp.Bind();
frame_prog.Use();
frame_pp.UseStages(transf_prog).Vertex().Geometry();
frame_pp.UseStages(frame_prog).Fragment();
ProgramPipeline::Unbind();
Program::UseNone();
gl.ClearColor(0.7f, 0.6f, 0.5f, 0.0f);
gl.ClearDepth(1.0f);
gl.Enable(Capability::DepthTest);
gl.DepthFunc(CompareFn::Less);
gl.FrontFace(make_torus.FaceWinding());
}
示例6: attr
//.........这里部分代码省略.........
"in vec3 vertViewDir;"
"in vec3 vertViewRefl;"
"out vec4 fragColor;"
"void main(void)"
"{"
" float l = length(vertLightDir);"
" float d = dot("
" normalize(vertNormal), "
" normalize(vertLightDir)"
" ) / l;"
" float s = dot("
" normalize(vertLightRefl),"
" normalize(vertViewDir)"
" );"
" vec3 lt = vec3(1.0, 1.0, 1.0);"
" vec3 env = texture(TexUnit, vertViewRefl).rgb;"
" fragColor = vec4("
" env * 0.4 + "
" (lt + env) * 1.5 * max(d, 0.0) + "
" lt * pow(max(s, 0.0), 64), "
" 1.0"
" );"
"}"
);
// compile it
fs.Compile();
// attach the shaders to the program
prog.AttachShader(vs);
prog.AttachShader(fs);
// link and use it
prog.Link();
prog.Use();
// bind the VAO for the shape
shape.Bind();
verts.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_shape.Positions(data);
Buffer::Data(Buffer::Target::Array, data);
VertexAttribArray attr(prog, "Position");
attr.Setup<GLfloat>(n_per_vertex);
attr.Enable();
}
normals.Bind(Buffer::Target::Array);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_shape.Normals(data);
Buffer::Data(Buffer::Target::Array, data);
VertexAttribArray attr(prog, "Normal");
attr.Setup<GLfloat>(n_per_vertex);
attr.Enable();
}
// setup the texture
{
GLuint tex_side = 256;
auto image = images::NewtonFractal(
tex_side, tex_side,
Vec3f(0.3f, 0.1f, 0.2f),
Vec3f(1.0f, 0.8f, 0.9f),
Vec2f(-1.0f, -1.0f),
Vec2f( 1.0f, 1.0f),
images::NewtonFractal::X4Minus1(),
images::NewtonFractal::DefaultMixer()
);
auto tex_target = Texture::Target::CubeMap;
// texture syntax sugar
tex << tex_target;
tex_target << TextureMinFilter::Linear;
tex_target << TextureMagFilter::Linear;
tex_target << TextureWrap::ClampToEdge;
for(int i=0; i!=6; ++i)
{
Texture::CubeMapFace(i) << image;
}
}
// typechecked uniform with the exact sampler type
// on compilers supporting strongly typed enums
// you can use:
//Typechecked<Uniform<SLtoCpp<SLDataType::SamplerCube>>>(prog, "TexUnit").Set(0);
// without strongly typed enums you need to do:
typedef SLtoCpp<OGLPLUS_CONST_ENUM_VALUE(SLDataType::SamplerCube)> GLSLsamplerCube;
Typechecked<Uniform<GLSLsamplerCube>>(prog, "TexUnit").Set(0);
//
Uniform<Vec3f>(prog, "LightPos").Set(Vec3f(3.0f, 5.0f, 4.0f));
//
gl.ClearColor(0.2f, 0.05f, 0.1f, 0.0f);
gl.ClearDepth(1.0f);
gl.Enable(Capability::DepthTest);
gl.Enable(Capability::CullFace);
gl.FrontFace(make_shape.FaceWinding());
gl.CullFace(Face::Back);
}
示例7: CubeExample
CubeExample()
: cube_instr(make_cube.Instructions())
, cube_indices(make_cube.Indices())
, prog(make())
, projection_matrix(prog, "ProjectionMatrix")
, camera_matrix(prog, "CameraMatrix")
, model_matrix(prog, "ModelMatrix")
, light_pos(prog, "LightPos") {
// bind the VAO for the cube
gl.Bind(cube);
gl.Bind(Buffer::Target::Array, verts);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_cube.Positions(data);
Buffer::Data(Buffer::Target::Array, data);
(prog | "Position").Setup<GLfloat>(n_per_vertex).Enable();
}
gl.Bind(Buffer::Target::Array, normals);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_cube.Normals(data);
Buffer::Data(Buffer::Target::Array, data);
(prog | "Normal").Setup<GLfloat>(n_per_vertex).Enable();
}
gl.Bind(Buffer::Target::Array, tangents);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_cube.Tangents(data);
Buffer::Data(Buffer::Target::Array, data);
(prog | "Tangent").Setup<GLfloat>(n_per_vertex).Enable();
}
gl.Bind(Buffer::Target::Array, texcoords);
{
std::vector<GLfloat> data;
GLuint n_per_vertex = make_cube.TexCoordinates(data);
Buffer::Data(Buffer::Target::Array, data);
(prog | "TexCoord").Setup<GLfloat>(n_per_vertex).Enable();
}
{
auto img = images::SphereBumpMap(512, 512, 2, 2);
Uniform<GLsizei>(prog, "BumpTexWidth").Set(img.Width());
Uniform<GLsizei>(prog, "BumpTexHeight").Set(img.Height());
UniformSampler(prog, "BumpTex").Set(0);
Texture::Active(0);
gl.Bound(Texture::Target::_2D, bumpTex)
.MinFilter(TextureMinFilter::LinearMipmapLinear)
.MagFilter(TextureMagFilter::Linear)
.WrapS(TextureWrap::Repeat)
.WrapT(TextureWrap::Repeat)
.Image2D(img)
.GenerateMipmap();
}
//
gl.ClearColor(0.1f, 0.1f, 0.1f, 0.0f);
gl.ClearDepth(1.0f);
gl.Enable(Capability::DepthTest);
gl.Enable(Capability::CullFace);
gl.FrontFace(make_cube.FaceWinding());
}
示例8: shape_attr
//.........这里部分代码省略.........
" EmitVertex();"
" }"
" EndPrimitive();"
"}"
);
light_gs.Compile();
light_fs.Source(
"#version 330\n"
"in vec4 geomPosition;"
"out vec4 fragColor;"
"uniform samplerCubeShadow ShadowMap;"
"uniform int SampleCount;"
"uniform vec3 LightPos;"
"void main(void)"
"{"
" vec3 LightDir = geomPosition.xyz - LightPos;"
" vec4 ShadowCoord = vec4("
" normalize(LightDir),"
" length(LightDir)"
" );"
" float s = texture(ShadowMap, ShadowCoord);"
" float alpha = s / (SampleCount * pow(length(LightDir), 2));"
" fragColor = vec4(1.0, 1.0, 1.0, alpha);"
"}"
);
light_fs.Compile();
light_prog.AttachShader(light_vs);
light_prog.AttachShader(light_gs);
light_prog.AttachShader(light_fs);
light_prog.Link();
light_prog.Use();
// bind the VAO for the light volume
light.Bind();
// bind the VBO for the light volume plane positions
light_positions.Bind(Buffer::Target::Array);
{
GLfloat position[3] = {0.0, 0.0, 0.0};
Buffer::Data(Buffer::Target::Array, 3, position);
VertexAttribArray attr(light_prog, "Position");
attr.Setup(3, DataType::Float);
attr.Enable();
}
Uniform<GLint>(light_prog, "SampleCount").Set(sample_count);
Uniform<GLfloat>(light_prog, "LightVolSize").Set(4);
UniformSampler(light_prog, "ShadowMap").Set(0);
// Setup the texture and the offscreen FBO
Texture::Active(0);
{
auto bound_tex = Bind(depth_tex, Texture::Target::CubeMap);
bound_tex.MinFilter(TextureMinFilter::Linear);
bound_tex.MagFilter(TextureMagFilter::Linear);
bound_tex.WrapS(TextureWrap::ClampToEdge);
bound_tex.WrapT(TextureWrap::ClampToEdge);
bound_tex.WrapR(TextureWrap::ClampToEdge);
bound_tex.CompareFunc(CompareFunction::LEqual);
bound_tex.CompareMode(
TextureCompareMode::CompareRefToTexture
);
for(int i=0; i!=6; ++i)
{
Texture::Image2D(
Texture::CubeMapFace(i),
0,
PixelDataInternalFormat::DepthComponent,
tex_side, tex_side,
0,
PixelDataFormat::DepthComponent,
PixelDataType::Float,
nullptr
);
}
auto bound_fbo = Bind(
depth_fbo,
Framebuffer::Target::Draw
);
bound_fbo.AttachTexture(
FramebufferAttachment::Depth,
depth_tex,
0
);
}
//
gl.ClearColor(0.2f, 0.05f, 0.1f, 0.0f);
gl.ClearDepth(1.0f);
gl.Enable(Capability::DepthTest);
gl.Enable(Capability::CullFace);
gl.FrontFace(make_shape.FaceWinding());
gl.CullFace(Face::Back);
gl.BlendFunc(BlendFunction::SrcAlpha, BlendFunction::One);
}