PS2GL
OpenGL*-like API for the PS2
Loading...
Searching...
No Matches
pgl* API
+ Collaboration diagram for pgl* API:

Modules

 gs memory management
 
 defining custom renderers, primitive types, and state
 

Functions

void pglSetDisplayBuffers (int interlaced, pgl_area_handle_t frame0_mem, pgl_area_handle_t frame1_mem)
 
void pglSetDrawBuffers (int interlaced, pgl_area_handle_t frame0_mem, pgl_area_handle_t frame1_mem, pgl_area_handle_t depth_mem)
 
void pglSetInterlacingOffset (float yPixels)
 
int pglInit (int immBufferVertexSize, int immDrawBufferQwordSize)
 
int pglHasLibraryBeenInitted (void)
 
void pglFinish (void)
 
void pglWaitForVU1 (void)
 
void pglWaitForVSync (void)
 
void pglSwapBuffers (void)
 
void pglSetRenderingFinishedCallback (void(*cb)(void))
 
void pglBeginImmediateGeometry (void)
 
void pglEndImmediateGeometry (void)
 
void pglRenderImmediateGeometry (void)
 
void pglFinishRenderingImmediateGeometry (int forceImmediateStop)
 
void pglBeginGeometry (void)
 
void pglEndGeometry (void)
 
void pglRenderGeometry (void)
 
void pglFinishRenderingGeometry (int forceImmediateStop)
 
void pglEnable (GLenum cap)
 
void pglDisable (GLenum cap)
 
void pglNormalPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
 
void pglDrawIndexedArrays (GLenum primType, int numIndices, const unsigned char *indices, int numVertices)
 
void pglFreeTexture (GLuint texId)
 
void pglBindTextureToSlot (GLuint texId, pgl_slot_handle_t mem_slot)
 
void pglTextureFromGsMemArea (pgl_area_handle_t tex_area_handle)
 

Detailed Description

The pgl* functions affect the behavior of ps2gl and provide access to ps2 features not well-suited to the gl api.

The recommended way to use the ps2gl library is for the app to use the pgl* functions to configure the library. Alternatively, for a quick start try the [very incomplete] glut implementation, which will set things up using default values.

Function Documentation

◆ pglSetDisplayBuffers()

void pglSetDisplayBuffers ( int  interlaced,
pgl_area_handle_t  frame0_mem,
pgl_area_handle_t  frame1_mem 
)

#include <src/displaycontext.cpp>

Tell ps2gl what areas in GS ram to display.

Parameters
interlacedPGL_INTERLACED or PGL_NONINTERLACED
frame0_memthe first area if double-buffered, otherwise the only area
frame1_memthe second area if double-buffered, otherwise NULL

Definition at line 89 of file displaycontext.cpp.

◆ pglSetDrawBuffers()

void pglSetDrawBuffers ( int  interlaced,
pgl_area_handle_t  frame0_mem,
pgl_area_handle_t  frame1_mem,
pgl_area_handle_t  depth_mem 
)

#include <src/drawcontext.cpp>

Set the area(s) in gs mem to draw. If two frame buffers are given they will be used as double buffers.

Parameters
interlacedPGL_INTERLACED or PGL_NONINTERLACED
frame0_memthe first or only buffer
frame1_memNULL if single-buffered
depth_memthe depth buffer; NULL for none

Definition at line 926 of file drawcontext.cpp.

◆ pglSetInterlacingOffset()

void pglSetInterlacingOffset ( float  yPixels)

#include <src/drawcontext.cpp>

Definition at line 936 of file drawcontext.cpp.

◆ pglInit()

int pglInit ( int  immBufferVertexSize,
int  immDrawBufferQwordSize 
)

#include <src/glcontext.cpp>

Initialize the ps2gl library. You must call this before any other pgl* or gl* functions! (When using glut, it will be called in glutInit() if the ps2gl library was not initialized by the app previously.) Also, the application is now responsible for resetting the machine, including the display mode (putting the gs into the right output state, i.e., resolution and interlaced), usually this just means calling sceGsResetGraph.

Parameters
immBufferVertexSizeps2gl uses fixed-size internal buffers to store geometry; this argument tells the library how much space to allocate.

Definition at line 495 of file glcontext.cpp.

Referenced by glutInit().

◆ pglHasLibraryBeenInitted()

int pglHasLibraryBeenInitted ( void  )

#include <src/glcontext.cpp>

Has pglInit() been called?

Returns
1 if pglInit has been called, 0 otherwise

Definition at line 507 of file glcontext.cpp.

Referenced by glutInit().

◆ pglFinish()

void pglFinish ( void  )

#include <src/glcontext.cpp>

