Note that there are some explanatory texts on larger screens.

plurals
  1. PO“Access violation reading location 0x000000000” in a simple OpenGL app
    primarykey
    data
    text
    <p>I have a problem in openGL when using buffer object to store vertex array . when I run the code , a window appears that display message " <em>access violation reading location 0x000000000</em> " and when I move the cursor to arrow beside glGenBuufers function I see description: <em>this is the next statement to execute when this thread returns from current function</em>.</p> <p><img src="https://i.stack.imgur.com/e8nqy.jpg" alt="IDE snapshot"></p> <p>Code:</p> <pre><code>int frame=0; void display(); void datasource(); GLuint vbo; void datasource() { GLfloat vertex1[]={-1.000000 ,0.500000 ,-0.700000 ,0.500000 ,-1.000000 ,0.800000 ,-0.700000 ,0.800000 ,-0.400000 ,0.500000 ,-0.100000 ,0.500000 ,-0.400000 ,0.800000 ,-0.100000 ,0.200000 ,0.500000 ,0.500000 ,0.500000 ,0.200000 ,0.800000 ,0.500000,0.800000 ,0.800000 ,0.800000 ,0.500000 ,1.100000 ,0.500000 ,0.800000 ,0.800000 ,1.100000,0.800000 }; glGenBuffers(1,&amp;vbo); glBindBuffer(GL_ARRAY_BUFFER,vbo); glBufferData(GL_ARRAY_BUFFER,sizeof(vertex1),vertex1,GL_STATIC_DRAW); } void init(int arc,char **arch) { glutInit(&amp;arc,arch); glutInitWindowSize(800,800); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutCreateWindow("chess"); glClearColor(0.0,0.0,0.0,0.0); glutDisplayFunc(display); } int main(int arc,char **arch) { init(arc,arch); datasource(); glutMainLoop(); return 0; } void display() { frame++; glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glDrawArrays(GL_TRIANGLE_STRIP,0,8); glutSwapBuffers(); glutPostRedisplay(); } </code></pre> <p>What did I do wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload