#append this to module path so we can load from the parent directory
import sys, os
from scaffold import web
from scaffold.loaders import load, load_partial


class page:
    name=__name__
    title = 'GTK3 Displaying OpenGL inside a drawing area'
    tags = 'GTK3', 'Python', 'opengl', 'drawingarea'
    intro = 'Load a glade file displaying a drawing area widget and setup a context for opengl.'
    date = '2014-04-20'
    path = os.path.abspath('./')
    image = web.template.path_image + '/gtk/tut12-mixing-opengl-with-gtk.png'

    def create_content(self):
        web.images.create(self.image, title='GTK Window')
        web.page.section(
            web.div.create(
                web.images.render()
            ).set_classes('sources').render()
        )

        web.paragraph.create(
            """Example of rendering opengl inside a gtk drawing area. I have seperated out the opengl code from the main gtk widget this makes it simpler to use in your own applications. """)


        web.paragraph.append('The example below will draw a basic opengl triangle so you know everything is setup and working, it also attaches to the drawing area resize events so you can resize the window.')
        web.page.section(web.paragraph.render())

        web.pre.create(load(os.path.abspath('./content/gtk3/tut12/tut12-mixing-opengl-with-gtk.py')))
        web.page.section(web.pre.render())