Do any necessary clean up when finished using ps2gl.

Definition at line 515 of file glcontext.cpp.

◆ pglWaitForVU1()

void pglWaitForVU1 ( void  )

#include <src/glcontext.cpp>

Wait for dma transfers to vif1 to end. Polls cop0, so it should not slow down the transfer, unlike sceGsSyncPath().

This call is for convenience only – there is no need to call it if the app can manage on its own.

Definition at line 529 of file glcontext.cpp.

◆ pglWaitForVSync()

void pglWaitForVSync ( void  )

#include <src/glcontext.cpp>

Wait for the vertical retrace. Note that this call is required for the interlacing to work properly. (Called by glut.)

Definition at line 538 of file glcontext.cpp.

◆ pglSwapBuffers()

void pglSwapBuffers ( void  )

#include <src/glcontext.cpp>

Signals the end of the current rendering loop and swaps anything double-buffered (display, draw buffers).

Note that this call is required. (Called by glut.)

Definition at line 549 of file glcontext.cpp.

◆ pglSetRenderingFinishedCallback()

void pglSetRenderingFinishedCallback ( void(*)(void)  cb)

#include <src/glcontext.cpp>

Set a function to be called back when rendering finishes. This function will be called from the interrupt handler; be careful!

Parameters
apointer to the callback function or NULL to clear

Definition at line 561 of file glcontext.cpp.

◆ pglBeginImmediateGeometry()

void pglBeginImmediateGeometry ( void  )

#include <src/glcontext.cpp>

Definition at line 570 of file glcontext.cpp.

◆ pglEndImmediateGeometry()

void pglEndImmediateGeometry ( void  )

#include <src/glcontext.cpp>

Definition at line 574 of file glcontext.cpp.

◆ pglRenderImmediateGeometry()

void pglRenderImmediateGeometry ( void  )

#include <src/glcontext.cpp>

Definition at line 578 of file glcontext.cpp.

◆ pglFinishRenderingImmediateGeometry()

void pglFinishRenderingImmediateGeometry ( int  forceImmediateStop)

#include <src/glcontext.cpp>

Definition at line 582 of file glcontext.cpp.

◆ pglBeginGeometry()

void pglBeginGeometry ( void  )

#include <src/glcontext.cpp>

Definition at line 591 of file glcontext.cpp.

◆ pglEndGeometry()

void pglEndGeometry ( void  )

#include <src/glcontext.cpp>

Definition at line 595 of file glcontext.cpp.

◆ pglRenderGeometry()

void pglRenderGeometry ( void  )

#include <src/glcontext.cpp>

Definition at line 599 of file glcontext.cpp.

◆ pglFinishRenderingGeometry()

void pglFinishRenderingGeometry ( int  forceImmediateStop)

#include <src/glcontext.cpp>

Definition at line 603 of file glcontext.cpp.

◆ pglEnable()

void pglEnable ( GLenum  cap)

#include <src/glcontext.cpp>

Definition at line 612 of file glcontext.cpp.

◆ pglDisable()

void pglDisable ( GLenum  cap)

#include <src/glcontext.cpp>

Definition at line 623 of file glcontext.cpp.

◆ pglNormalPointer()

void pglNormalPointer ( GLint  size,
GLenum  type,
GLsizei  stride,
const GLvoid *  ptr 
)

#include <src/gmanager.cpp>

Specify a normal pointer with either 3 or 4 elements. If 4-element normals are specified, the last element (w) will be ignored.

Definition at line 420 of file gmanager.cpp.

Referenced by glNormalPointer().

◆ pglDrawIndexedArrays()

void pglDrawIndexedArrays ( GLenum  primType,
int  numIndices,
const unsigned char *  indices,
int  numVertices 
)

#include <src/gmanager.cpp>

Definition at line 437 of file gmanager.cpp.

◆ pglFreeTexture()

void pglFreeTexture ( GLuint  texId)

#include <src/texture.cpp>

Free the named GL texture object. Note that this only frees any GS ram the texture is using, not main ram.

Definition at line 790 of file texture.cpp.

◆ pglBindTextureToSlot()

void pglBindTextureToSlot ( GLuint  texId,
pgl_slot_handle_t  mem_slot 
)

#include <src/texture.cpp>

Bind the named GL texture object to the given GS memory slot. This functions allows the application to bypass the GS memory manager.

Definition at line 802 of file texture.cpp.

◆ pglTextureFromGsMemArea()

void pglTextureFromGsMemArea ( pgl_area_handle_t  tex_area_handle)

#include <src/texture.cpp>

Texture from the given memory area. Used in the same context as glTexImage2D(), this call would probably be used with procedural textures.

Definition at line 814 of file texture.cpp.