2013-10-26 19:03:03 +00:00
|
|
|
/* -*- c++ -*- */
|
|
|
|
/*
|
2021-01-08 12:12:43 +00:00
|
|
|
* Copyright 2013-2021 Sylvain Munaut <tnt@246tNt.com>
|
2013-10-26 19:03:03 +00:00
|
|
|
*
|
2021-01-08 12:12:43 +00:00
|
|
|
* This file is part of gr-fosphor
|
2013-10-26 19:03:03 +00:00
|
|
|
*
|
2021-01-08 12:12:43 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2013-10-26 19:03:03 +00:00
|
|
|
*/
|
|
|
|
|
2021-01-08 11:12:32 +00:00
|
|
|
#pragma once
|
2013-10-26 19:03:03 +00:00
|
|
|
|
|
|
|
#include <gnuradio/fosphor/glfw_sink_c.h>
|
|
|
|
|
2013-10-26 19:04:12 +00:00
|
|
|
#include "base_sink_c_impl.h"
|
|
|
|
|
2013-10-26 19:03:03 +00:00
|
|
|
struct GLFWwindow;
|
|
|
|
|
|
|
|
namespace gr {
|
|
|
|
namespace fosphor {
|
|
|
|
|
|
|
|
/*!
|
2013-10-26 19:04:12 +00:00
|
|
|
* \brief GLFW version of fosphor sink (implementation)
|
2013-10-26 19:03:03 +00:00
|
|
|
* \ingroup fosphor
|
|
|
|
*/
|
2013-10-26 19:04:12 +00:00
|
|
|
class glfw_sink_c_impl : public glfw_sink_c, public base_sink_c_impl
|
2013-10-26 19:03:03 +00:00
|
|
|
{
|
|
|
|
private:
|
2013-10-26 19:04:12 +00:00
|
|
|
/* GLFW stuff */
|
|
|
|
GLFWwindow *d_window;
|
2013-10-26 19:03:03 +00:00
|
|
|
|
|
|
|
void glfw_render(void);
|
|
|
|
void glfw_cb_reshape(int w, int h);
|
|
|
|
void glfw_cb_key(int key, int scancode, int action, int mods);
|
2020-01-31 09:31:57 +00:00
|
|
|
void glfw_cb_mouse(int btn, int action, int mods);
|
2013-10-26 19:03:03 +00:00
|
|
|
|
|
|
|
static void _glfw_cb_reshape(GLFWwindow *wnd, int w, int h);
|
|
|
|
static void _glfw_cb_key(GLFWwindow *wnd, int key, int scancode, int action, int mods);
|
2020-01-31 09:31:57 +00:00
|
|
|
static void _glfw_cb_mouse(GLFWwindow *wnd, int btn, int action, int mods);
|
2013-10-26 19:03:03 +00:00
|
|
|
|
2013-10-26 19:04:12 +00:00
|
|
|
protected:
|
|
|
|
/* Delegated implementation of GL context management */
|
|
|
|
void glctx_init();
|
|
|
|
void glctx_swap();
|
|
|
|
void glctx_poll();
|
|
|
|
void glctx_fini();
|
2014-01-12 09:48:21 +00:00
|
|
|
void glctx_update();
|
2013-10-26 19:03:03 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
glfw_sink_c_impl();
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace fosphor
|
|
|
|
} // namespace gr
|