Project
Loading...
Searching...
No Matches
GPUDisplayFrontendGlfw.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef GPUDISPLAYFRONTENDGLFW_H
16#define GPUDISPLAYFRONTENDGLFW_H
17
18#include "GPUDisplayFrontend.h"
19#include <pthread.h>
20
21struct GLFWwindow;
22
23namespace o2::gpu
24{
26{
27 public:
29 ~GPUDisplayFrontendGlfw() override = default;
30
31 int32_t StartDisplay() override;
32 void DisplayExit() override;
33 void SwitchFullscreen(bool set) override;
34 void ToggleMaximized(bool set) override;
35 void SetVSync(bool enable) override;
36 void OpenGLPrint(const char* s, float x, float y, float r, float g, float b, float a, bool fromBotton = true) override;
37 bool EnableSendKey() override;
38 void getSize(int32_t& width, int32_t& height) override;
39 int32_t getVulkanSurface(void* instance, void* surface) override;
40 uint32_t getReqVulkanExtensions(const char**& p) override;
41
42 private:
43 int32_t FrontendMain() override;
44 static void DisplayLoop();
45
46 static void error_callback(int32_t error, const char* description);
47 static void key_callback(GLFWwindow* mWindow, int32_t key, int32_t scancode, int32_t action, int32_t mods);
48 static void char_callback(GLFWwindow* window, uint32_t codepoint);
49 static void mouseButton_callback(GLFWwindow* mWindow, int32_t button, int32_t action, int32_t mods);
50 static void scroll_callback(GLFWwindow* mWindow, double x, double y);
51 static void cursorPos_callback(GLFWwindow* mWindow, double x, double y);
52 static void resize_callback(GLFWwindow* mWindow, int32_t width, int32_t height);
53 static int32_t GetKey(int32_t key);
54 static void GetKey(int32_t keyin, int32_t scancode, int32_t mods, int32_t& keyOut, int32_t& keyPressOut);
55
56 GLFWwindow* mWindow;
57
58 volatile bool mGlfwRunning = false;
59 pthread_mutex_t mSemLockExit = PTHREAD_MUTEX_INITIALIZER;
60 int32_t mWindowX = 0;
61 int32_t mWindowY = 0;
62 int32_t mWindowWidth = INIT_WIDTH;
63 int32_t mWindowHeight = INIT_HEIGHT;
64 uint8_t mKeyDownMap[256] = {0};
65 uint8_t mLastKeyDown = 0;
66 bool mUseIMGui = false;
67};
68} // namespace o2::gpu
69
70#endif
StringRef key
void getSize(int32_t &width, int32_t &height) override
void OpenGLPrint(const char *s, float x, float y, float r, float g, float b, float a, bool fromBotton=true) override
uint32_t getReqVulkanExtensions(const char **&p) override
~GPUDisplayFrontendGlfw() override=default
int32_t getVulkanSurface(void *instance, void *surface) override
static constexpr int32_t INIT_WIDTH
static constexpr int32_t INIT_HEIGHT
GLint GLenum GLint x
Definition glcorearb.h:403
GLint GLsizei GLsizei height
Definition glcorearb.h:270
GLint GLsizei width
Definition glcorearb.h:270
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLboolean GLboolean g
Definition glcorearb.h:1233
GLboolean enable
Definition glcorearb.h:3991
GLboolean r
Definition glcorearb.h:1233
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
HANDLE pthread_mutex_t