PS2GL
OpenGL*-like API for the PS2
Loading...
Searching...
No Matches
ps2gl.h
1/* Copyright (C) 2000,2001,2002 Sony Computer Entertainment America
2
3 This file is subject to the terms and conditions of the GNU Lesser
4 General Public License Version 2.1. See the file "COPYING" in the
5 main directory of this archive for more details. */
6
7#ifndef ps2gl_h
8#define ps2gl_h
9
10#include "GL/gl.h"
11
12/********************************************
13 * types
14 */
15
16typedef long long pgl64_t;
17typedef unsigned long long pglU64_t;
18
19#ifdef __cplusplus
20extern "C" {
21#endif // __cplusplus
22
23// immBufferVertexSize is the size in vertices of the buffers used to store
24// glBegin/glEnd geometry. there are currently 2 sets of buffers:
25// vertex, normal, tex coord, and color buffers.
26extern int pglInit(int immBufferVertexSize, int immDrawBufferQwordSize);
27extern int pglHasLibraryBeenInitted(void);
28extern void pglFinish(void);
29
30extern void pglWaitForVU1(void);
31extern void pglWaitForVSync(void);
32extern void pglSwapBuffers(void);
33
34// gs memory allocation
35
36extern void pglPrintGsMemAllocation(void);
37extern int pglHasGsMemBeenInitted(void);
38
39// gs mem slots
40
41typedef unsigned int pgl_slot_handle_t;
42
43extern pgl_slot_handle_t pglAddGsMemSlot(int startingPage, int pageLength, unsigned int pixelMode);
44extern void pglLockGsMemSlot(pgl_slot_handle_t slot_handle);
45extern void pglUnlockGsMemSlot(pgl_slot_handle_t slot_handle);
46extern void pglRemoveAllGsMemSlots();
47
48// gs mem areas
49
50typedef unsigned int pgl_area_handle_t;
51
52extern pgl_area_handle_t pglCreateGsMemArea(int width, int height, unsigned int pix_format);
53extern void pglDestroyGsMemArea(pgl_area_handle_t mem_area);
54
55extern void pglAllocGsMemArea(pgl_area_handle_t mem_area);
56extern void pglFreeGsMemArea(pgl_area_handle_t mem_area);
57
58extern void pglSetGsMemAreaWordAddr(pgl_area_handle_t mem_area, unsigned int addr);
59
60extern void pglBindGsMemAreaToSlot(pgl_area_handle_t mem_area, pgl_slot_handle_t mem_slot);
61extern void pglUnbindGsMemArea(pgl_area_handle_t mem_area);
62
63extern void pglLockGsMemArea(pgl_area_handle_t mem_area);
64extern void pglUnlockGsMemArea(pgl_area_handle_t mem_area);
65
66extern int pglGsMemAreaIsAllocated(pgl_area_handle_t mem_area);
67extern unsigned int pglGetGsMemAreaWordAddr(pgl_area_handle_t mem_area);
68
69// display and draw management
70
71extern void pglSetDisplayBuffers(int interlaced,
72 pgl_area_handle_t frame0_mem, pgl_area_handle_t frame1_mem);
73extern void pglSetDrawBuffers(int interlaced,
74 pgl_area_handle_t frame0_mem, pgl_area_handle_t frame1_mem,
75 pgl_area_handle_t depth_mem);
76
77// textures
78
79void pglTextureFromGsMemArea(pgl_area_handle_t tex_area_handle);
80
81void pglBindTextureToSlot(GLuint texId, pgl_slot_handle_t mem_slot);
82void pglFreeTexture(GLuint texId);
83
84// geometry
85
86void pglNormalPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* ptr);
87void pglDrawIndexedArrays(GLenum primType,
88 int numIndices, const unsigned char* indices,
89 int numVertices);
90
91void pglBeginImmediateGeometry(void);
92void pglEndImmediateGeometry(void);
93void pglRenderImmediateGeometry(void);
94void pglFinishRenderingImmediateGeometry(int forceImmediateStop);
95
96void pglBeginGeometry(void);
97void pglEndGeometry(void);
98void pglRenderGeometry(void);
99void pglFinishRenderingGeometry(int forceImmediateStop);
100
101void pglSetRenderingFinishedCallback(void (*cb)(void));
102
103// general
104
105void pglEnable(GLenum cap);
106void pglDisable(GLenum cap);
107
108void pglSetInterlacingOffset(float yPixels);
109
110const char* pglGetCurRendererName();
111
112// custom renderers
113
115void pglRegisterRenderer(void* renderer);
116void pglEndRendererDefs();
117
118// custom prim types
119
120void pglRegisterCustomPrimType(GLenum primType,
121 pglU64_t requirements,
122 pglU64_t rendererReqMask,
123 int mergeContiguous);
124
125// custom state
126
127void pglEnableCustom(pglU64_t flag);
128void pglDisableCustom(pglU64_t flag);
129
130#ifdef __cplusplus
131}
132#endif // __cplusplus
133
134// "capabilities" (things that can be passed to pglEnable/pglDisable
135
136#define PGL_CLIPPING 2
137
138// for pglFinishRendering
139
140#define PGL_FORCE_IMMEDIATE_STOP 1
141#define PGL_DONT_FORCE_IMMEDIATE_STOP 0
142
143// for pglSetDrawBuffers / pglSetDisplayBuffers
144
145#define PGL_NONINTERLACED 0
146#define PGL_INTERLACED 1
147
148// custom prim types
149
150#define PGL_DONT_MERGE_CONTIGUOUS 0
151#define PGL_MERGE_CONTIGUOUS 1
152
153// various limits
154
155#define PGL_MAX_CUSTOM_RENDERERS 64
156#define PGL_MAX_CUSTOM_PRIM_TYPES 32
157
158#endif // ps2gl_h
void pglRegisterRenderer(void *renderer)
void pglDisableCustom(pglU64_t flag)
Definition gmanager.cpp:502
const char * pglGetCurRendererName()
void pglEndRendererDefs()
void pglRegisterCustomPrimType(GLenum primType, pglU64_t requirements, pglU64_t rendererReqMask, int mergeContiguous)
Definition gmanager.cpp:477
void pglBeginRendererDefs()
void pglEnableCustom(pglU64_t flag)
Definition gmanager.cpp:490
void pglDestroyGsMemArea(pgl_area_handle_t mem_area)
Definition gsmemory.cpp:194
void pglSetGsMemAreaWordAddr(pgl_area_handle_t mem_area, unsigned int addr)
Definition gsmemory.cpp:231
void pglLockGsMemArea(pgl_area_handle_t mem_area)
Definition gsmemory.cpp:261
int pglGsMemAreaIsAllocated(pgl_area_handle_t mem_area)
Definition gsmemory.cpp:277
void pglBindGsMemAreaToSlot(pgl_area_handle_t mem_area, pgl_slot_handle_t mem_slot)
Definition gsmemory.cpp:241
void pglUnlockGsMemArea(pgl_area_handle_t mem_area)
Definition gsmemory.cpp:269
void pglFreeGsMemArea(pgl_area_handle_t mem_area)
Definition gsmemory.cpp:220
unsigned int pglGetGsMemAreaWordAddr(pgl_area_handle_t mem_area)
Definition gsmemory.cpp:286
void pglUnbindGsMemArea(pgl_area_handle_t mem_area)
Definition gsmemory.cpp:251
pgl_area_handle_t pglCreateGsMemArea(int width, int height, unsigned int pix_format)
Definition gsmemory.cpp:185
void pglAllocGsMemArea(pgl_area_handle_t mem_area)
Definition gsmemory.cpp:210
void pglRemoveAllGsMemSlots()
Definition gsmemory.cpp:151
pgl_slot_handle_t pglAddGsMemSlot(int startingPage, int pageLength, unsigned int pixelMode)
Definition gsmemory.cpp:118
void pglUnlockGsMemSlot(pgl_slot_handle_t slot_handle)
Definition gsmemory.cpp:142
void pglLockGsMemSlot(pgl_slot_handle_t slot_handle)
Definition gsmemory.cpp:132
int pglHasGsMemBeenInitted(void)
Definition gsmemory.cpp:50
void pglPrintGsMemAllocation(void)
Definition gsmemory.cpp:40
void pglSetRenderingFinishedCallback(void(*cb)(void))
void pglSetDisplayBuffers(int interlaced, pgl_area_handle_t frame0_mem, pgl_area_handle_t frame1_mem)
void pglTextureFromGsMemArea(pgl_area_handle_t tex_area_handle)
Definition texture.cpp:814
void pglFinish(void)
void pglFreeTexture(GLuint texId)
Definition texture.cpp:790
void pglNormalPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
Definition gmanager.cpp:420
void pglSetDrawBuffers(int interlaced, pgl_area_handle_t frame0_mem, pgl_area_handle_t frame1_mem, pgl_area_handle_t depth_mem)
void pglBindTextureToSlot(GLuint texId, pgl_slot_handle_t mem_slot)
Definition texture.cpp:802
void pglWaitForVU1(void)
void pglSwapBuffers(void)
int pglHasLibraryBeenInitted(void)
void pglWaitForVSync(void)
int pglInit(int immBufferVertexSize, int immDrawBufferQwordSize)