glViewport

set the viewport

Signature

glViewport( GLint ( x ) , GLint ( y ) , GLsizei ( width ) , GLsizei ( height ) )-> void
glViewport( x , y , width , height )

Parameters

VariablesDescription
x, y
Specify the lower left corner of the viewport rectangle, in pixels. The initial value is (0,0).
width, height
Specify the width and height of the viewport. When a GL context is first attached to a window, width and height are set to the dimensions of that window.

Sample Code References

The following code samples have been found which appear to reference the functions described here. Take care that the code may be old, broken or not even use PyOpenGL.

glViewport
OpenGLContext tests/shadow_1.py Lines: 549
OpenGLContext tests/shadow_2.py Lines: 134
OpenGLContext OpenGLContext/context.py Lines: 655
OpenGL-Demo PyOpenGL-Demo/GLUT/shader_test.py Lines: 72
OpenGL-Demo PyOpenGL-Demo/GLUT/gears.py Lines: 211
OpenGL-Demo PyOpenGL-Demo/GLUT/tom/conechecker.py Lines: 35, 39, 41
OpenGL-Demo PyOpenGL-Demo/redbook/double.py Lines: 89
OpenGL-Demo PyOpenGL-Demo/redbook/lines.py Lines: 121
OpenGL-Demo PyOpenGL-Demo/redbook/cube.py Lines: 77
OpenGL-Demo PyOpenGL-Demo/redbook/teapots.py Lines: 181
OpenGL-Demo PyOpenGL-Demo/redbook/scene.py Lines: 108
OpenGL-Demo PyOpenGL-Demo/redbook/smooth.py Lines: 86
OpenGL-Demo PyOpenGL-Demo/redbook/drawf.py Lines: 91
OpenGL-Demo PyOpenGL-Demo/redbook/fog.py Lines: 116
OpenGL-Demo PyOpenGL-Demo/redbook/movelight.py Lines: 112
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson42.py Lines: 272, 280, 288, 296, 363
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson4.py Lines: 77
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson41.py Lines: 206
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson2.py Lines: 67
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6.py Lines: 102
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson19.py Lines: 129
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson5.py Lines: 80
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson3.py Lines: 67
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson1.py Lines: 67
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson13.py Lines: 131
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson18.py Lines: 133
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson45.py Lines: 374
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson6-multi.py Lines: 137
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson23.py Lines: 82
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson11.py Lines: 62
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson12.py Lines: 58
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson16.py Lines: 67
OpenGL-Demo PyOpenGL-Demo/NeHe/lesson26.py Lines: 83
OpenGL-Demo PyOpenGL-Demo/da/dots.py Lines: 93
OpenGL-Demo py2exe-example/shader_test.py Lines: 73
Glinter Widget.py Lines: 53, 583, 661
{Artistic License} PymmLib applications/glutviewer.py Lines: 160
{Artistic License} PymmLib mmLib/OpenGLDriver.py Lines: 135
pyBzEdit pyBzEdit.py Lines: 417, 758
{LGPL} PyUI pyui/renderers/openglGlut.py Lines: 229
{LGPL} PyUI2 renderers/openglGlut.py Lines: 229
{LGPL} PyUI2 system/glutdevice.py Lines: 170
{LGPL} VisionEgg VisionEgg/Core.py Lines: 1362
{LGPL} PyMT examples/apps/3Dviewer/3Dviewer.py Lines: 38
{LGPL} PyMT pymt/graphx/fbo.py Lines: 20, 224, 261
{LGPL} PyMT pymt/ui/window/__init__.py Lines: 19, 451
{LGPL} Pyggel pyggel/data.py Lines: 550, 612
{LGPL} Pyggel pyggel/view.py Lines: 301
{GPL} Scocca scocca/graphics/opengl/viewport.py Lines: 22
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Experiments/Spheres.py Lines: 19
{LGPL or GPL or MPL} Kamaelia Sketches/CL/Topology3D/Experiments/Cubes.py Lines: 35
Gloopy gloopy/view/projection.py Lines: 27
OpenGL Tutorial (Python Translation) t02.playing-with-colors/FragPosition.py Lines: 98
OpenGL Tutorial (Python Translation) t02.playing-with-colors/VertexColors.py Lines: 104
OpenGL Tutorial (Python Translation) t01.hello-triangle/HelloTriangle.py Lines: 115
Visvis core/axes.py Lines: 795, 800, 843, 908
Visvis core/baseFigure.py Lines: 872
{GPL3} OpenGL-Programmable 01-direct.py Lines: 117
{GPL3} OpenGL-Programmable 06-perpixel.py Lines: 221
{GPL3} OpenGL-Programmable 09-gles2.py Lines: 276
{GPL3} OpenGL-Programmable 03-array.py Lines: 128
{GPL3} OpenGL-Programmable 10-gl3.2core.py Lines: 286
{GPL3} OpenGL-Programmable 08-pbo.py Lines: 254
{GPL3} OpenGL-Programmable 02-displaylist.py Lines: 126
{GPL3} OpenGL-Programmable 05-shader.py Lines: 213
{GPL3} OpenGL-Programmable 07-attrib.py Lines: 232
{GPL3} OpenGL-Programmable 04-vbo.py Lines: 147