I am following the sample programs in the OpenGL Superbible, and they make it sound like windows created with glutCreateWindow will be resizable. I am using my own python-version of their Listing 2.2 below, and my windows are never resizable. I am using: PyOpenGL 3.1.7 on macOS Ventura (and "freeglut" (I think it was also the same before I installed freeglut).
Here is the listing:
from OpenGL.GLUT import *
from OpenGL.GL import *
from OpenGL.GLU import *
def change_size(w, h):
glViewport(0, 0, w, h)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
aspect_ratio = w/h
if w <= h:
glOrtho(-100, 100, -100/aspect_ratio, 100/aspect_ratio, 1, -1)
else:
glOrtho(-100*aspect_ratio, 100*aspect_ratio, -100, 100, 1, -1)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
def render_scene():
glClear(GL_COLOR_BUFFER_BIT)
glColor(1,0,0,0)
glRectf(-25,25,25,-25)
glFlush()
def setup_rc():
glClearColor(0, 0, 1, 1)
def main():
glutInit(sys.argv)
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGBA)
glutCreateWindow("Simple")
glutDisplayFunc(render_scene)
glutReshapeFunc(change_size)
setup_rc()
glutMainLoop()
main()
is there an easy way to create the main window so it is resizable?