Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

pgl API

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


Modules

gs memory management
 Functions to initialize, allocate, and free gs memory.

defining custom renderers, primitive types, and state
 API to define custom primitive types, state chagnes, renderers, or override the default renderers.


Functions

void pglSetDisplayBuffers (int interlaced, pgl_area_handle_t frame0_mem, pgl_area_handle_t frame1_mem)
 Tell ps2gl what areas in GS ram to display. More...

void pglSetDrawBuffers (int interlaced, pgl_area_handle_t frame0_mem, pgl_area_handle_t frame1_mem, pgl_area_handle_t depth_mem)
 Set the area(s) in gs mem to draw. More...

void pglSetInterlacingOffset (float yPixels)
int pglInit (int immBufferVertexSize, int immDrawBufferQwordSize)
 Initialize the ps2gl library. More...

int pglHasLibraryBeenInitted (void)
 Has pglInit() been called? More...

void pglFinish (void)
 Do any necessary clean up when finished using ps2gl. More...

void pglWaitForVU1 (void)
 Wait for dma transfers to vif1 to end. More...

void pglWaitForVSync (void)
 Wait for the vertical retrace. More...

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

void pglSetRenderingFinishedCallback (void(*cb)(void))
 Set a function to be called back when rendering finishes. More...

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)
 Specify a normal pointer with either 3 or 4 elements. More...

void pglDrawIndexedArrays (GLenum primType, int numIndices, const unsigned char *indices, int numVertices)
void pglFreeTexture (GLuint texId)
 Free the named GL texture object. More...

void pglBindTextureToSlot (GLuint texId, pgl_slot_handle_t mem_slot)
 Bind the named GL texture object to the given GS memory slot. More...

void pglTextureFromGsMemArea (pgl_area_handle_t tex_area_handle)
 Texture from the given memory area. More...


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

void pglBeginGeometry void   
 

Definition at line 670 of file glcontext.cpp.

Referenced by glutMainLoop().

void pglBeginImmediateGeometry void   
 

Definition at line 645 of file glcontext.cpp.

void pglBindTextureToSlot GLuint    texId,
pgl_slot_handle_t    mem_slot
 

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 753 of file texture.cpp.

void pglDisable GLenum    cap
 

Definition at line 707 of file glcontext.cpp.

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

Definition at line 354 of file gmanager.cpp.

void pglEnable GLenum    cap
 

Definition at line 695 of file glcontext.cpp.

void pglEndGeometry void   
 

Definition at line 675 of file glcontext.cpp.

Referenced by glutMainLoop().

void pglEndImmediateGeometry void   
 

Definition at line 650 of file glcontext.cpp.

void pglFinish void   
 

Do any necessary clean up when finished using ps2gl.

Definition at line 545 of file glcontext.cpp.

Referenced by pglU64_t().

void pglFinishRenderingGeometry int    forceImmediateStop
 

Definition at line 685 of file glcontext.cpp.

void pglFinishRenderingImmediateGeometry int    forceImmediateStop
 

Definition at line 660 of file glcontext.cpp.

void pglFreeTexture GLuint    texId
 

Free the named GL texture object.

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

Definition at line 740 of file texture.cpp.

int pglHasLibraryBeenInitted void   
 

Has pglInit() been called?

Returns:
1 if pglInit has been called, 0 otherwise

Definition at line 536 of file glcontext.cpp.

Referenced by glutInit(), and pglU64_t().

int pglInit int    immBufferVertexSize,
int    immDrawBufferQwordSize
 

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:
immBufferVertexSize  ps2gl uses fixed-size internal buffers to store geometry; this argument tells the library how much space to allocate.

Definition at line 523 of file glcontext.cpp.

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

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 337 of file gmanager.cpp.

void pglRenderGeometry void   
 

Definition at line 680 of file glcontext.cpp.

Referenced by glutMainLoop().

void pglRenderImmediateGeometry void   
 

Definition at line 655 of file glcontext.cpp.

void pglSetDisplayBuffers int    interlaced,
pgl_area_handle_t    frame0_mem,
pgl_area_handle_t    frame1_mem
 

Tell ps2gl what areas in GS ram to display.

Parameters:
interlaced  PGL_INTERLACED or PGL_NONINTERLACED
frame0_mem  the first area if double-buffered, otherwise the only area
frame1_mem  the second area if double-buffered, otherwise NULL

Definition at line 107 of file displaycontext.cpp.

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

Set the area(s) in gs mem to draw.

If two frame buffers are given they will be used as double buffers.

Parameters:
interlaced  PGL_INTERLACED or PGL_NONINTERLACED
frame0_mem  the first or only buffer
frame1_mem  NULL if single-buffered
depth_mem  the depth buffer; NULL for none

Definition at line 724 of file drawcontext.cpp.

void pglSetInterlacingOffset float    yPixels
 

Definition at line 735 of file drawcontext.cpp.

void pglSetRenderingFinishedCallback void(*    cb)(void)
 

Set a function to be called back when rendering finishes.

This function will be called from the interrupt handler; be careful!

Parameters:
a  pointer to the callback function or NULL to clear

Definition at line 635 of file glcontext.cpp.

void pglSwapBuffers void   
 

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 622 of file glcontext.cpp.

Referenced by glutMainLoop(), and pglU64_t().

void pglTextureFromGsMemArea pgl_area_handle_t    tex_area_handle
 

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 765 of file texture.cpp.

void pglWaitForVSync void   
 

Wait for the vertical retrace.

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

Definition at line 610 of file glcontext.cpp.

Referenced by glutMainLoop(), and pglU64_t().

void pglWaitForVU1 void   
 

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 565 of file glcontext.cpp.

Referenced by CGLContext::FinishRenderingGeometry(), and pglU64_t().


ps2gl version cvs