CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/SDL/SDLGLGraphicsContext.h
Views: 1401
1
#include "ppsspp_config.h"
2
#if PPSSPP_PLATFORM(MAC)
3
#include "SDL2/SDL.h"
4
#include "SDL2/SDL_syswm.h"
5
#else
6
#include "SDL.h"
7
#include "SDL_syswm.h"
8
#endif
9
10
#include <string>
11
12
#include "Common/GPU/OpenGL/GLRenderManager.h"
13
#include "Common/GPU/OpenGL/GLCommon.h"
14
#include "Common/GraphicsContext.h"
15
16
class SDLGLGraphicsContext : public GraphicsContext {
17
public:
18
// Returns 0 on success.
19
int Init(SDL_Window *&window, int x, int y, int w, int h, int mode, std::string *error_message);
20
21
bool InitFromRenderThread(std::string *errorMessage) override;
22
23
void Shutdown() override {}
24
void ShutdownFromRenderThread() override;
25
26
void Resize() override {}
27
28
Draw::DrawContext *GetDrawContext() override {
29
return draw_;
30
}
31
32
void ThreadStart() override {
33
renderManager_->ThreadStart(draw_);
34
}
35
36
bool ThreadFrame() override {
37
return renderManager_->ThreadFrame();
38
}
39
40
void ThreadEnd() override {
41
renderManager_->ThreadEnd();
42
}
43
44
void StopThread() override {
45
renderManager_->StopThread();
46
}
47
48
private:
49
Draw::DrawContext *draw_ = nullptr;
50
SDL_Window *window_ = nullptr;
51
SDL_GLContext glContext = nullptr;
52
GLRenderManager *renderManager_ = nullptr;
53
};
54
55