Re: Segfault with glMatrixMode

"Mike C. Fletcher" <[email protected]> Mon, 25 Aug 2014 14:08:35 -0400
Newsgroups gmane.comp.python.opengl.user
Message-ID <[email protected]>
On 14-08-25 01:50 PM, Mike Lawrence wrote:
...
> and immediately encounter a segfault. Seems to happen for any of the
> valid arguments to glMatrixMode. Any ideas on what's up? Below is my
> system description.
...

The tutorial is omitting the creation of an OpenGL context. Using (most) 
GL commands without a context *used* to be possible, but wasn't "valid", 
and later drivers now enforce the "you must have a context" restriction, 
often by segfaulting on Linux/OS-X machines. As a result, you need to 
get a GL context setup with your windowing system before starting to 
call OpenGL commands. Here's how you could do that with Pygame:

import pygame
import pygame.display
pygame.display.init()
SCREEN = pygame.display.set_mode(
     (640,480),
     pygame.OPENGL | pygame.DOUBLEBUF,
)
pygame.display.set_caption("Example")
try:

     # your code...
     from OpenGL.GL import *
     glMatrixMode(GL_PROJECTION)

finally:
     pygame.display.quit()
     pygame.quit()


HTH,
Mike

-- 
________________________________________________
   Mike C. Fletcher
   Designer, VR Plumber, Coder
   http://www.vrplumber.com
   http://blog.vrplumber.com


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net