Thanks for the report, could You post a small test program where these errors are visible? If You are using IrrNX did You check out the latest version from cvs?
The fullscreen mode where only the upper-left corner is used
might occure if You're switching to a resolution Your OpenGL driver is not supporting.
If You're using an unpatched irrlicht v0.7 and are using my changes for the materialrenderers here's a patch for CVideoOpenGL.cpp
Patch for 2D Image problem:
search in all methods
draw2DImage where the 2D render states are set. Then cut the line with
setTexture( ...... ); and past it after the block where the renderstate is set
Example:
the original function look like this
Code: Select all
void CVideoOpenGL::draw2DImage(video::ITexture* texture, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect, SColor color, bool useAlphaChannelOfTexture)
{
....
// ok, we've clipped everything.
// now draw it.
setTexture(0, texture);
glColor4ub(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
if (useAlphaChannelOfTexture)
setRenderStates2DMode(false, true, true);
else
setRenderStates2DMode(false, true, false);
core::rect<s32> poss(targetPos, sourceSize);
...
}
change it to look like this:
Code: Select all
void CVideoOpenGL::draw2DImage(video::ITexture* texture, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect, SColor color, bool useAlphaChannelOfTexture)
{
....
// ok, we've clipped everything.
// now draw it.
if (useAlphaChannelOfTexture)
setRenderStates2DMode(false, true, true);
else
setRenderStates2DMode(false, true, false);
setTexture(0, texture);
glColor4ub(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
core::rect<s32> poss(targetPos, sourceSize);
...
}
Patch for Shadows (only minor changes,I don't remember exactly what changed, sorry)
Code: Select all
//! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do
//! this: Frist, draw all geometry. Then use this method, to draw the shadow
//! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow.
void CVideoOpenGL::drawStencilShadowVolume(const core::vector3df* triangles, s32 count, bool zfail)
{
if (!StencilBuffer || !count)
return;
// unset last 3d material
if (CurrentRenderMode == ERM_3D &&
LastMaterial.MaterialType >= 0 && LastMaterial.MaterialType < (s32)MaterialRenderers.size())
{
MaterialRenderers[LastMaterial.MaterialType]->OnUnsetMaterial();
ResetRenderStates = true;
}
// store current OpenGL state
glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT |
GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT );
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
glDepthMask(GL_FALSE);
glDepthFunc(GL_LEQUAL);
glEnable(GL_STENCIL_TEST);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); // no color buffer drawing
glStencilFunc(GL_ALWAYS, 1, 0xFFFFFFFFL );
glEnable(GL_CULL_FACE);
if (!zfail)
{
// ZPASS Method
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
glCullFace(GL_BACK);
glBegin(GL_TRIANGLES);
s32 i;
for(i = 0; i < count; ++i)
glVertex3f(triangles[i].X, triangles[i].Y, triangles[i].Z);
glEnd();
glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
glCullFace(GL_FRONT);
glBegin(GL_TRIANGLES);
for(i = 0; i < count; ++i)
glVertex3f(triangles[i].X, triangles[i].Y, triangles[i].Z);
glEnd();
}
else
{
// ZFAIL Method
glStencilOp(GL_KEEP, GL_INCR, GL_KEEP);
glCullFace(GL_FRONT);
glBegin(GL_TRIANGLES);
s32 i;
for(i = 0; i < count; i++)
glVertex3f(triangles[i].X, triangles[i].Y, triangles[i].Z);
glEnd();
glStencilOp(GL_KEEP, GL_DECR, GL_KEEP);
glCullFace(GL_BACK);
glBegin(GL_TRIANGLES);
for(i = 0; i < count; i++)
glVertex3f(triangles[i].X, triangles[i].Y, triangles[i].Z);
glEnd();
}
glPopAttrib();
}
//! Fills the stencil shadow with color. After the shadow volume has been drawn
//! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this
//! to draw the color of the shadow.
void CVideoOpenGL::drawStencilShadow(bool clearStencilBuffer, video::SColor leftUpEdge,
video::SColor rightUpEdge, video::SColor leftDownEdge, video::SColor rightDownEdge)
{
if (!StencilBuffer)
return;
glPushAttrib( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT );
glDisable( GL_LIGHTING );
glDepthMask(GL_FALSE);
glDepthFunc( GL_LEQUAL );
glEnable( GL_STENCIL_TEST );
glFrontFace( GL_CCW );
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFFL);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glDisable(GL_FOG);
glPushMatrix();
glLoadIdentity();
glBegin(GL_TRIANGLE_STRIP);
glColor4ub (leftUpEdge.getRed(), leftUpEdge.getGreen(), leftUpEdge.getBlue(), leftUpEdge.getAlpha() );
glVertex3f(-10.1f, 10.1f,0.90f);
glColor4ub (leftDownEdge.getRed(), leftDownEdge.getGreen(), leftDownEdge.getBlue(), leftDownEdge.getAlpha() );
glVertex3f(-10.1f,-10.1f,0.90f);
glColor4ub (rightUpEdge.getRed(), rightUpEdge.getGreen(), rightUpEdge.getBlue(), rightUpEdge.getAlpha() );
glVertex3f( 10.1f, 10.1f,0.90f);
glColor4ub (rightDownEdge.getRed(), rightDownEdge.getGreen(), rightDownEdge.getBlue(), rightDownEdge.getAlpha() );
glVertex3f( 10.1f,-10.1f,0.90f);
glEnd();
glPopMatrix();
glPopAttrib();
if (clearStencilBuffer)
glClear(GL_STENCIL_BUFFER_BIT);
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
}
Thanks again for the report.