有未经处理的异常: 0xC0000005: 读取位置 0xcdcdcdcd 时发生访问冲突
灵影葬 2013-07-08 08:38:44 程序执行下面这句代码时候 osg::DrawElementsUInt* pyramidBase = new osg::DrawElementsUInt(osg::PrimitiveSet::QUADS, 0); 报上面的错误
函数的定义如下
class OSG_EXPORT DrawElementsUInt : public DrawElements, public VectorGLuint
{
public:
typedef VectorGLuint vector_type;
DrawElementsUInt(GLenum mode=0):
DrawElements(DrawElementsUIntPrimitiveType,mode) {}
DrawElementsUInt(const DrawElementsUInt& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
DrawElements(array,copyop),
vector_type(array) {}
/**
* \param mode One of osg::PrimitiveSet::Mode. Determines the type of primitives used.
* \param no Number of intended elements. This will be the size of the underlying vector.
*/
DrawElementsUInt(GLenum mode, unsigned int no, const GLuint* ptr, int numInstances=0) :
DrawElements(DrawElementsUIntPrimitiveType,mode,numInstances),
vector_type(ptr,ptr+no) {}
/**
* \param no Number of intended elements. This will be the size of the underlying vector.
*/
DrawElementsUInt(GLenum mode, unsigned int no) :
DrawElements(DrawElementsUIntPrimitiveType,mode),
vector_type(no) {}
template <class InputIterator>
DrawElementsUInt(GLenum mode, InputIterator first,InputIterator last) :
DrawElements(DrawElementsUIntPrimitiveType,mode),
vector_type(first,last) {}
virtual Object* cloneType() const { return new DrawElementsUInt(); }
virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUInt*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "DrawElementsUInt"; }
virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
virtual unsigned int getTotalDataSize() const { return 4u*static_cast<unsigned int>(size()); }
virtual bool supportsBufferObject() const { return false; }
virtual void draw(State& state, bool useVertexBufferObjects) const;
virtual void accept(PrimitiveFunctor& functor) const;
virtual void accept(PrimitiveIndexFunctor& functor) const;
virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
virtual void offsetIndices(int offset);
virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
virtual void addElement(unsigned int v) { push_back(GLuint(v)); }
protected:
virtual ~DrawElementsUInt();
};
不知道有谁碰到过这样的问题没有~求解