KiCad PCB EDA Suite
opengl_gal.cpp File Reference
#include <gal/opengl/opengl_gal.h>
#include <gal/opengl/utils.h>
#include <gal/definitions.h>
#include <gl_context_mgr.h>
#include <geometry/shape_poly_set.h>
#include <text_utils.h>
#include <macros.h>
#include <limits>
#include <functional>
#include "gl_resources.h"
#include "gl_builtin_shaders.h"

Go to the source code of this file.

Functions

static void InitTesselatorCallbacks (GLUtesselator *aTesselator)
 
void CALLBACK VertexCallback (GLvoid *aVertexPtr, void *aData)
 
void CALLBACK CombineCallback (GLdouble coords[3], GLdouble *vertex_data[4], GLfloat weight[4], GLdouble **dataOut, void *aData)
 
void CALLBACK EdgeCallback (GLboolean aEdgeFlag)
 
void CALLBACK ErrorCallback (GLenum aErrorCode)
 

Variables

static const int glAttributes [] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 8, 0 }
 

Function Documentation

void CALLBACK CombineCallback ( GLdouble  coords[3],
GLdouble *  vertex_data[4],
GLfloat  weight[4],
GLdouble **  dataOut,
void *  aData 
)

Definition at line 1846 of file opengl_gal.cpp.

References KIGFX::OPENGL_GAL::TessParams::intersectPoints.

Referenced by InitTesselatorCallbacks().

1849 {
1850  GLdouble* vertex = new GLdouble[3];
1851  OPENGL_GAL::TessParams* param = static_cast<OPENGL_GAL::TessParams*>( aData );
1852 
1853  // Save the pointer so we can delete it later
1854  param->intersectPoints.push_back( boost::shared_array<GLdouble>( vertex ) );
1855 
1856  memcpy( vertex, coords, 3 * sizeof(GLdouble) );
1857 
1858  *dataOut = vertex;
1859 }
std::deque< boost::shared_array< GLdouble > > & intersectPoints
Intersect points, that have to be freed after tessellation.
Definition: opengl_gal.h:283
void CALLBACK EdgeCallback ( GLboolean  aEdgeFlag)

Definition at line 1862 of file opengl_gal.cpp.

Referenced by InitTesselatorCallbacks().

1863 {
1864  // This callback is needed to force GLU tesselator to use triangles only
1865 }
void CALLBACK ErrorCallback ( GLenum  aErrorCode)

Definition at line 1868 of file opengl_gal.cpp.

Referenced by InitTesselatorCallbacks().

1869 {
1870  //throw std::runtime_error( std::string( "Tessellation error: " ) +
1871  //std::string( (const char*) gluErrorString( aErrorCode ) );
1872 }
static void InitTesselatorCallbacks ( GLUtesselator *  aTesselator)
static

Definition at line 1875 of file opengl_gal.cpp.

References CALLBACK, CombineCallback(), EdgeCallback(), ErrorCallback(), and VertexCallback().

Referenced by KIGFX::OPENGL_GAL::OPENGL_GAL().

1876 {
1877  gluTessCallback( aTesselator, GLU_TESS_VERTEX_DATA, ( void (CALLBACK*)() )VertexCallback );
1878  gluTessCallback( aTesselator, GLU_TESS_COMBINE_DATA, ( void (CALLBACK*)() )CombineCallback );
1879  gluTessCallback( aTesselator, GLU_TESS_EDGE_FLAG, ( void (CALLBACK*)() )EdgeCallback );
1880  gluTessCallback( aTesselator, GLU_TESS_ERROR, ( void (CALLBACK*)() )ErrorCallback );
1881 }
void CALLBACK EdgeCallback(GLboolean aEdgeFlag)
void CALLBACK VertexCallback(GLvoid *aVertexPtr, void *aData)
void CALLBACK ErrorCallback(GLenum aErrorCode)
void CALLBACK CombineCallback(GLdouble coords[3], GLdouble *vertex_data[4], GLfloat weight[4], GLdouble **dataOut, void *aData)
#define CALLBACK
Definition: opengl_gal.h:49
void CALLBACK VertexCallback ( GLvoid *  aVertexPtr,
void *  aData 
)

Definition at line 1835 of file opengl_gal.cpp.

References KIGFX::OPENGL_GAL::TessParams::vboManager, and KIGFX::VERTEX_MANAGER::Vertex().

Referenced by InitTesselatorCallbacks().

1836 {
1837  GLdouble* vertex = static_cast<GLdouble*>( aVertexPtr );
1838  OPENGL_GAL::TessParams* param = static_cast<OPENGL_GAL::TessParams*>( aData );
1839  VERTEX_MANAGER* vboManager = param->vboManager;
1840 
1841  assert( vboManager );
1842  vboManager->Vertex( vertex[0], vertex[1], vertex[2] );
1843 }
bool Vertex(const VERTEX &aVertex)
Function Vertex() adds a vertex with the given coordinates to the currently set item.
VERTEX_MANAGER * vboManager
Manager used for storing new vertices.
Definition: opengl_gal.h:280

Variable Documentation

const int glAttributes[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 8, 0 }
static

Definition at line 58 of file opengl_gal.cpp.