forked from vircon32/vircon32-libretro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVideoOutput.hpp
91 lines (69 loc) · 2.78 KB
/
VideoOutput.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// *****************************************************************************
// start include guard
#ifndef VIDEOOUTPUT_HPP
#define VIDEOOUTPUT_HPP
// include common Vircon headers
#include "VirconDefinitions/DataStructures.hpp"
#include "VirconDefinitions/Enumerations.hpp"
// include console logic headers
#include "ConsoleLogic/ExternalInterfaces.hpp"
// include OpenGL headers
#include "glsym/glsym.h"
// *****************************************************************************
// =============================================================================
// 2D-SPECIALIZED OPENGL CONTEXT
// =============================================================================
class VideoOutput
{
private:
// arrays to hold buffer info
GLfloat QuadPositionCoords[ 8 ];
GLfloat QuadTextureCoords[ 8 ];
// current color modifiers
V32::GPUColor MultiplyColor;
V32::IOPortValues BlendingMode;
// OpenGL IDs of loaded textures
GLuint BiosTextureID;
GLuint CartridgeTextureIDs[ V32::Constants::GPUMaximumCartridgeTextures ];
// white texture used to draw solid colors
GLuint WhiteTextureID;
// additional GL objects
GLuint VAO;
GLuint VBOPositions;
GLuint VBOTexCoords;
GLuint ShaderProgramID;
// positions of shader parameters
GLuint PositionsLocation;
GLuint TexCoordsLocation;
GLuint TextureUnitLocation;
GLuint MultiplyColorLocation;
public:
// instance handling
VideoOutput();
~VideoOutput();
// context handling
bool CompileShaderProgram();
void UseShaderProgram();
void CreateWhiteTexture();
void InitRendering();
void Destroy();
// framebuffer render functions
void RenderToFramebuffer();
void BeginFrame();
// color control functions
void SetMultiplyColor( V32::GPUColor NewMultiplyColor );
V32::GPUColor GetMultiplyColor();
void SetBlendingMode( V32::IOPortValues BlendingMode );
V32::IOPortValues GetBlendingMode();
// render functions
void DrawTexturedQuad( const V32::GPUQuad& Quad );
void ClearScreen( V32::GPUColor ClearColor );
// texture handling
void SelectTexture( int GPUTextureID );
void LoadTexture( int GPUTextureID, void* Pixels );
void UnloadTexture( int GPUTextureID );
};
// *****************************************************************************
// end include guard
#endif
// *****************************************************************************