Skip to content
New issue

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

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

Already on GitHub? # to your account

Fixes for Chart grid/axes rendering and Feetype linking with Hunter #185

Merged
merged 3 commits into from
Nov 17, 2018
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
5 changes: 2 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ configuration:
# - Release

cache:
- C:/vcpkg/installed/ -> appveyor.yml
- C:/vcpkg/scripts/ -> appveyor.yml
- C:/vcpkg/ -> appveyor.yml

build:
parallel: true # enable MSBuild parallel builds
Expand All @@ -140,6 +139,6 @@ build_script:
- cd %APPVEYOR_BUILD_FOLDER%
- mkdir build
- cd build
- cmake %APPVEYOR_BUILD_FOLDER% -G "%generator%" -DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/build/package -DBOOST_ROOT="%BOOST_ROOT%" -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DFreeImage_ROOT="c:/vcpkg/installed/x64-windows"
- cmake %APPVEYOR_BUILD_FOLDER% -G "%generator%" -DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/build/package -DBOOST_ROOT="%BOOST_ROOT%" -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DFreeImage_ROOT="c:/vcpkg/installed/x64-windows" -DCMAKE_BUILD_TYPE:STRING=%configuration%
- cmake --build . --target ALL_BUILD --config %configuration% -- /nologo
- cmake --build . --target INSTALL --config %configuration% -- /nologo
6 changes: 5 additions & 1 deletion src/backend/opengl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,17 @@ target_link_libraries(${BackendTarget}
glbinding::glbinding
$<$<NOT:$<CONFIG:Release>>:glbinding::glbinding-aux>
glm
Freetype::Freetype
Boost::boost
backend_interface
wtk_interface
c_api_interface
cpp_api_interface
)
if (FG_ENABLE_HUNTER)
target_link_libraries(${BackendTarget} PRIVATE freetype::freetype)
else ()
target_link_libraries(${BackendTarget} PRIVATE Freetype::Freetype)
endif ()

if(UNIX)
target_link_libraries(${BackendTarget}
Expand Down
17 changes: 11 additions & 6 deletions src/backend/opengl/chart_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ void chart2d_impl::generateChartData()
pushPoint(decorData, 1.0f, 0.0f);
pushPoint(decorData, 0.0f,-1.0f);
pushPoint(decorData, 0.0f, 1.0f);
for (int i=1; i<=ticksLeft; ++i) {
for (int i=1; i<ticksLeft; ++i) {
float delta = i*step;
pushPoint(decorData, -1.0f,-delta);
pushPoint(decorData, 1.0f,-delta);
Expand Down Expand Up @@ -478,7 +478,7 @@ void chart2d_impl::render(const int pWindowId,
mBorderProgram.bind();
glUniformMatrix4fv(mBorderUniformMatIndex, 1, GL_FALSE, glm::value_ptr(trans));
glUniform4fv(mBorderUniformColorIndex, 1, GRAY);
glDrawArrays(GL_LINES, 4+2*mTickCount, 4*mTickCount);
glDrawArrays(GL_LINES, 4+2*mTickCount, 8*mTickCount-16);
mBorderProgram.unbind();
chart2d_impl::unbindResources();

Expand Down Expand Up @@ -546,7 +546,7 @@ void chart2d_impl::render(const int pWindowId,

if (!mXTitle.empty()) {
glm::vec4 res = trans * glm::vec4(0.0f, -1.0f, 0.0f, 1.0f);
//

pos[0] = w*(res.x+1.0f)/2.0f;
pos[1] = h*(res.y+1.0f)/2.0f;

Expand Down Expand Up @@ -617,7 +617,12 @@ void chart3d_impl::pushTicktextCoords(const float pX, const float pY, const floa
void chart3d_impl::generateChartData()
{
CheckGL("Begin chart3d_impl::generateChartData");
static const float border[] = { -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1 };
static const float border[] = { -1, -1, 1,
-1, -1, -1,
-1, -1, -1,
1, -1, -1,
1, -1, -1,
1, 1, -1 };
static const int nValues = sizeof(border)/sizeof(float);

std::vector<float> decorData;
Expand Down Expand Up @@ -711,7 +716,7 @@ void chart3d_impl::generateChartData()
pushPoint(decorData, 1.0f, 1.0f, 0.0f);
pushPoint(decorData, 0.0f, 1.0f,-1.0f);
pushPoint(decorData, 0.0f, 1.0f, 1.0f);
for (int i=1; i<=ticksLeft; ++i) {
for (int i=1; i<ticksLeft; ++i) {
float delta = i*step;
/* xy plane center lines */
pushPoint(decorData, -1.0f,-delta, -1.0f);
Expand Down Expand Up @@ -862,7 +867,7 @@ void chart3d_impl::render(const int pWindowId,
mBorderProgram.bind();
glUniformMatrix4fv(mBorderUniformMatIndex, 1, GL_FALSE, glm::value_ptr(trans));
glUniform4fv(mBorderUniformColorIndex, 1, GRAY);
glDrawArrays(GL_LINES, 6+3*mTickCount, 12*mTickCount);
glDrawArrays(GL_LINES, 6+3*mTickCount, 3*(8*mTickCount-16));
mBorderProgram.unbind();
chart3d_impl::unbindResources();

Expand Down
4 changes: 3 additions & 1 deletion src/backend/opengl/chart_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class AbstractChart : public AbstractRenderable {
}

inline int getNumTicksC2E() const {
/* Get # of ticks from center(0,0) to edge along axis */
/* Get # of ticks from center(0,0) to edge along axis
* Excluding the center tick
*/
return (mTickCount-1)/2;
}

Expand Down
2 changes: 1 addition & 1 deletion src/backend/opengl/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ typedef unsigned short ushort;
typedef unsigned char uchar;

static const float BLACK[] = {0.0f , 0.0f , 0.0f , 1.0f};
static const float GRAY[] = {0.85f , 0.85f , 0.85f , 1.0f};
static const float GRAY[] = {0.75f , 0.75f , 0.75f , 1.0f};
static const float WHITE[] = {1.0f , 1.0f , 1.0f , 1.0f};
static const float AF_BLUE[] = {0.0588f , 0.1137f , 0.2745f , 1.0f};
static const glm::mat4 IDENTITY(1.0f);
Expand Down