sajis997

10-12-2015, 10:43 AM

Hello forum,

The application that I am trying to develop is crashing at the point glDrawArrays(....) . The snippet is as follows:

void Hilbert2DScene::render()

{

if(!mInitialized)

return;

/*

* Bind the vertex array object and vertex buffer object

* */

glBindVertexArray(mVaoID);

/*

* Now bind it to the context using the GL_ARRAY_BUFFER binding point

* */

glBindBuffer(GL_ARRAY_BUFFER,mVboVerticesID);

mShader->Use();

GL_CHECK_ERRORS;

//allocate the buffer if the buffer is not allocated yet

if(!mIsBufferAllocated)

{

//ALLOCATE THE BUFFER HERE

unityCube(mIteration,mDim);

//specify the amount of storage we want to use for the buffer

glBufferData(GL_ARRAY_BUFFER,sizeof(glm::vec3) * mVertices.size(),&mVertices[0],GL_STATIC_DRAW);

mIsBufferAllocated = true;

mShowPoints = getNumberOfPointsForIteration(mIteration,mDim);

}

if(mClearBackground)

glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );

static const GLfloat color[] = {0.0f,0.0f,0.0f,1.0f};

static const GLfloat depth = 1.0f;

glClearBufferfv(GL_COLOR,0,color);

glClearBufferfv(GL_DEPTH,0,&depth);

//draw stuff

//transfer the scene along the z-axis

glm::mat4 T = glm::translate(glm::mat4(1.0f),glm::vec3(0.0f,0.0f ,mDist));

//the rotation matrix along X concatenated with the translation matrix

glm::mat4 Rx = glm::rotate(T, glm::radians(static_cast<float>(mRX)),glm::vec3(1.0f,0.0f,0.0f));

//rotation matrix along Y is concatenated with the rotation matrix along X

glm::mat4 MV = glm::rotate(Rx,glm::radians(static_cast<float>(mRY)),glm::vec3(0.0f,1.0f,0.0f));

mModelViewMatrix = mProjectionMatrix * MV;

glEnableVertexAttribArray((GLuint)0);

glUniformMatrix4fv(mShader->getUniform("MVP"),1,GL_FALSE,glm::value_ptr(mModelViewMatrix));

if(mShowPoints < getNumberOfPointsForIteration(mIteration,mDim))

++mShowPoints;

glDrawArrays(GL_LINE_STRIP,0,mShowPoints);

glDisableVertexAttribArray(0);

glBindVertexArray(0);

GL_CHECK_ERRORS;

mShader->UnUse();

}

I tried with gdb debugger and the backtrace leaves with nothing other than "??" . I am not sure where to start with . Some hint from the forum is eagerly awaited ..

Thanks

The application that I am trying to develop is crashing at the point glDrawArrays(....) . The snippet is as follows:

void Hilbert2DScene::render()

{

if(!mInitialized)

return;

/*

* Bind the vertex array object and vertex buffer object

* */

glBindVertexArray(mVaoID);

/*

* Now bind it to the context using the GL_ARRAY_BUFFER binding point

* */

glBindBuffer(GL_ARRAY_BUFFER,mVboVerticesID);

mShader->Use();

GL_CHECK_ERRORS;

//allocate the buffer if the buffer is not allocated yet

if(!mIsBufferAllocated)

{

//ALLOCATE THE BUFFER HERE

unityCube(mIteration,mDim);

//specify the amount of storage we want to use for the buffer

glBufferData(GL_ARRAY_BUFFER,sizeof(glm::vec3) * mVertices.size(),&mVertices[0],GL_STATIC_DRAW);

mIsBufferAllocated = true;

mShowPoints = getNumberOfPointsForIteration(mIteration,mDim);

}

if(mClearBackground)

glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );

static const GLfloat color[] = {0.0f,0.0f,0.0f,1.0f};

static const GLfloat depth = 1.0f;

glClearBufferfv(GL_COLOR,0,color);

glClearBufferfv(GL_DEPTH,0,&depth);

//draw stuff

//transfer the scene along the z-axis

glm::mat4 T = glm::translate(glm::mat4(1.0f),glm::vec3(0.0f,0.0f ,mDist));

//the rotation matrix along X concatenated with the translation matrix

glm::mat4 Rx = glm::rotate(T, glm::radians(static_cast<float>(mRX)),glm::vec3(1.0f,0.0f,0.0f));

//rotation matrix along Y is concatenated with the rotation matrix along X

glm::mat4 MV = glm::rotate(Rx,glm::radians(static_cast<float>(mRY)),glm::vec3(0.0f,1.0f,0.0f));

mModelViewMatrix = mProjectionMatrix * MV;

glEnableVertexAttribArray((GLuint)0);

glUniformMatrix4fv(mShader->getUniform("MVP"),1,GL_FALSE,glm::value_ptr(mModelViewMatrix));

if(mShowPoints < getNumberOfPointsForIteration(mIteration,mDim))

++mShowPoints;

glDrawArrays(GL_LINE_STRIP,0,mShowPoints);

glDisableVertexAttribArray(0);

glBindVertexArray(0);

GL_CHECK_ERRORS;

mShader->UnUse();

}

I tried with gdb debugger and the backtrace leaves with nothing other than "??" . I am not sure where to start with . Some hint from the forum is eagerly awaited ..

Thanks