Implements PolygonOffset

TRAC #11719 Signed-off-by: Nicolas Capens Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/trunk@208 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent c3a0e946
......@@ -1382,7 +1382,18 @@ void Context::applyState(GLenum drawMode)
if (polygonOffsetFill)
{
UNIMPLEMENTED(); // FIXME
gl::Depthbuffer *depthbuffer = getFramebuffer()->getDepthbuffer();
if (depthbuffer)
{
device->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, *((DWORD*)&polygonOffsetFactor));
float depthBias = ldexp(polygonOffsetUnits, -(int)(depthbuffer->getDepthSize()));
device->SetRenderState(D3DRS_DEPTHBIAS, *((DWORD*)&depthBias));
}
}
else
{
device->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, 0);
device->SetRenderState(D3DRS_DEPTHBIAS, 0);
}
if (sampleAlphaToCoverage)
......
......@@ -3448,9 +3448,12 @@ void __stdcall glPolygonOffset(GLfloat factor, GLfloat units)
try
{
if (factor != 0.0f || units != 0.0f)
gl::Context *context = gl::getContext();
if (context)
{
UNIMPLEMENTED(); // FIXME
context->polygonOffsetFactor = factor;
context->polygonOffsetUnits = units;
}
}
catch(std::bad_alloc&)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment