KiCad PCB EDA Suite
KIGFX::ANTIALIASING_SUPERSAMPLING Class Reference

#include <antialiasing.h>

Inheritance diagram for KIGFX::ANTIALIASING_SUPERSAMPLING:
KIGFX::OPENGL_PRESENTOR

Public Member Functions

 ANTIALIASING_SUPERSAMPLING (OPENGL_COMPOSITOR *aCompositor)
 
bool Init () override
 
unsigned int CreateBuffer () override
 
VECTOR2U GetInternalBufferSize () override
 
void OnLostBuffers () override
 
void Begin () override
 
void DrawBuffer (GLuint) override
 
void Present () override
 

Private Attributes

OPENGL_COMPOSITORcompositor
 
unsigned int ssaaMainBuffer
 
bool areBuffersCreated
 
bool areShadersCreated
 

Detailed Description

Definition at line 74 of file antialiasing.h.

Constructor & Destructor Documentation

◆ ANTIALIASING_SUPERSAMPLING()

ANTIALIASING_SUPERSAMPLING::ANTIALIASING_SUPERSAMPLING ( OPENGL_COMPOSITOR aCompositor)

Definition at line 137 of file antialiasing.cpp.

137 :
138 compositor( aCompositor ),
139 ssaaMainBuffer( 0 ), areBuffersCreated( false ), areShadersCreated( false )
140{
141}
OPENGL_COMPOSITOR * compositor
Definition: antialiasing.h:90

Member Function Documentation

◆ Begin()

void ANTIALIASING_SUPERSAMPLING::Begin ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 167 of file antialiasing.cpp.

168{
171}
static const COLOR4D BLACK
Definition: color4d.h:382
virtual void ClearBuffer(const COLOR4D &aColor) override
Clear the selected buffer (set by the SetBuffer() function).
virtual void SetBuffer(unsigned int aBufferHandle) override
Set the selected buffer as the rendering target.

References KIGFX::COLOR4D::BLACK, KIGFX::OPENGL_COMPOSITOR::ClearBuffer(), compositor, KIGFX::OPENGL_COMPOSITOR::SetBuffer(), and ssaaMainBuffer.

◆ CreateBuffer()

unsigned int ANTIALIASING_SUPERSAMPLING::CreateBuffer ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 198 of file antialiasing.cpp.

199{
201}
VECTOR2U GetInternalBufferSize() override
virtual unsigned int CreateBuffer() override
Prepare a new buffer that may be used as a rendering target.

References compositor, KIGFX::OPENGL_COMPOSITOR::CreateBuffer(), and GetInternalBufferSize().

◆ DrawBuffer()

void ANTIALIASING_SUPERSAMPLING::DrawBuffer ( GLuint  aBuffer)
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 174 of file antialiasing.cpp.

175{
177}
virtual void DrawBuffer(unsigned int aBufferHandle) override
Draw the selected buffer to the output buffer.

References compositor, KIGFX::OPENGL_COMPOSITOR::DrawBuffer(), and ssaaMainBuffer.

◆ GetInternalBufferSize()

VECTOR2U ANTIALIASING_SUPERSAMPLING::GetInternalBufferSize ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 161 of file antialiasing.cpp.

162{
163 return compositor->GetScreenSize() * 2;
164}

References compositor, and KIGFX::OPENGL_COMPOSITOR::GetScreenSize().

Referenced by CreateBuffer().

◆ Init()

bool ANTIALIASING_SUPERSAMPLING::Init ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 144 of file antialiasing.cpp.

145{
146 areShadersCreated = false;
147
148 if( !areBuffersCreated )
149 {
151 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
152 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
153
154 areBuffersCreated = true;
155 }
156
157 return true;
158}

References areBuffersCreated, areShadersCreated, compositor, KIGFX::OPENGL_COMPOSITOR::CreateBuffer(), and ssaaMainBuffer.

◆ OnLostBuffers()

void ANTIALIASING_SUPERSAMPLING::OnLostBuffers ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 192 of file antialiasing.cpp.

193{
194 areBuffersCreated = false;
195}

References areBuffersCreated.

◆ Present()

void ANTIALIASING_SUPERSAMPLING::Present ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 180 of file antialiasing.cpp.

181{
182 glDisable( GL_BLEND );
183 glDisable( GL_DEPTH_TEST );
184 glActiveTexture( GL_TEXTURE0 );
185 glBindTexture( GL_TEXTURE_2D, compositor->GetBufferTexture( ssaaMainBuffer ) );
187
188 draw_fullscreen_primitive();
189}
static const unsigned int DIRECT_RENDERING
GLenum GetBufferTexture(unsigned int aBufferHandle)

References compositor, KIGFX::OPENGL_COMPOSITOR::DIRECT_RENDERING, KIGFX::OPENGL_COMPOSITOR::GetBufferTexture(), KIGFX::OPENGL_COMPOSITOR::SetBuffer(), and ssaaMainBuffer.

Member Data Documentation

◆ areBuffersCreated

bool KIGFX::ANTIALIASING_SUPERSAMPLING::areBuffersCreated
private

Definition at line 93 of file antialiasing.h.

Referenced by Init(), and OnLostBuffers().

◆ areShadersCreated

bool KIGFX::ANTIALIASING_SUPERSAMPLING::areShadersCreated
private

Definition at line 95 of file antialiasing.h.

Referenced by Init().

◆ compositor

OPENGL_COMPOSITOR* KIGFX::ANTIALIASING_SUPERSAMPLING::compositor
private

Definition at line 90 of file antialiasing.h.

Referenced by Begin(), CreateBuffer(), DrawBuffer(), GetInternalBufferSize(), Init(), and Present().

◆ ssaaMainBuffer

unsigned int KIGFX::ANTIALIASING_SUPERSAMPLING::ssaaMainBuffer
private

Definition at line 92 of file antialiasing.h.

Referenced by Begin(), DrawBuffer(), Init(), and Present().


The documentation for this class was generated from the following files: