Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pidc.cpp reference to DrawPolygonTessellated as used glu tesse… #47

Merged
merged 1 commit into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ SET(SRC ${SRCS} ${HDRS} ${SRC_LIBTESS2} ${SRC_TINYXML} ${SRC_PLUGINGL})
## EG: add_library(${PACKAGE_NAME} SHARED ${SRCS} ${SRC_NMEA0183})
##================================================================================

ADD_LIBRARY(${PACKAGE_NAME} STATIC ${SRC})
ADD_LIBRARY(${PACKAGE_NAME} SHARED ${SRC})
#Add_Library (${PACKAGE_NAME} is used below. Cannot use same name.


Expand Down Expand Up @@ -440,3 +440,5 @@ INCLUDE("cmake/PluginGL.cmake")
INCLUDE("cmake/PluginInstall.cmake")
INCLUDE("cmake/PluginLocalization.cmake")
INCLUDE("cmake/PluginPackage.cmake")
get_target_property(OUT ${PACKAGE_NAME} LINK_LIBRARIES)
message(STATUS "Libraries: ${OUT}")
2 changes: 1 addition & 1 deletion cmake/PluginConfigure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ else(MSVC)
endif(MSVC)

set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
set(BUILD_SHARED_LIBS FALSE)
set(BUILD_SHARED_LIBS TRUE)

# Allow multiprocess compile
if(MSVC)
Expand Down
3 changes: 2 additions & 1 deletion cmake/PluginGL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ SET(SRC_PLUGINGL
if(UNIX)
add_definitions("-fpic")
endif(UNIX)
ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINGL ${SRC_PLUGINGL})

ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINGL STATIC ${SRC_PLUGINGL})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${PACKAGE_NAME}_LIB_PLUGINGL )
2 changes: 1 addition & 1 deletion cmake/PluginJSON.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ ENDIF(QT_ANDROID)
message(STATUS "PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/jsoncpp)

ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINJSON ${SRC_JSON})
ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINJSON STATIC ${SRC_JSON})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${PACKAGE_NAME}_LIB_PLUGINJSON )
message(STATUS "Add Library ${PACKAGE_NAME}_LIB_PLUGINJSON")
2 changes: 1 addition & 1 deletion cmake/PluginNMEA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ SET(SRC_NMEA0183

INCLUDE_DIRECTORIES(src/nmea0183)

ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINNMEA0183 ${SRC_NMEA0183})
ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINNMEA0183 STATIC ${SRC_NMEA0183})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${PACKAGE_NAME}_LIB_PLUGINNMEA0183 )
2 changes: 1 addition & 1 deletion cmake/PluginXML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SET(SRC_TINYXML
src/tinyxml/tinyxmlparser.cpp
src/tinyxml/tinyxmlerror.cpp
)
ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINXML ${SRC_TINYXML})
ADD_LIBRARY(${PACKAGE_NAME}_LIB_PLUGINXML STATIC ${SRC_TINYXML})
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${PACKAGE_NAME}_LIB_PLUGINXML )
ENDIF(WIN32)

Expand Down
103 changes: 0 additions & 103 deletions src/plugingl/pidc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,11 +1349,6 @@ void piDC::DrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffse
#endif

