| 93 | } |
| 94 | |
| 95 | plot_impl::plot_impl(const uint pNumPoints, const forge::dtype pDataType, |
| 96 | const forge::PlotType pPlotType, const forge::MarkerType pMarkerType, const int pD) |
| 97 | : mDimension(pD), mMarkerSize(12), mNumPoints(pNumPoints), mDataType(pDataType), |
| 98 | mGLType(dtype2gl(mDataType)), mMarkerType(pMarkerType), mPlotType(pPlotType), mIsPVROn(false), |
| 99 | mPlotProgram(pD==2 ? glsl::marker2d_vs.c_str() : glsl::plot3_vs.c_str(), |
| 100 | pD==2 ? glsl::histogram_fs.c_str(): glsl::plot3_fs.c_str()), |
| 101 | mMarkerProgram(pD==2 ? glsl::marker2d_vs.c_str() : glsl::plot3_vs.c_str(), glsl::marker_fs.c_str()), |
| 102 | mRBO(-1), mPlotMatIndex(-1), mPlotPVCOnIndex(-1), mPlotPVAOnIndex(-1), |
| 103 | mPlotUColorIndex(-1), mPlotRangeIndex(-1), mPlotPointIndex(-1), mPlotColorIndex(-1), |
| 104 | mPlotAlphaIndex(-1), mMarkerPVCOnIndex(-1), mMarkerPVAOnIndex(-1), mMarkerTypeIndex(-1), |
| 105 | mMarkerColIndex(-1), mMarkerMatIndex(-1), mMarkerPointIndex(-1), mMarkerColorIndex(-1), |
| 106 | mMarkerAlphaIndex(-1), mMarkerRadiiIndex(-1) |
| 107 | { |
| 108 | CheckGL("Begin plot_impl::plot_impl"); |
| 109 | |
| 110 | setColor(0, 1, 0, 1); |
| 111 | |
| 112 | if (mDimension==2) { |
| 113 | mPlotUColorIndex = mPlotProgram.getUniformLocation("barColor"); |
| 114 | mVBOSize = 2*mNumPoints; |
| 115 | } else { |
| 116 | mPlotRangeIndex = mPlotProgram.getUniformLocation("minmaxs"); |
| 117 | mVBOSize = 3*mNumPoints; |
| 118 | } |
| 119 | |
| 120 | mCBOSize = 3*mNumPoints; |
| 121 | mABOSize = mNumPoints; |
| 122 | mRBOSize = mNumPoints; |
| 123 | |
| 124 | mPlotMatIndex = mPlotProgram.getUniformLocation("transform"); |
| 125 | mPlotPVCOnIndex = mPlotProgram.getUniformLocation("isPVCOn"); |
| 126 | mPlotPVAOnIndex = mPlotProgram.getUniformLocation("isPVAOn"); |
| 127 | mPlotPointIndex = mPlotProgram.getAttributeLocation ("point"); |
| 128 | mPlotColorIndex = mPlotProgram.getAttributeLocation ("color"); |
| 129 | mPlotAlphaIndex = mPlotProgram.getAttributeLocation ("alpha"); |
| 130 | |
| 131 | mMarkerMatIndex = mMarkerProgram.getUniformLocation("transform"); |
| 132 | mMarkerPVCOnIndex = mMarkerProgram.getUniformLocation("isPVCOn"); |
| 133 | mMarkerPVAOnIndex = mMarkerProgram.getUniformLocation("isPVAOn"); |
| 134 | mMarkerPVROnIndex = mMarkerProgram.getUniformLocation("isPVROn"); |
| 135 | mMarkerTypeIndex = mMarkerProgram.getUniformLocation("marker_type"); |
| 136 | mMarkerColIndex = mMarkerProgram.getUniformLocation("marker_color"); |
| 137 | mMarkerPSizeIndex = mMarkerProgram.getUniformLocation("psize"); |
| 138 | mMarkerPointIndex = mMarkerProgram.getAttributeLocation ("point"); |
| 139 | mMarkerColorIndex = mMarkerProgram.getAttributeLocation ("color"); |
| 140 | mMarkerAlphaIndex = mMarkerProgram.getAttributeLocation ("alpha"); |
| 141 | mMarkerRadiiIndex = mMarkerProgram.getAttributeLocation ("pointsize"); |
| 142 | |
| 143 | #define PLOT_CREATE_BUFFERS(type) \ |
| 144 | mVBO = createBuffer<type>(GL_ARRAY_BUFFER, mVBOSize, NULL, GL_DYNAMIC_DRAW); \ |
| 145 | mCBO = createBuffer<float>(GL_ARRAY_BUFFER, mCBOSize, NULL, GL_DYNAMIC_DRAW); \ |
| 146 | mABO = createBuffer<float>(GL_ARRAY_BUFFER, mABOSize, NULL, GL_DYNAMIC_DRAW); \ |
| 147 | mRBO = createBuffer<float>(GL_ARRAY_BUFFER, mRBOSize, NULL, GL_DYNAMIC_DRAW); \ |
| 148 | mVBOSize *= sizeof(type); \ |
| 149 | mCBOSize *= sizeof(float); \ |
| 150 | mABOSize *= sizeof(float); \ |
| 151 | mRBOSize *= sizeof(float); |
| 152 |
nothing calls this directly
no test coverage detected