C++で以下のようなプログラムを書いているのですが、
glm::vec3 t1 = cent + axis * (*scopePtr)[idx] * 300.0;
この行でエラーが出てしまって、コンパイルできません。いろいろデバッグしていたのですが、
「(*scopePtr)[idx]」ここで以下の様なエラーが出てしまいます。なにが間違っているのでしょうか?
std::__1::vector<float, std::__1::allocate<float> >::operator[](unsigned long) [inslined]
vector<float> *scopePtr; scopePtr = ptr; /*外部で宣言された vector<float> *ptr を代入*/ for (int i = 0;i < pts.size() - 1;i++){ glm::vec3 cent = pts[i]; glm::vec3 axis = pts[i] - pts[i+1]; axis.rotate(90, glm::vec3(0.0,1.0,0.0)); axis.normalize(); int idx = (sizeof(scopePtr) * (float)i / (float)pts.size()); glm::vec3 t1 = cent + axis * (*scopePtr)[idx] * 300.0; glm::vec3 t2 = cent - axis * (*scopePtr)[idx] * 300.0; glVertex3d(t1.x, t1.y, t1.z); glVertex3d(t2.x, t2.y, t2.z); }