mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
Implement GraphicsDrawer::_initStates()
This commit is contained in:
parent
09a5b414c4
commit
809987b515
|
@ -74,6 +74,11 @@ void Context::clearDepthBuffer()
|
|||
m_impl->clearDepthBuffer();
|
||||
}
|
||||
|
||||
void Context::setPolygonOffset(f32 _factor, f32 _units)
|
||||
{
|
||||
m_impl->setPolygonOffset(_factor, _units);
|
||||
}
|
||||
|
||||
ObjectHandle Context::createTexture(Parameter _target)
|
||||
{
|
||||
return m_impl->createTexture(_target);
|
||||
|
|
|
@ -51,6 +51,8 @@ namespace graphics {
|
|||
|
||||
void clearDepthBuffer();
|
||||
|
||||
void setPolygonOffset(f32 _factor, f32 _units);
|
||||
|
||||
/*---------------Texture-------------*/
|
||||
|
||||
ObjectHandle createTexture(Parameter _target);
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace graphics {
|
|||
virtual void setBlendColor(f32 _red, f32 _green, f32 _blue, f32 _alpha) = 0;
|
||||
virtual void clearColorBuffer(f32 _red, f32 _green, f32 _blue, f32 _alpha) = 0;
|
||||
virtual void clearDepthBuffer() = 0;
|
||||
virtual void setPolygonOffset(f32 _factor, f32 _units) = 0;
|
||||
virtual ObjectHandle createTexture(Parameter _target) = 0;
|
||||
virtual void deleteTexture(ObjectHandle _name) = 0;
|
||||
virtual void init2DTexture(const Context::InitTextureParams & _params) = 0;
|
||||
|
|
|
@ -138,6 +138,11 @@ void ContextImpl::clearDepthBuffer()
|
|||
enableScissor->enable(true);
|
||||
}
|
||||
|
||||
void ContextImpl::setPolygonOffset(f32 _factor, f32 _units)
|
||||
{
|
||||
glPolygonOffset(_factor, _units);
|
||||
}
|
||||
|
||||
/*---------------Texture-------------*/
|
||||
|
||||
graphics::ObjectHandle ContextImpl::createTexture(graphics::Parameter _target)
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace opengl {
|
|||
|
||||
void clearDepthBuffer() override;
|
||||
|
||||
void setPolygonOffset(f32 _factor, f32 _units) override;
|
||||
|
||||
/*---------------Texture-------------*/
|
||||
|
||||
graphics::ObjectHandle createTexture(graphics::Parameter _target) override;
|
||||
|
|
|
@ -1494,3 +1494,34 @@ void GraphicsDrawer::blitOrCopyTexturedRect(const BlitOrCopyRectParams & _params
|
|||
|
||||
copyTexturedRect(_params);
|
||||
}
|
||||
|
||||
void GraphicsDrawer::_initStates()
|
||||
{
|
||||
gfxContext.enable(enable::CULL_FACE, false);
|
||||
gfxContext.enable(enable::SCISSOR_TEST, true);
|
||||
gfxContext.enableDepthWrite(false);
|
||||
gfxContext.setDepthCompare(compare::ALWAYS);
|
||||
|
||||
if (config.frameBufferEmulation.N64DepthCompare != 0) {
|
||||
gfxContext.enable(enable::DEPTH_TEST, false);
|
||||
gfxContext.enable(enable::POLYGON_OFFSET_FILL, false);
|
||||
}
|
||||
else {
|
||||
gfxContext.enable(enable::DEPTH_TEST, true);
|
||||
#ifdef ANDROID
|
||||
if (config.generalEmulation.forcePolygonOffset != 0)
|
||||
gfxContext.setPolygonOffset(config.generalEmulation.polygonOffsetFactor, config.generalEmulation.polygonOffsetUnits);
|
||||
else
|
||||
#endif
|
||||
gfxContext.setPolygonOffset(-3.0f, -3.0f);
|
||||
}
|
||||
|
||||
DisplayWindow & wnd = DisplayWindow::get();
|
||||
glViewport(0, wnd.getHeightOffset(), wnd.getScreenWidth(), wnd.getScreenHeight());
|
||||
|
||||
gfxContext.clearColorBuffer(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
srand(time(nullptr));
|
||||
|
||||
wnd.swapBuffers();
|
||||
}
|
||||
|
|
|
@ -141,7 +141,6 @@ public:
|
|||
private:
|
||||
GraphicsDrawer(const GraphicsDrawer &);
|
||||
|
||||
void _initExtensions();
|
||||
void _initStates();
|
||||
void _initData();
|
||||
void _destroyData();
|
||||
|
|
Loading…
Reference in New Issue
Block a user