コード例 #1
0
ファイル: helloworld.py プロジェクト: jnadro/pybgfx_examples
 def init(self):
     bgfx.init(bgfx.BGFX_RENDERER_TYPE_COUNT,
               bgfx.BGFX_PCI_ID_NONE, 0, None, None)
     bgfx.reset(self.width, self.height, bgfx.BGFX_RESET_VSYNC)
     bgfx.set_debug(bgfx.BGFX_DEBUG_TEXT)
     bgfx.set_view_clear(0, bgfx.BGFX_CLEAR_COLOR |
                         bgfx.BGFX_CLEAR_DEPTH, 0x303030ff, 1.0, 0)
コード例 #2
0
ファイル: raymarch.py プロジェクト: jnadro/pybgfx_examples
    def init(self):
        bgfx.init(bgfx.BGFX_RENDERER_TYPE_COUNT,
                  bgfx.BGFX_PCI_ID_NONE, 0, None, None)
        bgfx.reset(self.width, self.height, bgfx.BGFX_RESET_VSYNC)
        bgfx.set_debug(bgfx.BGFX_DEBUG_TEXT)
        bgfx.set_view_clear(0, bgfx.BGFX_CLEAR_COLOR |
                            bgfx.BGFX_CLEAR_DEPTH, 0x303030ff, 1.0, 0)

        # Create vertex stream declaration.
        rendererType = bgfx.get_renderer_type()
        self.ms_decl = bgfx.vertex_decl()
        bgfx.vertex_decl_begin(byref(self.ms_decl), rendererType)
        bgfx.vertex_decl_add(self.ms_decl, bgfx.BGFX_ATTRIB_POSITION,
                             3, bgfx.BGFX_ATTRIB_TYPE_FLOAT, False, False)
        bgfx.vertex_decl_add(self.ms_decl, bgfx.BGFX_ATTRIB_COLOR0,
                             4, bgfx.BGFX_ATTRIB_TYPE_UINT8, True, False)
        bgfx.vertex_decl_add(self.ms_decl, bgfx.BGFX_ATTRIB_TEXCOORD0, 2, bgfx.BGFX_ATTRIB_TYPE_FLOAT, False, False)
        bgfx.vertex_decl_end(self.ms_decl)

        self.u_mtx = bgfx.create_uniform("u_mtx", bgfx.BGFX_UNIFORM_TYPE_MAT4, 1)
        self.u_light_dir_time = bgfx.create_uniform("u_lightDirTime", bgfx.BGFX_UNIFORM_TYPE_VEC4, 1)

        # Create program from shaders.
        self.raymarching = bgfx.loadProgram("vs_raymarching", "fs_raymarching")