CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 24

Threaded View

  1. #1
    Join Date
    Sep 2010
    Posts
    13

    C++ Unhandled exception error

    Hi everybody

    I defined an array pointer to hold a massive amount of data, (actually the RGB data of a screen with 1024*768 pixels). the data is assigned from another temporary array to the this array within a function that calculates the values of the temporary array and then assign them to the global one using FOR loops. the global array values should be kept saved to be used in an OpenGL function as a store of an image data and then display the image on the screen.

    when I run the program, the program works fine until it reaches a specific row number of the screen rows (row number 16 of 128 rows) and crash giving the following message:

    Unhandled exception at 0x7c812afb in OPENGL_.....exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0012fbb4..

    any one can help me in this please?
    how can I get rid of this error and make the program works?
    I get the same message when I add a delete function (delete [] pixels_index to delete the array of pointers, for that reason I think the problem is about the array (pixels_index)

    many thanks in advance

    here is parts of the OpenGL code in C++ environment:
    Code:
    
    int main(int argc, char** argv) {
    	glutInit(&argc, argv);
    
    	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);	
    	glutInitWindowSize(1024, 768);
    	
    
    
    	glutCreateWindow("OPENGL_BRUNEL");
    	
    	initRendering();
    	glutDisplayFunc(drawScene);
    	
    	
    	glViewport(0, 0, 1024, 768);
    	glMatrixMode(GL_PROJECTION);
    	glLoadIdentity();
    	glFrustum(-1.0 , 1.0, -1.0, 1.0, 3, 200);
    
    
    	glutTimerFunc(2500, update, 0);
    
    	
    	glutMainLoop();
             delete [] pixels_index;
    	return 0;
    }
    Last edited by Yohanna; October 6th, 2010 at 10:19 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured