Go to the documentation of this file.
33 #include <glad/glad.h>
38 #define _USE_MATH_DEFINES
47 #define CURSOR_FRAME_COUNT 60
52 "attribute vec2 vPos;\n"
55 " gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n"
62 " gl_FragColor = vec4(1.0);\n"
75 fprintf(
stderr,
"Error: %s\n", description);
80 const float c = 64 / 2.f;
82 const float i = (0.25f * (float) sin(2.
f * M_PI *
t) + 0.75f);
83 const float k = 64 * 0.046875f *
i;
85 const float dist = (float) sqrt((
x -
c) * (
x -
c) + (
y -
c) * (
y -
c));
87 const float salpha = 1.f -
dist /
c;
88 const float xalpha = (float)
x ==
c ?
c : k / (
float) fabs(
x -
c);
89 const float yalpha = (float)
y ==
c ?
c : k / (
float) fabs(
y -
c);
91 return (
float) fmax(0.
f, fmin(1.
f,
i * salpha * 0.2
f + salpha * xalpha * yalpha));
97 unsigned char buffer[64 * 64 * 4];
116 printf(
"%0.3f: Cursor position: %f %f (%+f %+f)\n",
153 printf(
"(( cursor is normal ))\n");
158 printf(
"(( cursor is disabled ))\n");
163 printf(
"(( cursor is hidden ))\n");
174 printf(
"(( %sing for events ))\n",
wait_events ?
"wait" :
"poll");
217 GLuint vertex_buffer, vertex_shader, fragment_shader, program;
218 GLint mvp_location, vpos_location;
228 if (!star_cursors[
i])
237 const int shapes[] = {
288 sizeof(vec2), (
void*) 0);
303 int wnd_width, wnd_height, fb_width, fb_height;
313 scale = (float) fb_width / (
float) wnd_width;
339 if (current_frame != star_cursors[
i])
342 current_frame = star_cursors[
i];
346 current_frame =
NULL;
GLFWAPI void glfwSwapInterval(int interval)
Sets the swap interval for the current context.
#define GLFW_CURSOR_DISABLED
#define GL_COLOR_BUFFER_BIT
#define GLFW_CURSOR_NORMAL
#define GLFW_CURSOR_HIDDEN
GLFWAPI void glfwMakeContextCurrent(GLFWwindow *window)
Makes the context of the specified window current for the calling thread.
GLFWAPI void glfwTerminate(void)
Terminates the GLFW library.
#define GLFW_ARROW_CURSOR
The regular arrow cursor shape.
GLFWAPI void glfwPollEvents(void)
Processes all pending events.
The header of the GLFW 3 API.
#define glEnableVertexAttribArray
static GLFWwindow * window
#define GLFW_CONTEXT_VERSION_MINOR
Context client API minor version hint and attribute.
static void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, float n, float f)
static GLFWcursor * standard_cursors[6]
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
Sets the error callback.
GLFWAPI void glfwWaitEvents(void)
Waits until events are queued and processes them.
GLFWAPI void glfwGetWindowSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the client area of the specified window.
GLFWAPI void glfwSwapBuffers(GLFWwindow *window)
Swaps the front and back buffers of the specified window.
#define GLFW_IBEAM_CURSOR
The text input I-beam cursor shape.
#define GLFW_HAND_CURSOR
The hand shape.
GLAPI int gladLoadGLLoader(GLADloadproc)
#define GLFW_CROSSHAIR_CURSOR
The crosshair shape.
static const char * vertex_shader_text
#define GLFW_CONTEXT_VERSION_MAJOR
Context client API major version hint and attribute.
static const char * fragment_shader_text
struct GLFWwindow GLFWwindow
void *(* GLADloadproc)(const char *name)
static const struct @17 vertices[3]
GLFWAPI int glfwInit(void)
Initializes the GLFW library.
GLFWAPI GLFWglproc glfwGetProcAddress(const char *procname)
Returns the address of the specified function for the current context.
static void error_callback(int error, const char *description)
#define GLFW_VRESIZE_CURSOR
The vertical resize arrow shape.
GLFWAPI void glfwDestroyWindow(GLFWwindow *window)
Destroys the specified window and its context.
static void cursor_position_callback(GLFWwindow *window, double x, double y)
#define CURSOR_FRAME_COUNT
void key(GLFWwindow *window, int k, int s, int action, int mods)
static int animate_cursor
#define GLFW_HRESIZE_CURSOR
The horizontal resize arrow shape.
GLFWAPI GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
Creates a window and its associated context.
static const textual_icon exit
GLFWAPI void glfwWaitEventsTimeout(double timeout)
Waits with timeout until events are queued and processes them.
GLenum GLenum GLsizei void * image
GLFWAPI void glfwWindowHint(int hint, int value)
Sets the specified window hint to the desired value.
#define glGetAttribLocation
GLFWAPI int glfwWindowShouldClose(GLFWwindow *window)
Checks the close flag of the specified window.
static void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods)
#define glVertexAttribPointer
GLFWAPI void glfwGetFramebufferSize(GLFWwindow *window, int *width, int *height)
Retrieves the size of the framebuffer of the specified window.
static float star(int x, int y, float t)
#define glGetUniformLocation
#define GL_FRAGMENT_SHADER
#define glUniformMatrix4fv
GLFWAPI void glfwSetWindowShouldClose(GLFWwindow *window, int value)
Sets the close flag of the specified window.
static GLFWcursor * create_cursor_frame(float t)
librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:01