Re: [PyOpenGL-Users] Segfault with glMatrixMode
Brought to you by:
mcfletch
|
From: Mike C. F. <mcf...@vr...> - 2014-08-25 18:25:10
|
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
|