fix depth buffer creation
This commit is contained in:
@@ -542,6 +542,8 @@
|
|||||||
<None Include="data\shaders\texture-alpha-sep.glsl" />
|
<None Include="data\shaders\texture-alpha-sep.glsl" />
|
||||||
<None Include="data\shaders\texture-alpha.glsl" />
|
<None Include="data\shaders\texture-alpha.glsl" />
|
||||||
<None Include="data\shaders\texture-blend.glsl" />
|
<None Include="data\shaders\texture-blend.glsl" />
|
||||||
|
<None Include="data\shaders\texture-colorize.glsl" />
|
||||||
|
<None Include="data\shaders\texture-mask.glsl" />
|
||||||
<None Include="data\shaders\texture.glsl" />
|
<None Include="data\shaders\texture.glsl" />
|
||||||
<None Include="data\shaders\uvs.glsl" />
|
<None Include="data\shaders\uvs.glsl" />
|
||||||
<None Include="data\shaders\vertex-color.glsl" />
|
<None Include="data\shaders\vertex-color.glsl" />
|
||||||
|
|||||||
@@ -685,6 +685,12 @@
|
|||||||
<None Include="data\shaders\color-tri.glsl">
|
<None Include="data\shaders\color-tri.glsl">
|
||||||
<Filter>shaders</Filter>
|
<Filter>shaders</Filter>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="data\shaders\texture-colorize.glsl">
|
||||||
|
<Filter>shaders</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="data\shaders\texture-mask.glsl">
|
||||||
|
<Filter>shaders</Filter>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="icon.ico">
|
<Image Include="icon.ico">
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ void main()
|
|||||||
[[fragment]]
|
[[fragment]]
|
||||||
|
|
||||||
uniform sampler2D tex;
|
uniform sampler2D tex;
|
||||||
uniform vec4 col;
|
uniform mediump vec4 col;
|
||||||
|
|
||||||
in mediump vec2 uv;
|
in mediump vec2 uv;
|
||||||
out mediump vec4 frag;
|
out mediump vec4 frag;
|
||||||
|
|||||||
@@ -757,7 +757,7 @@ int main(int argc, char** argv)
|
|||||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
||||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||||
pfd.cColorBits = 32;
|
pfd.cColorBits = 32;
|
||||||
pfd.cDepthBits = 16;
|
pfd.cDepthBits = 24;
|
||||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||||
|
|
||||||
hDC = GetDC(hWnd);
|
hDC = GetDC(hWnd);
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ void NodePanelGrid::draw_heightmap(const glm::mat4& proj, const glm::mat4& camer
|
|||||||
{
|
{
|
||||||
if (m_groud_opacity->get_value() > 0.f)
|
if (m_groud_opacity->get_value() > 0.f)
|
||||||
{
|
{
|
||||||
|
bool depth = glIsEnabled(GL_DEPTH_TEST);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
@@ -313,6 +314,7 @@ void NodePanelGrid::draw_heightmap(const glm::mat4& proj, const glm::mat4& camer
|
|||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
depth ? glEnable(GL_DEPTH_TEST) : glDisable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
src/rtt.cpp
10
src/rtt.cpp
@@ -137,7 +137,7 @@ bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format,
|
|||||||
{
|
{
|
||||||
glGenRenderbuffers(1, &rboID);
|
glGenRenderbuffers(1, &rboID);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, rboID);
|
glBindRenderbuffer(GL_RENDERBUFFER, rboID);
|
||||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,9 +151,11 @@ bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format,
|
|||||||
|
|
||||||
// Attach the texture to FBO color attachment point
|
// Attach the texture to FBO color attachment point
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texID, 0);
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texID, 0);
|
||||||
|
if (depth_buffer)
|
||||||
// Attach the renderbuffer to depth attachment point
|
{
|
||||||
//glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboID);
|
// Attach the renderbuffer to depth attachment point
|
||||||
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboID);
|
||||||
|
}
|
||||||
|
|
||||||
auto err2str = [](GLenum err) {
|
auto err2str = [](GLenum err) {
|
||||||
switch (err)
|
switch (err)
|
||||||
|
|||||||
Reference in New Issue
Block a user