Fixed frame buffer depth issues for all render paths, consolidated the code

This commit is contained in:
Jens Hemprich 2007-08-20 11:10:48 +00:00
parent eb31a1311e
commit e931b834dd
4 changed files with 16 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,6 @@ public:
void free_buffers();
void initialise_format(GrLfbWriteMode_t format);
bool begin_write();
void end_write();
void end_write(FxU32 alpha, GLfloat depth);
void end_write_opaque();
inline FxU16 GetChromaKeyValue() {return m_ChromaKey.Scalar;};
@ -40,8 +39,7 @@ public:
}
protected:
void Clear();
void draw(const tilesize* tilesizetable);
void drawCompiledVertexArrays(const tilesize* tilesizetable, int vertexarrayindex, int tilecount);
int buildVertexArrays();
int buildVertexArrays(const tilesize* tilesizetable, int vertexarrayindex);
void set_gl_state();
void restore_gl_state();
@ -107,4 +105,8 @@ private:
vector bool short Vector;
#endif
} m_ChromaKey;
//#ifdef DEBUG_TILE_RENDERING
protected:
static void highlightTileCorners(const Framebuffer::TileUpdateState updateState, FxU32* texbuffer, const GLint x_step, const GLint y_step);
//#endif
};

View File

@ -82,9 +82,9 @@ void RenderInitialize(void)
GlideMsg( "RenderInitialize()\n");
#endif
glReportErrors("RenderInitialize");
// initialise triagle buffers
// Allocate vertex array buffers
OGLRender.NumberOfTriangles = 0;
const int triangles = InternalConfig.EXT_compiled_vertex_array ? OGLRender.FrameBufferStartIndex + 2 * Framebuffer::MaxTiles * Framebuffer::MaxTiles : OGLRender.FrameBufferStartIndex;
const int triangles = OGLRender.FrameBufferStartIndex + 2 * Framebuffer::MaxTiles * Framebuffer::MaxTiles;
// Framebuffer utilises color, vertex and texture array only
OGLRender.TColor = (TColorStruct*) AllocBuffer(triangles, sizeof(TColorStruct));
if (OpenGL.ColorAlphaUnit2 == 0)
@ -585,10 +585,10 @@ void RenderDrawTriangles_impl( void )
glReportError();
}
}
if ( use_two_tex )
if (use_two_tex)
{
glActiveTextureARB(OpenGL.ColorAlphaUnit1 + 1);
if (InternalConfig.EXT_compiled_vertex_array)
if (use_compiled_vertex_arrays)
{
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer( 4, GL_FLOAT, 0, NULL);

View File

@ -362,7 +362,7 @@ void GlideFramebuffer::OnBeforeBufferClear()
m_bufferclearcalls++;
if (m_bufferclearcalls == 2)
{
// Trigger write in order to render cockpit layer before the retro mirror 3D-view
// Trigger write in order to render cockpit layer before the retro mirror 3D-view
#ifdef OGL_FRAMEBUFFER
GlideMsg( "Triggering write in order to render cockpit layer before the retro mirror 3D-view\n");
#endif
@ -550,10 +550,7 @@ void GlideFramebuffer::WriteFrameBuffer()
}
else
{
end_write();
// @todo: it would be nice to eleminate the condition,but
// m_alpha is always applied to the write and depth never
// end_write(m_alpha, m_depth);
end_write(0x000000ff, OpenGL.ZNear);
}
}
else
@ -632,15 +629,15 @@ void GlideFramebuffer::SetAlpha(FxU32 alpha)
if (m_must_write && m_framebuffer->PixelPipeline && m_alpha != alpha)
{
WriteFrameBuffer();
m_alpha = alpha;
}
};
m_alpha = alpha;
}
void GlideFramebuffer::SetDepth(GLfloat depth)
{
if (m_must_write && m_framebuffer->PixelPipeline && m_depth != depth)
{
WriteFrameBuffer();
m_depth = depth;
}
};
m_depth = depth;
}