Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: Segmentation fault

  1. #1
    Senior Member Regular Contributor
    Join Date
    Aug 2010
    Posts
    114

    Segmentation fault

    Anyone face this problem when using vbo?

    Code :
    glGenBuffers(1, &pattern_buffer);	
    glBindBuffer(GL_ARRAY_BUFFER, pattern_buffer);	
    glBufferData(GL_ARRAY_BUFFER, 6, pattern, GL_READ_WRITE);

    Output:

    Segmentation fault

    What is that means?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    458

    Re: Segmentation fault

    Do you use any extension library (like glew), do you load the addresses of these functions by yourself ?

    If not, you need.

    If yes, maybe more code should be good.

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Oct 2009
    Posts
    592

    Re: Segmentation fault

    This is the classical case all glew users encounter, where you call functions that are unavailable. Try to append ARB to the function names, compile, link and try again, e.g.

    glGenBuffersARB instead of glGenBuffers

  4. #4
    Senior Member Regular Contributor
    Join Date
    Aug 2010
    Posts
    114

    Re: Segmentation fault

    Quote Originally Posted by ugluk
    This is the classical case all glew users encounter, where you call functions that are unavailable. Try to append ARB to the function names, compile, link and try again, e.g.

    glGenBuffersARB instead of glGenBuffers
    I had appended ARB to the function names as below:

    Code :
    glGenBuffersARB(1, &pattern_buffer);	
    	glBindBufferARB(GL_ARRAY_BUFFER_ARB, pattern_buffer);	
    	glBufferDataARB(GL_ARRAY_BUFFER_ARB, 6, pattern, GL_READ_WRITE);

    But I still getting the segmentation fault message.

    What is tat message means actually?

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: Segmentation fault

    Have u initialized the glew library by calling
    glewInit() after initializing glut library? In order to access those functions, you need to use glew or anyother helper library to obtain the func. pointer/s. If u donot do this, the function pointers are null and when u get try to call a null func. pointer u get the segmentation fault.
    Another issue may be that the data pointer u r passing to the glBufferData does not contain sufficient data.
    Regards,
    Mobeen

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Oct 2009
    Posts
    592

    Re: Segmentation fault

    Do this:

    compile your app with the -g switch.

    gdb ./your_app_name_here
    r
    <wait for your app to crash>
    bt

  7. #7
    Senior Member Regular Contributor
    Join Date
    Aug 2010
    Posts
    114

    Re: Segmentation fault

    Quote Originally Posted by mobeen
    Have u initialized the glew library by calling
    glewInit() after initializing glut library? In order to access those functions, you need to use glew or anyother helper library to obtain the func. pointer/s. If u donot do this, the function pointers are null and when u get try to call a null func. pointer u get the segmentation fault.
    Another issue may be that the data pointer u r passing to the glBufferData does not contain sufficient data.
    Even I already initialized the glew library still have the same problem. What do u mean sufficient data?I declare and initialize a 6 bytes vertex array. The size I use is 6 bytes also.

  8. #8
    Senior Member Regular Contributor
    Join Date
    Aug 2010
    Posts
    114

    Re: Segmentation fault

    Quote Originally Posted by ugluk
    Do this:

    compile your app with the -g switch.

    gdb ./your_app_name_here
    r
    <wait for your app to crash>
    bt
    What is that? Can explain further?

    I got this:

    Code :
    Reading symbols from /media/Data/My Document/FYP/Implementation/testing...done.
    (gdb) r
    Starting program: /media/Data/My Document/FYP/Implementation/testing 
    [Thread debugging using libthread_db enabled]
    Virus pattern: trojan
     
    Program received signal SIGSEGV, Segmentation fault.
    0x0018f336 in glGetString () from /usr/lib/mesa/libGL.so.1

  9. #9
    Senior Member Regular Contributor Rosario Leonardi's Avatar
    Join Date
    Aug 2008
    Location
    Italy
    Posts
    356

    Re: Segmentation fault

    Segmentation fault: the memory is subdivided in pages, if you write/read outside from the pages assigned to your program you got this error. This avoid your program to destroy other program.
    This usually append when you are using a not initialized pointer.
    For example:
    Code :
    class A{
      void method();
    };
    void main()
    {
      A* pObj;
      pObj->method(); // segmentation fault
      return 0;
    }
    Compiling with -g you attach the debug symbol to your program. With debug symbol a debugger like gdb can associate any assembly instruction to high level instruction and you can follow your program step by step, or in case of error it can tell you with function cause the error. Read the manual for gdb, it's a vital tool for every developer.
    In your case, gdb it's telling you that the function glGetString is the problem. Are you calling glGetString with a valid and active context?
    ~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~

  10. #10
    Senior Member Regular Contributor
    Join Date
    Aug 2010
    Posts
    114

    Re: Segmentation fault

    Quote Originally Posted by Rosario Leonardi
    Segmentation fault: the memory is subdivided in pages, if you write/read outside from the pages assigned to your program you got this error. This avoid your program to destroy other program.
    This usually append when you are using a not initialized pointer.
    For example:
    Code :
    class A{
      void method();
    };
    void main()
    {
      A* pObj;
      pObj->method(); // segmentation fault
      return 0;
    }
    Compiling with -g you attach the debug symbol to your program. With debug symbol a debugger like gdb can associate any assembly instruction to high level instruction and you can follow your program step by step, or in case of error it can tell you with function cause the error. Read the manual for gdb, it's a vital tool for every developer.
    In your case, gdb it's telling you that the function glGetString is the problem. Are you calling glGetString with a valid and active context?
    But I do not call glGetString function. Why it will cause this problem?Is it possible that other function I had called may invoke this function in the background?

Page 1 of 3 123 LastLast

Similar Threads

  1. Segmentation fault
    By genericname in forum OpenGL: Windows
    Replies: 3
    Last Post: 03-11-2012, 10:01 AM
  2. Segmentation fault while using PBO
    By SagoO in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-03-2011, 08:03 AM
  3. segmentation fault
    By mikeglaz in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 06-24-2010, 04:32 PM
  4. Segmentation fault
    By kmn2446 in forum OpenGL: Linux
    Replies: 4
    Last Post: 03-16-2004, 08:53 AM
  5. Segmentation fault
    By D1G1T4LL in forum OpenGL: Linux
    Replies: 2
    Last Post: 12-09-2003, 08:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean