~mcfletch/openglcontext/trunk : /tests/backgroundobject.py (revision 351)

Line Revision Contents
1 1
#! /usr/bin/env python
2
'''Tests operation of SimpleBackground object -> solid color background
3
'''
4
from OpenGLContext import testingcontext
5 296
BaseContext = testingcontext.getInteractive()
6 1
from OpenGLContext import context
7
from OpenGLContext.scenegraph import simplebackground
8
from OpenGL.GL import *
9
10
class TestContext( BaseContext ):
11
	"""Tests the SimpleBackground object's rendering.
12
	"""
13
	def OnInit( self ):
14
		"""Scene set up and initial processing"""
15
		print 'You should see a white/gray triangle over a blue background'
16
		self.Background = simplebackground.SimpleBackground(
17
			color = (0,0,1),
18
			bound = 1,
19
		).Render
20
	def Render( self, mode = 0):
21
		"""Render the geometry for the scene."""
22
		## Triggers the default operations, which allows for, for example, transparent rendering
23
		BaseContext.Render( self, mode )
24
		## Moves the drawing origin 6 units into the screen and 1.5 units to the left
25
		glTranslatef(-1.5,0.0,-6.0);
26
		## Starts the geometry generation mode
27
		glBegin(GL_TRIANGLES)
28
		glVertex3f( 0.0,  1.0, 0.0)
29
		glVertex3f(-1.0, -1.0, 0.0)
30
		glVertex3f( 1.0, -1.0, 0.0)
31
		glEnd()
32
33
if __name__ == "__main__":
34 296
	TestContext.ContextMainLoop()
35 1

Loggerhead 1.10 is a web-based interface for Bazaar branches