#ifdef USE_ANDROID_GLES2
if(n > 4)
DrawPolygonTessellated( n, points, xoffset, yoffset);
else{ // n = 3 or 4, most common case for pre-tesselated shapes


// Grow the work buffer as necessary
if( workBufSize < (size_t)n*2 ){
workBuf = (float *)realloc(workBuf, (n*4) * sizeof(float));
Expand Down Expand Up @@ -1434,9 +1429,6 @@ void piDC::DrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffse
GLint matlocf = glGetUniformLocation(pi_color_tri_shader_program,"TransformMatrix");
glUniformMatrix4fv( matlocf, 1, GL_FALSE, (const GLfloat*)IM);

}


#else

if( ConfigureBrush() ) {
Expand Down Expand Up @@ -1618,101 +1610,6 @@ void pi_odc_endCallbackD_GLSL(void *data)

#endif //#ifdef ocpnUSE_GL

void piDC::DrawPolygonTessellated( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset )
{
if( dc )
dc->DrawPolygon( n, points, xoffset, yoffset );
#ifdef ocpnUSE_GL
else {
#if !defined(ocpnUSE_GLES) || defined(USE_ANDROID_GLES2) // tessalator in glues is broken
if( n < 5 )
# endif
{
DrawPolygon( n, points, xoffset, yoffset );
return;
}



#ifdef USE_ANDROID_GLES2
m_tobj = gluNewTess();
s_odc_tess_vertex_idx = 0;

gluTessCallback( m_tobj, GLU_TESS_VERTEX_DATA, (_GLUfuncptr) &pi_odc_vertexCallbackD_GLSL );
gluTessCallback( m_tobj, GLU_TESS_BEGIN_DATA, (_GLUfuncptr) &pi_odc_beginCallbackD_GLSL );
gluTessCallback( m_tobj, GLU_TESS_END_DATA, (_GLUfuncptr) &pi_odc_endCallbackD_GLSL );
gluTessCallback( m_tobj, GLU_TESS_COMBINE_DATA, (_GLUfuncptr) &pi_odc_combineCallbackD );
//s_tessVP = vp;

gluTessNormal( m_tobj, 0, 0, 1);
gluTessProperty( m_tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_NONZERO );

if( ConfigureBrush() ) {
gluTessBeginPolygon( m_tobj, this );
gluTessBeginContour( m_tobj );

for( int i = 0; i < n; i++ ) {
double *p = new double[6];
p[0] = points[i].x, p[1] = points[i].y, p[2] = 0;
gluTessVertex(m_tobj, p, p);
//odc_combine_work_data.push_back(p);

}
gluTessEndContour( m_tobj );
gluTessEndPolygon( m_tobj );
}

gluDeleteTess(m_tobj);


// for(std::list<double*>::iterator i = odc_combine_work_data.begin(); i!=odc_combine_work_data.end(); i++)
// delete [] *i;
// odc_combine_work_data.clear();

}
#else
static GLUtesselator *tobj = NULL;
if( ! tobj ) tobj = gluNewTess();

gluTessCallback( tobj, GLU_TESS_VERTEX, (_GLUfuncptr) &piDCvertexCallback );
gluTessCallback( tobj, GLU_TESS_BEGIN, (_GLUfuncptr) &piDCbeginCallback );
gluTessCallback( tobj, GLU_TESS_END, (_GLUfuncptr) &piDCendCallback );
gluTessCallback( tobj, GLU_TESS_COMBINE, (_GLUfuncptr) &piDCcombineCallback );
gluTessCallback( tobj, GLU_TESS_ERROR, (_GLUfuncptr) &piDCerrorCallback );

gluTessNormal( tobj, 0, 0, 1);
gluTessProperty( tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_NONZERO );

if( ConfigureBrush() ) {
gluTessBeginPolygon( tobj, NULL );
gluTessBeginContour( tobj );

for( int i = 0; i < n; i++ ) {
GLvertex* vertex = new GLvertex();
pi_gTesselatorVertices.Add( vertex );
vertex->info.x = (GLdouble) points[i].x;
vertex->info.y = (GLdouble) points[i].y;
vertex->info.z = (GLdouble) 0.0;
vertex->info.r = (GLdouble) 0.0;
vertex->info.g = (GLdouble) 0.0;
vertex->info.b = (GLdouble) 0.0;
gluTessVertex( tobj, (GLdouble*)vertex, (GLdouble*)vertex );
}
gluTessEndContour( tobj );
gluTessEndPolygon( tobj );
}

for( unsigned int i=0; i<pi_gTesselatorVertices.Count(); i++ )
delete (GLvertex*)pi_gTesselatorVertices.Item(i);
pi_gTesselatorVertices.Clear();

gluDeleteTess(tobj);

}
#endif
#endif
}

void piDC::StrokePolygon( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, float scale )
{
#if wxUSE_GRAPHICS_CONTEXT
Expand Down
4 changes: 0 additions & 4 deletions src/plugingl/pidc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
#include <wx/glcanvas.h>
#endif

//class ViewPort;
class GLUtesselator;

#ifndef DECL_EXP
#ifdef __WXMSW__
# define DECL_EXP __declspec(dllexport)
Expand Down Expand Up @@ -107,7 +104,6 @@ class piDC

void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, float scale =1.0, float angle = 0.0);
void DrawPolygonTessellated(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
void StrokePolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, float scale = 1.0);

void DrawBitmap(const wxBitmap &bitmap, wxCoord x, wxCoord y, bool usemask);
Expand Down