9#include "ps2gl/displaycontext.h"
10#include "ps2gl/dlist.h"
12#include "ps2s/displayenv.h"
14CDisplayContext::CDisplayContext(
CGLContext& context)
21 , DisplayIsDblBuffered(true)
22 , DisplayIsInterlaced(true)
24 DisplayEnv =
new GS::CDisplayEnv;
27CDisplayContext::~CDisplayContext()
35void CDisplayContext::SetDisplayBuffers(
bool interlaced,
36 GS::CMemArea* frame0Mem, GS::CMemArea* frame1Mem)
38 Frame0Mem = frame0Mem;
39 Frame1Mem = frame1Mem;
41 DisplayIsDblBuffered = (frame0Mem && frame1Mem);
42 DisplayIsInterlaced = interlaced;
47 CurFrameMem = Frame0Mem;
48 LastFrameMem = Frame1Mem;
50 int width = frame0Mem->GetWidth(), height = frame0Mem->GetHeight();
51 int displayHeight = (DisplayIsInterlaced) ? height * 2 : height;
53 DisplayEnv->SetFB2(frame0Mem->GetWordAddr(), width, 0, 0, frame0Mem->GetPixFormat());
54 DisplayEnv->SetDisplay2(width, displayHeight);
55 DisplayEnv->SendSettings();
58void CDisplayContext::SwapBuffers()
61 if (DisplayIsDblBuffered) {
62 GS::CMemArea* temp = CurFrameMem;
63 CurFrameMem = LastFrameMem;
69 DisplayEnv->SetFB2Addr(CurFrameMem->GetWordAddr());
70 DisplayEnv->SendSettings();
91 pGLContext->GetDisplayContext().SetDisplayBuffers(interlaced,
92 reinterpret_cast<GS::CMemArea*
>(frame0_mem),
93 reinterpret_cast<GS::CMemArea*
>(frame1_mem));
102void glPixelStorei(GLenum pname,
int param)
104 GL_FUNC_DEBUG(
"%s\n", __FUNCTION__);
109void glReadPixels(
int x,
int y,
int width,
int height,
110 GLenum format, GLenum type,
void* pixels)
112 GL_FUNC_DEBUG(
"%s(%d,%d,%d,%d,...)\n", __FUNCTION__, x, y, width, height);
117void glViewport(GLint x, GLint y,
118 GLsizei width, GLsizei height)
120 GL_FUNC_DEBUG(
"%s(%d,%d,%d,%d)\n", __FUNCTION__, x, y, width, height);
void pglSetDisplayBuffers(int interlaced, pgl_area_handle_t frame0_mem, pgl_area_handle_t frame1_mem)