Browse Source

tutorial: fix the FBO demo on the Xbox360.

legacy
Sam Hocevar sam 12 years ago
parent
commit
1c5cdd8c50
2 changed files with 18 additions and 3 deletions
  1. +13
    -0
      tutorial/08_fbo.cpp
  2. +5
    -3
      tutorial/08_fbo.lolfx

+ 13
- 0
tutorial/08_fbo.cpp View File

@@ -90,6 +90,19 @@ public:
/* FIXME: we should just disable depth test in the shader */
Video::Clear(ClearMask::Depth);
m_shader->Bind();

#if _XBOX
/* FIXME: the Xbox enforces full EDRAM clears on each frame, so
* we cannot expect the render target contents to be preserved.
* This code snippet should be moved inside the FrameBuffer class. */
m_shader->SetUniform(m_uni_flag, 1.f);
m_shader->SetUniform(m_uni_texture, m_fbo->GetTexture(), 0);
m_vdecl->SetStream(m_vbo, m_coord);
m_vdecl->Bind();
m_vdecl->DrawElements(MeshPrimitive::Triangles, 0, 2);
m_vdecl->Unbind();
#endif

m_shader->SetUniform(m_uni_flag, 0.f);
m_shader->SetUniform(m_uni_point, m_hotspot);
m_shader->SetUniform(m_uni_color, m_color);


+ 5
- 3
tutorial/08_fbo.lolfx View File

@@ -34,7 +34,7 @@ void main(void)
float tc = 0.0, ta = 0.0;
{
float s = 6.0 + 3.0 * in_Point.z;
vec2 p = pass_Position - in_Point.xy * 0.8;
vec2 p = pass_Position - in_Point.xy * 0.9;
float t = clamp(1.2 - dot(s * p, s * p), 0.0, 1.0);
float u = t * t * t * t;
tc += 3.0 * t * t - 2.0 * t * t * t;
@@ -74,7 +74,7 @@ void main(in float2 pass_Position : TEXCOORD0,
float tc = 0.0, ta = 0.0;
{
float s = 6.0 + 3.0 * in_Point.z;
float2 p = pass_Position - in_Point.xy * 0.8;
float2 p = pass_Position - in_Point.xy * 0.9;
float t = clamp(1.2 - dot(s * p, s * p), 0.0, 1.0);
float u = t * t * t * t;
tc += 3.0 * t * t - 2.0 * t * t * t;
@@ -85,7 +85,9 @@ void main(in float2 pass_Position : TEXCOORD0,
}
else
{
float2 texcoords = pass_Position * 0.5 + float2(0.5, 0.5);
float2 texcoords = pass_Position * float2(0.5, -0.5) + float2(0.5, 0.5);
/* FIXME: this should be passed as a uniform or something */
texcoords += float2(0.5 / 800.0, 0.5 / 600.0);
out_FragColor = float4(tex2D(in_Texture, texcoords).xyz, 1.0);
}
}


Loading…
Cancel
Save