Skip to main content
edited body
Source Link
Oly
  • 111
  • 4

Okay I don't think this can be done with standard pygame since it's built on top of SLDSDL 1, and if SDL supports the GL core profile, it's not exposed in pygame from what i can tell.

However, there is a port of pygame to SDL 2 on github which is a drop in replacement which does expose the required attributes so you can specify a specific context.

So basically you will need the below changes, this got me a 3d triangle using 330 shaders on a linux laptop.

import pygame_sdl2
pygame_sdl2.init()
pygame_sdl2.display.gl_set_attribute(GL_ALPHA_SIZE, 8)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MAJOR_VERSION, 3)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MINOR_VERSION, 3)

pygame_sdl2.display.set_mode((self.viewport[2], self.viewport[3]), OPENGL|DOUBLEBUF)

Hope this helps.

Okay I don't think this can be done with standard pygame since it's built on top of SLD 1, and if SDL supports the GL core profile, it's not exposed in pygame from what i can tell.

However, there is a port of pygame to SDL 2 on github which is a drop in replacement which does expose the required attributes so you can specify a specific context.

So basically you will need the below changes, this got me a 3d triangle using 330 shaders on a linux laptop.

import pygame_sdl2
pygame_sdl2.init()
pygame_sdl2.display.gl_set_attribute(GL_ALPHA_SIZE, 8)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MAJOR_VERSION, 3)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MINOR_VERSION, 3)

pygame_sdl2.display.set_mode((self.viewport[2], self.viewport[3]), OPENGL|DOUBLEBUF)

Hope this helps.

Okay I don't think this can be done with standard pygame since it's built on top of SDL 1, and if SDL supports the GL core profile, it's not exposed in pygame from what i can tell.

However, there is a port of pygame to SDL 2 on github which is a drop in replacement which does expose the required attributes so you can specify a specific context.

So basically you will need the below changes, this got me a 3d triangle using 330 shaders on a linux laptop.

import pygame_sdl2
pygame_sdl2.init()
pygame_sdl2.display.gl_set_attribute(GL_ALPHA_SIZE, 8)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MAJOR_VERSION, 3)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MINOR_VERSION, 3)

pygame_sdl2.display.set_mode((self.viewport[2], self.viewport[3]), OPENGL|DOUBLEBUF)

Hope this helps.

Fixed grammar and such.
Source Link
Vaillancourt
  • 16.4k
  • 17
  • 56
  • 61

Okay iI don't think this can be done with standard pygame itssince it's built on top of sdlSLD 1, and if sdlSDL supports the glGL core profile its, it's not exposeedexposed in pyganepygame from what i can tell.

How everHowever, there is a port of pygame to sdlSDL 2 on github which is a drop in replacement which does expose the required attributes so youoyou can specify a specific context.

So basically you will need the below changes, this got me a 3d triangle using 330 shaders on a linux laptop.

import pygame_sdl2
pygame_sdl2.init()
pygame_sdl2.display.gl_set_attribute(GL_ALPHA_SIZE, 8)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MAJOR_VERSION, 3)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MINOR_VERSION, 3)

pygame_sdl2.display.set_mode((self.viewport[2], self.viewport[3]), OPENGL|DOUBLEBUF)

Hope this helps post you python 3d examples lets see this get better support.

Okay i don't think this can be done with standard pygame its built on top of sdl 1 and if sdl supports the gl core profile its not exposeed in pygane from what i can tell.

How ever there is a port of pygame to sdl 2 on github which is a drop in replacement which does expose the required attributes so youo can specify a specific context.

So basically you will need the below changes, this got me a 3d triangle using 330 shaders on a linux laptop.

import pygame_sdl2
pygame_sdl2.init()
pygame_sdl2.display.gl_set_attribute(GL_ALPHA_SIZE, 8)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MAJOR_VERSION, 3)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MINOR_VERSION, 3)

pygame_sdl2.display.set_mode((self.viewport[2], self.viewport[3]), OPENGL|DOUBLEBUF)

Hope this helps post you python 3d examples lets see this get better support.

Okay I don't think this can be done with standard pygame since it's built on top of SLD 1, and if SDL supports the GL core profile, it's not exposed in pygame from what i can tell.

However, there is a port of pygame to SDL 2 on github which is a drop in replacement which does expose the required attributes so you can specify a specific context.

So basically you will need the below changes, this got me a 3d triangle using 330 shaders on a linux laptop.

import pygame_sdl2
pygame_sdl2.init()
pygame_sdl2.display.gl_set_attribute(GL_ALPHA_SIZE, 8)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MAJOR_VERSION, 3)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MINOR_VERSION, 3)

pygame_sdl2.display.set_mode((self.viewport[2], self.viewport[3]), OPENGL|DOUBLEBUF)

Hope this helps.

Source Link
Oly
  • 111
  • 4

Okay i don't think this can be done with standard pygame its built on top of sdl 1 and if sdl supports the gl core profile its not exposeed in pygane from what i can tell.

How ever there is a port of pygame to sdl 2 on github which is a drop in replacement which does expose the required attributes so youo can specify a specific context.

So basically you will need the below changes, this got me a 3d triangle using 330 shaders on a linux laptop.

import pygame_sdl2
pygame_sdl2.init()
pygame_sdl2.display.gl_set_attribute(GL_ALPHA_SIZE, 8)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MAJOR_VERSION, 3)
pygame_sdl2.display.gl_set_attribute(pygame_sdl2.GL_CONTEXT_MINOR_VERSION, 3)

pygame_sdl2.display.set_mode((self.viewport[2], self.viewport[3]), OPENGL|DOUBLEBUF)

Hope this helps post you python 3d examples lets see this get better support.