if(bAdvancedBlend) bUseMultiPass=TRUE; // -> pseudo-advanced with 2 passes\r
else bUseMultiPass=FALSE; // -> or simple 'bright color' mode\r
// bGLBlend=FALSE; // -> no ext blending!\r
-\r
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); \r
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glError();\r
}\r
\r
if(bOpaquePass) // opaque mode?\r
}\r
\r
TCF[1]=XP8RGBA_1;\r
- glAlphaFuncx(GL_GREATER,0.49f);\r
+ glAlphaFuncx(GL_GREATER,0.49f); glError();\r
+\r
}\r
else // no opaque mode?\r
{\r
TCF[0]=TCF[1]=P8RGBA;\r
PalTexturedColourFn=P8RGBA; // -> init col func\r
- glAlphaFuncx(GL_NOTEQUAL,0); // --> set alpha func\r
+ glAlphaFuncx(GL_NOTEQUAL,0); glError(); // --> set alpha func\r
+\r
}\r
\r
//----------------------------------------------------//\r
LoadSubTexFn=LoadSubTexturePageSort; // init load tex ptr\r
\r
bBlendEnable=FALSE; // init blending: off\r
- glDisable(GL_BLEND);\r
+ glDisable(GL_BLEND); glError();\r
+\r
\r
SetScanTrans(); // init scan lines (if wanted)\r
}\r
glViewport(rRatioRect.left, // init viewport by ratio rect\r
iResY-(rRatioRect.top+rRatioRect.bottom),\r
rRatioRect.right, \r
- rRatioRect.bottom); \r
+ rRatioRect.bottom); glError();\r
\r
- glScissor(0, 0, iResX, iResY); // init clipping (fullscreen)\r
- glEnable(GL_SCISSOR_TEST); \r
+ glScissor(0, 0, iResX, iResY); glError(); // init clipping (fullscreen)\r
+ glEnable(GL_SCISSOR_TEST); glError();\r
\r
#ifndef OWNSCALE\r
glMatrixMode(GL_TEXTURE); // init psx tex sow and tow if not "ownscale"\r
glScalef(1.0f/255.99f,1.0f/255.99f,1.0f); // geforce precision hack\r
#endif \r
\r
- glMatrixMode(GL_PROJECTION); // init projection with psx resolution\r
- glLoadIdentity();\r
+ glMatrixMode(GL_PROJECTION); glError(); // init projection with psx resolution\r
+ glLoadIdentity(); glError();\r
glOrtho(0,PSXDisplay.DisplayMode.x,\r
- PSXDisplay.DisplayMode.y, 0, -1, 1);\r
+ PSXDisplay.DisplayMode.y, 0, -1, 1); glError();\r
\r
if(iZBufferDepth) // zbuffer?\r
{\r
uiBufferBits=GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT;\r
- glEnable(GL_DEPTH_TEST); \r
- glDepthFunc(GL_ALWAYS);\r
+ glEnable(GL_DEPTH_TEST); glError();\r
+ glDepthFunc(GL_ALWAYS); glError();\r
iDepthFunc=1;\r
}\r
else // no zbuffer?\r
{\r
uiBufferBits=GL_COLOR_BUFFER_BIT;\r
- glDisable(GL_DEPTH_TEST);\r
+ glDisable(GL_DEPTH_TEST); glError();\r
}\r
\r
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // first buffer clear\r
- glClear(uiBufferBits);\r
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glError(); // first buffer clear\r
+ glClear(uiBufferBits); glError();\r
\r
GetExtInfos(); // get ext infos\r
SetExtGLFuncs(); // init all kind of stuff (tex function pointers)\r
\r
- glEnable(GL_ALPHA_TEST); // wanna alpha test\r
+ glEnable(GL_ALPHA_TEST); glError(); // wanna alpha test\r
\r
{\r
- glDisable(GL_LINE_SMOOTH);\r
- glDisable(GL_POINT_SMOOTH);\r
+ glDisable(GL_LINE_SMOOTH); glError();\r
+ glDisable(GL_POINT_SMOOTH); glError();\r
}\r
\r
ubGloAlpha=127; // init some drawing vars\r
\r
if(bDrawDither) glEnable(GL_DITHER); // dither mode\r
else glDisable(GL_DITHER); \r
-\r
- glDisable(GL_FOG); // turn all (currently) unused modes off\r
- glDisable(GL_LIGHTING); \r
- glDisable(GL_STENCIL_TEST); \r
- glDisable(GL_TEXTURE_2D);\r
+ glError(); \r
+ glDisable(GL_FOG); glError(); // turn all (currently) unused modes off\r
+ glDisable(GL_LIGHTING); glError(); \r
+ glDisable(GL_STENCIL_TEST); glError(); \r
+ glDisable(GL_TEXTURE_2D); glError();\r
glDisable(GL_CULL_FACE);\r
\r
- glFlush(); // we are done...\r
- glFinish(); \r
+ glFlush(); glError(); // we are done...\r
+ glFinish(); glError(); \r
\r
CreateScanLines(); // setup scanline stuff (if wanted)\r
\r
{\r
if(gLastTex!=gTexName || gLastFMode!=0)\r
{\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glError();\r
gLastTex=gTexName;gLastFMode=0;\r
}\r
}\r
{\r
if(gLastTex!=gTexName || gLastFMode!=1)\r
{\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glError();\r
gLastTex=gTexName;gLastFMode=1;\r
}\r
}\r
{\r
if(gLastTex!=gTexName || gLastFMode!=1)\r
{\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glError();\r
gLastTex=gTexName;gLastFMode=1;\r
}\r
}\r
if(bSetClip || !EqualRect(&rC,&rX))\r
{\r
rC=rX;\r
- glScissor(rC.left,rC.top,rC.right,rC.bottom);\r
+ glScissor(rC.left,rC.top,rC.right,rC.bottom); glError();\r
+ //LOGE("glscissor:%d %d %d %d",rC.left,rC.top,rC.right,rC.bottom);\r
bSetClip=FALSE; \r
}\r
return;\r
\r
if(bSetClip || !EqualRect(&r,&rC))\r
{\r
- glScissor(r.left,r.top,r.right,r.bottom);\r
+ glScissor(r.left,r.top,r.right,r.bottom); glError();\r
+\r
rC=r;\r
bSetClip=FALSE;\r
}\r
glViewport(rRatioRect.left, // init viewport by ratio rect\r
iResY-(rRatioRect.top+rRatioRect.bottom),\r
rRatioRect.right, \r
- rRatioRect.bottom); \r
+ rRatioRect.bottom); glError();\r
\r
- glScissor(0, 0, iResX, iResY); // init clipping (fullscreen)\r
- glEnable(GL_SCISSOR_TEST); \r
+ glScissor(0, 0, iResX, iResY); glError(); // init clipping (fullscreen)\r
+ glEnable(GL_SCISSOR_TEST); glError();\r
\r
#ifndef OWNSCALE\r
glMatrixMode(GL_TEXTURE); // init psx tex sow and tow if not "ownscale"\r
glScalef(1.0f/255.99f,1.0f/255.99f,1.0f); // geforce precision hack\r
#endif \r
\r
- glMatrixMode(GL_PROJECTION); // init projection with psx resolution\r
- glLoadIdentity();\r
+ glMatrixMode(GL_PROJECTION); glError(); // init projection with psx resolution\r
+ glLoadIdentity(); glError();\r
glOrtho(0,PSXDisplay.DisplayMode.x,\r
- PSXDisplay.DisplayMode.y, 0, -1, 1);\r
+ PSXDisplay.DisplayMode.y, 0, -1, 1); glError();\r
if (bKeepRatio)\r
SetAspectRatio();\r
}\r
void PaintBlackBorders(void)\r
{\r
short s;\r
+ glDisable(GL_SCISSOR_TEST); glError();\r
+ if(bTexEnabled) {glDisable(GL_TEXTURE_2D);bTexEnabled=FALSE;} glError();\r
+ if(bOldSmoothShaded) {glShadeModel(GL_FLAT);bOldSmoothShaded=FALSE;} glError();\r
+ if(bBlendEnable) {glDisable(GL_BLEND);bBlendEnable=FALSE;} glError();\r
+ glDisable(GL_ALPHA_TEST); glError();\r
\r
- glDisable(GL_SCISSOR_TEST);\r
- if(bTexEnabled) {glDisable(GL_TEXTURE_2D);bTexEnabled=FALSE;}\r
- if(bOldSmoothShaded) {glShadeModel(GL_FLAT);bOldSmoothShaded=FALSE;}\r
- if(bBlendEnable) {glDisable(GL_BLEND);bBlendEnable=FALSE;}\r
- glDisable(GL_ALPHA_TEST);\r
+ glEnable(GL_ALPHA_TEST); glError();\r
+ glEnable(GL_SCISSOR_TEST); glError();\r
\r
- glEnable(GL_ALPHA_TEST);\r
- glEnable(GL_SCISSOR_TEST);\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
\r
if(PSXDisplay.Disabled) // display disabled?\r
{\r
+ //LOGE("PSXDisplay.Disabled");\r
+\r
// moved here\r
- glDisable(GL_SCISSOR_TEST); \r
- glClearColor(0,0,0,128); // -> clear whole backbuffer\r
- glClear(uiBufferBits);\r
- glEnable(GL_SCISSOR_TEST); \r
+ glDisable(GL_SCISSOR_TEST); glError(); \r
+ glClearColor(0,0,0,128); glError(); // -> clear whole backbuffer\r
+ glClear(uiBufferBits); glError();\r
+ glEnable(GL_SCISSOR_TEST); glError(); \r
gl_z=0.0f;\r
bDisplayNotSet = TRUE;\r
}\r
g=((GLclampf)GREEN(lClearOnSwapColor))/255.0f; // -> get col\r
b=((GLclampf)BLUE(lClearOnSwapColor))/255.0f;\r
r=((GLclampf)RED(lClearOnSwapColor))/255.0f;\r
- \r
- glDisable(GL_SCISSOR_TEST); \r
- glClearColor(r,g,b,128); // -> clear \r
- glClear(uiBufferBits);\r
- glEnable(GL_SCISSOR_TEST); \r
+ glDisable(GL_SCISSOR_TEST); glError(); \r
+ glClearColor(r,g,b,128); glError(); // -> clear \r
+ glClear(uiBufferBits); glError();\r
+ glEnable(GL_SCISSOR_TEST); glError(); \r
lClearOnSwap=0; // -> done\r
}\r
else \r
\r
if(iZBufferDepth) // clear zbuffer as well (if activated)\r
{\r
- glDisable(GL_SCISSOR_TEST); \r
- glClear(GL_DEPTH_BUFFER_BIT);\r
- glEnable(GL_SCISSOR_TEST); \r
+ glDisable(GL_SCISSOR_TEST); glError();\r
+ glClear(GL_DEPTH_BUFFER_BIT); glError();\r
+ glEnable(GL_SCISSOR_TEST); glError();\r
}\r
}\r
+\r
gl_z=0.0f;\r
\r
//----------------------------------------------------//\r
glViewport(rRatioRect.left+i1, \r
iResY-(rRatioRect.top+rRatioRect.bottom)+i2,\r
rRatioRect.right+i3, \r
- rRatioRect.bottom+i4); \r
+ rRatioRect.bottom+i4); glError();\r
}\r
\r
//----------------------------------------------------//\r
\r
r.left = (iResX-r.right)/2;\r
r.top = (iResY-r.bottom)/2;\r
-\r
if(r.bottom<rRatioRect.bottom ||\r
r.right <rRatioRect.right)\r
{\r
RECT rC;\r
- glClearColor(0,0,0,128); \r
+ glClearColor(0,0,0,128); glError();\r
\r
if(r.right <rRatioRect.right)\r
{\r
rC.top=0;\r
rC.right=r.left;\r
rC.bottom=iResY;\r
- glScissor(rC.left,rC.top,rC.right,rC.bottom);\r
- glClear(uiBufferBits);\r
+ glScissor(rC.left,rC.top,rC.right,rC.bottom); glError();\r
+ glClear(uiBufferBits); glError();\r
rC.left=iResX-rC.right;\r
- glScissor(rC.left,rC.top,rC.right,rC.bottom);\r
- glClear(uiBufferBits);\r
+ glScissor(rC.left,rC.top,rC.right,rC.bottom); glError();\r
+ \r
+ glClear(uiBufferBits); glError();\r
}\r
\r
if(r.bottom <rRatioRect.bottom)\r
rC.top=0;\r
rC.right=iResX;\r
rC.bottom=r.top;\r
- glScissor(rC.left,rC.top,rC.right,rC.bottom);\r
- glClear(uiBufferBits);\r
+ glScissor(rC.left,rC.top,rC.right,rC.bottom); glError();\r
+\r
+ glClear(uiBufferBits); glError();\r
rC.top=iResY-rC.bottom;\r
- glScissor(rC.left,rC.top,rC.right,rC.bottom);\r
- glClear(uiBufferBits);\r
+ glScissor(rC.left,rC.top,rC.right,rC.bottom); glError();\r
+ glClear(uiBufferBits); glError();\r
}\r
\r
bSetClip=TRUE;\r
glViewport(rRatioRect.left,\r
iResY-(rRatioRect.top+rRatioRect.bottom),\r
rRatioRect.right,\r
- rRatioRect.bottom); // init viewport\r
+ rRatioRect.bottom); glError(); // init viewport\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
}\r
else // some res change?\r
{\r
- glLoadIdentity();\r
+ glLoadIdentity(); glError();\r
glOrtho(0,PSXDisplay.DisplayModeNew.x, // -> new psx resolution\r
- PSXDisplay.DisplayModeNew.y, 0, -1, 1);\r
+ PSXDisplay.DisplayModeNew.y, 0, -1, 1); glError();\r
if(bKeepRatio) SetAspectRatio();\r
}\r
\r
\r
if(!pGfxCardScreen)\r
{\r
- glPixelStorei(GL_PACK_ALIGNMENT,1);\r
+ glPixelStorei(GL_PACK_ALIGNMENT,1); glError();\r
pGfxCardScreen=(unsigned char *)malloc(iResX*iResY*4);\r
}\r
\r
\r
//if(!sArea) glReadBuffer(GL_FRONT);\r
\r
- glReadPixels(x,y,dx,dy,GL_RGB,GL_UNSIGNED_BYTE,ps);\r
- \r
+ glReadPixels(x,y,dx,dy,GL_RGB,GL_UNSIGNED_BYTE,ps); glError();\r
//if(!sArea) glReadBuffer(GL_BACK);\r
\r
s=0;\r
\r
if(!pGfxCardScreen)\r
{\r
- glPixelStorei(GL_PACK_ALIGNMENT,1);\r
+ glPixelStorei(GL_PACK_ALIGNMENT,1); glError();\r
pGfxCardScreen=(unsigned char *)malloc(iResX*iResY*4);\r
}\r
\r
\r
// if(bFront) glReadBuffer(GL_FRONT);\r
\r
- glReadPixels(x,y,dx,dy,GL_RGB,GL_UNSIGNED_BYTE,ps);\r
- \r
+ glReadPixels(x,y,dx,dy,GL_RGB,GL_UNSIGNED_BYTE,ps); glError(); glError();\r
// if(bFront) glReadBuffer(GL_BACK);\r
\r
XS=(float)dx/(float)(udx);\r
\r
if(!pGfxCardScreen)\r
{\r
- glPixelStorei(GL_PACK_ALIGNMENT,1);\r
+ glPixelStorei(GL_PACK_ALIGNMENT,1); glError();\r
pGfxCardScreen=(unsigned char *)malloc(iResX*iResY*4);\r
}\r
\r
\r
// glReadBuffer(GL_FRONT);\r
\r
- glReadPixels(0,0,iResX,iResY,GL_RGB,GL_UNSIGNED_BYTE,ps);\r
+ glReadPixels(0,0,iResX,iResY,GL_RGB,GL_UNSIGNED_BYTE,ps); glError();\r
\r
// glReadBuffer(GL_BACK);\r
\r
if(!DrawSemiTrans) // no semi trans at all?\r
{\r
if(bBlendEnable)\r
- {glDisable(GL_BLEND);bBlendEnable=FALSE;} // -> don't wanna blend\r
+ {glDisable(GL_BLEND);glError();bBlendEnable=FALSE;}// -> don't wanna blend\r
ubGloAlpha=ubGloColAlpha=255; // -> full alpha\r
return; // -> and bye\r
}\r
ubGloAlpha=ubGloColAlpha=TransSets[GlobalTextABR].alpha;\r
\r
if(!bBlendEnable)\r
- {glEnable(GL_BLEND);bBlendEnable=TRUE;} // wanna blend\r
+ {glEnable(GL_BLEND);glError();bBlendEnable=TRUE;} // wanna blend\r
\r
if(TransSets[GlobalTextABR].srcFac!=obm1 || \r
TransSets[GlobalTextABR].dstFac!=obm2)\r
{\r
obm1=TransSets[GlobalTextABR].srcFac;\r
obm2=TransSets[GlobalTextABR].dstFac;\r
- glBlendFunc(obm1,obm2); // set blend func\r
+ glBlendFunc(obm1,obm2); glError(); // set blend func\r
}\r
/*else\r
if(TransSets[GlobalTextABR].dstFac !=GL_ONE_MINUS_SRC_COLOR)\r
*/\r
obm1=TransSets[0].srcFac;\r
obm2=TransSets[0].dstFac;\r
- glBlendFunc(obm1,obm2); // set blend func\r
+ glBlendFunc(obm1,obm2); glError(); // set blend func\r
}\r
\r
void SetScanTexTrans(void) // blending for scan mask texture\r
*/\r
obm1=TransSets[2].srcFac;\r
obm2=TransSets[2].dstFac;\r
- glBlendFunc(obm1,obm2); // set blend func\r
+ glBlendFunc(obm1,obm2); glError(); // set blend func\r
}\r
\r
//////////////////////////////////////////////////////////////////////// \r
}\r
\r
if(!bBlendEnable)\r
- {glEnable(GL_BLEND);bBlendEnable=TRUE;} // wanna blend\r
+ {glEnable(GL_BLEND);glError();bBlendEnable=TRUE;} // wanna blend\r
\r
if(bm1!=obm1 || bm2!=obm2)\r
{\r
- glBlendFunc(bm1,bm2); // set blend func\r
+ glBlendFunc(bm1,bm2); glError(); // set blend func\r
obm1=bm1;obm2=bm2;\r
}\r
}\r
else currTex=SelectSubTextureS(GlobalTextTP,ulClutID);\r
\r
if(gTexName!=currTex)\r
- {gTexName=currTex;glBindTexture(GL_TEXTURE_2D,currTex);}\r
+ {gTexName=currTex;glBindTexture(GL_TEXTURE_2D,currTex); glError();}\r
\r
if(!bTexEnabled) // -> turn texturing on\r
- {bTexEnabled=TRUE;glEnable(GL_TEXTURE_2D);}\r
+ {bTexEnabled=TRUE;glEnable(GL_TEXTURE_2D); glError();}\r
}\r
else // no texture ?\r
if(bTexEnabled) \r
- {bTexEnabled=FALSE;glDisable(GL_TEXTURE_2D);} // -> turn texturing off\r
+ {bTexEnabled=FALSE;glDisable(GL_TEXTURE_2D); glError();} // -> turn texturing off\r
\r
if(bSCol) // also set color ?\r
{\r
{\r
if(bDrawSmoothShaded) glShadeModel(GL_SMOOTH); // -> set actual shading\r
else glShadeModel(GL_FLAT);\r
+ glError();\r
bOldSmoothShaded=bDrawSmoothShaded;\r
}\r
}\r
if(!PSXDisplay.DisplayMode.x) return;\r
if(!PSXDisplay.DisplayMode.y) return;\r
\r
- glDisable(GL_SCISSOR_TEST);\r
- glShadeModel(GL_FLAT);\r
+ glDisable(GL_SCISSOR_TEST); glError();\r
+ glShadeModel(GL_FLAT); glError();\r
bOldSmoothShaded=FALSE;\r
- glDisable(GL_BLEND);\r
+ glDisable(GL_BLEND); glError();\r
bBlendEnable=FALSE;\r
- glDisable(GL_TEXTURE_2D);\r
+ glDisable(GL_TEXTURE_2D); glError();\r
bTexEnabled=FALSE;\r
- glDisable(GL_ALPHA_TEST);\r
+ glDisable(GL_ALPHA_TEST); glError();\r
\r
//glPixelZoom(((float)rRatioRect.right)/((float)PSXDisplay.DisplayMode.x),\r
// -1.0f*(((float)rRatioRect.bottom)/((float)PSXDisplay.DisplayMode.y)));\r
\r
// glPixelZoom(1.0F,1.0F);\r
\r
- glEnable(GL_ALPHA_TEST);\r
- glEnable(GL_SCISSOR_TEST);\r
+ glEnable(GL_ALPHA_TEST); glError();\r
+ glEnable(GL_SCISSOR_TEST); glError();\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
bCheckMask=TRUE;\r
if(iDepthFunc==0) return;\r
iDepthFunc=0;\r
- glDepthFunc(GL_LESS);\r
+ glDepthFunc(GL_LESS); glError();\r
}\r
else\r
{\r
bCheckMask=FALSE;\r
if(iDepthFunc==1) return;\r
- glDepthFunc(GL_ALWAYS);\r
+ glDepthFunc(GL_ALWAYS); glError();\r
iDepthFunc=1;\r
}\r
}\r
b=((GLclampf)BLUE(gpuData[0]))/255.0f;\r
r=((GLclampf)RED(gpuData[0]))/255.0f;\r
\r
- glDisable(GL_SCISSOR_TEST); \r
- glClearColor(r,g,b,1.0f);\r
- glClear(uiBufferBits); \r
+ glDisable(GL_SCISSOR_TEST); glError();\r
+ glClearColor(r,g,b,1.0f); glError();\r
+ glClear(uiBufferBits); glError();\r
gl_z=0.0f;\r
\r
if(gpuData[0]!=0x02000000 &&\r
}\r
}\r
\r
- glEnable(GL_SCISSOR_TEST); \r
+ glEnable(GL_SCISSOR_TEST); glError();\r
}\r
else\r
{\r
SetRenderMode((unsigned long)0x01000000, FALSE);\r
vertex[0].c.lcol=gpuData[0]|0xff000000;\r
SETCOL(vertex[0]); \r
- glDisable(GL_SCISSOR_TEST); \r
+ glDisable(GL_SCISSOR_TEST); glError();\r
PRIMdrawQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]);\r
- glEnable(GL_SCISSOR_TEST); \r
+ glEnable(GL_SCISSOR_TEST); glError();\r
}\r
}\r
\r
#endif\r
#endif\r
\r
+#if 0\r
+#define glError() { \\r
+ GLenum err = glGetError(); \\r
+ while (err != GL_NO_ERROR) { \\r
+ printf("glError: %d caught at %s:%u\n", err, __FILE__, __LINE__); \\r
+ err = glGetError(); \\r
+ } \\r
+}\r
+#else\r
+#define glError() \r
+#endif\r
+\r
#ifdef __cplusplus\r
}\r
#endif\r
int i,j;textureWndCacheEntry * tsx;\r
//----------------------------------------------------//\r
glBindTexture(GL_TEXTURE_2D,0);\r
+ glError();\r
//----------------------------------------------------//\r
free(texturepart); // free tex part\r
texturepart=0;\r
{\r
if(tsx->texname) // -> some tex?\r
glDeleteTextures(1,&tsx->texname); // --> delete it\r
+ glError();\r
}\r
iMaxTexWnds=0; // no more tex wnds\r
//----------------------------------------------------//\r
if(gTexMovieName!=0) // some movie tex?\r
glDeleteTextures(1, &gTexMovieName); // -> delete it\r
+ glError();\r
gTexMovieName=0; // no more movie tex\r
//----------------------------------------------------//\r
if(gTexFrameName!=0) // some 15bit framebuffer tex?\r
glDeleteTextures(1, &gTexFrameName); // -> delete it\r
+ glError();\r
gTexFrameName=0; // no more movie tex\r
//----------------------------------------------------//\r
if(gTexBlurName!=0) // some 15bit framebuffer tex?\r
glDeleteTextures(1, &gTexBlurName); // -> delete it\r
+ glError();\r
gTexBlurName=0; // no more movie tex\r
//----------------------------------------------------//\r
for(i=0;i<3;i++) // -> loop\r
if(uiStexturePage[i]) // --> tex used ?\r
{\r
glDeleteTextures(1,&uiStexturePage[i]);\r
+ glError();\r
uiStexturePage[i]=0; // --> delete it\r
}\r
free(pxSsubtexLeft[i]); // -> clean mem\r
dwTexPageComp=0;\r
\r
//----------------------------------------------------//\r
- if(bDelTex) {glBindTexture(GL_TEXTURE_2D,0);gTexName=0;}\r
+ if(bDelTex) {glBindTexture(GL_TEXTURE_2D,0); glError();gTexName=0;}\r
//----------------------------------------------------//\r
tsx=wcWndtexStore;\r
for(i=0;i<MAXWNDTEXCACHE;i++,tsx++)\r
tsx->used=0;\r
if(bDelTex && tsx->texname)\r
{\r
- glDeleteTextures(1,&tsx->texname);\r
+ glDeleteTextures(1,&tsx->texname); glError();\r
tsx->texname=0;\r
}\r
}\r
lu=pxSsubtexLeft[i];\r
lu->l=0;\r
if(bDelTex && uiStexturePage[i])\r
- {glDeleteTextures(1,&uiStexturePage[i]);uiStexturePage[i]=0;}\r
+ {glDeleteTextures(1,&uiStexturePage[i]); glError();uiStexturePage[i]=0;}\r
}\r
}\r
\r
{\r
if(gTexName==0)\r
glGenTextures(1, &gTexName);\r
-\r
+ glError();\r
glBindTexture(GL_TEXTURE_2D, gTexName);\r
-\r
+ glError();\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\r
- \r
+ glError(); \r
{\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter);\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter);\r
+ glError();\r
}\r
\r
glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA, \r
TWin.Position.x1, \r
TWin.Position.y1, \r
0, GL_RGBA, GL_UNSIGNED_BYTE, texturepart);\r
+ glError();\r
+ //LOGE("DefineTextureWnd x:%d y:%d",TWin.Position.x1,TWin.Position.y1);\r
+\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
{\r
if(gTexName==0)\r
glGenTextures(1, &gTexName);\r
-\r
+ glError();\r
glBindTexture(GL_TEXTURE_2D, gTexName);\r
-\r
+ glError();\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\r
- \r
+ glError();\r
{\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter);\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter);\r
}\r
-\r
+ glError();\r
glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA, \r
TWin.Position.x1, \r
TWin.Position.y1, \r
0, GL_RGBA, GL_UNSIGNED_BYTE,texturepart);\r
+ glError();\r
+ //LOGE("DefinePalTextureWnd x:%d y:%d",TWin.Position.x1,TWin.Position.y1);\r
}\r
\r
///////////////////////////////////////////////////////\r
{\r
if(gTexMovieName==0)\r
{\r
- glGenTextures(1, &gTexMovieName);\r
+ glEnable(GL_TEXTURE_2D);\r
+ glGenTextures(1, &gTexMovieName); glError();\r
gTexName=gTexMovieName;\r
- glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType); glError();\r
\r
if(!bUseFastMdec) \r
{\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glError();\r
}\r
else\r
{\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter); glError();\r
}\r
\r
glTexImage2D(GL_TEXTURE_2D, 0, //giWantedRGBA, \r
GL_RGBA,\r
- 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, texturepart);\r
+ 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, texturepart); glError();\r
}\r
else \r
{\r
- gTexName=gTexMovieName;glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ gTexName=gTexMovieName;glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
}\r
\r
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,\r
(xrMovieArea.y1-xrMovieArea.y0), \r
GL_RGBA,\r
GL_UNSIGNED_SHORT,\r
- texturepart);\r
+ texturepart); glError();\r
+ //LOGE("DefinePackedTextureMovie x:%d y:%d",(xrMovieArea.x1-xrMovieArea.x0),(xrMovieArea.y1-xrMovieArea.y0));\r
+\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
{\r
if(gTexMovieName==0)\r
{\r
- glGenTextures(1, &gTexMovieName);\r
+ glGenTextures(1, &gTexMovieName); glError();\r
gTexName=gTexMovieName;\r
- glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType); glError();\r
\r
if(!bUseFastMdec) \r
{\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glError();\r
}\r
else\r
{\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter); glError();\r
}\r
\r
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, texturepart);\r
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, texturepart); glError();\r
}\r
else \r
{\r
- gTexName=gTexMovieName;glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ gTexName=gTexMovieName;glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
}\r
\r
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,\r
(xrMovieArea.x1-xrMovieArea.x0), \r
(xrMovieArea.y1-xrMovieArea.y0), \r
- GL_RGBA, GL_UNSIGNED_BYTE, texturepart);\r
+ GL_RGBA, GL_UNSIGNED_BYTE, texturepart); glError();\r
+ //LOGE("DefineTextureMovie x:%d y:%d",(xrMovieArea.x1-xrMovieArea.x0),(xrMovieArea.y1-xrMovieArea.y0));\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r
{\r
if(!gTexFrameName)\r
{\r
- glGenTextures(1, &gTexFrameName);\r
+ glGenTextures(1, &gTexFrameName); glError();\r
gTexName=gTexFrameName;\r
- glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter); glError();\r
\r
{\r
unsigned long * ta=(unsigned long *)texturepart;\r
for(x1=0;x1<=4;x1++)\r
*ta++=0xff000000;\r
}\r
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, texturepart);\r
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, texturepart); glError();\r
+\r
}\r
else\r
{\r
gTexName=gTexFrameName;\r
- glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
}\r
-\r
+ //LOGE("BlackFake15BitTexture x:%d y:%d",4,4);\r
ubOpaqueDraw=0;\r
\r
return (GLuint)gTexName;\r
if(iResX>640 || iResY>480) iFTex=1024;\r
else iFTex=512; \r
\r
- glGenTextures(1, &gTexFrameName);\r
+ glGenTextures(1, &gTexFrameName); glError();\r
gTexName=gTexFrameName;\r
- glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter); glError();\r
\r
p=(char *)malloc(iFTex*iFTex*4);\r
memset(p,0,iFTex*iFTex*4);\r
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, iFTex, iFTex, 0, GL_RGBA, GL_UNSIGNED_BYTE, p);\r
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, iFTex, iFTex, 0, GL_RGBA, GL_UNSIGNED_BYTE, p); glError();\r
free(p);\r
\r
glGetError();\r
else \r
{\r
gTexName=gTexFrameName;\r
- glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
}\r
-\r
+ //LOGE("Fake15BitTexture x:%d y:%d",iFTex,iFTex);\r
x1+=PreviousPSXDisplay.Range.x0;\r
y1+=PreviousPSXDisplay.Range.y0;\r
\r
iYAdjust,\r
rSrc.left+rRatioRect.left,\r
iResY-rSrc.bottom-rRatioRect.top,\r
- x1,y1);\r
+ x1,y1); glError();\r
\r
if(glGetError()) \r
{\r
char * p=(char *)malloc(iFTex*iFTex*4);\r
memset(p,0,iFTex*iFTex*4);\r
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, iFTex, iFTex,\r
- GL_RGBA, GL_UNSIGNED_BYTE, p);\r
+ GL_RGBA, GL_UNSIGNED_BYTE, p); glError();\r
free(p);\r
}\r
\r
\r
if(!gTexName) \r
{\r
- glGenTextures(1, &gTexName);\r
- glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ glGenTextures(1, &gTexName); glError();\r
+ glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType); glError();\r
\r
if(iFilterType)\r
{\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glError();\r
}\r
else\r
{ \r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter); glError();\r
} \r
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, texturebuffer);\r
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, texturebuffer); glError();\r
}\r
- else glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ else glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
\r
glTexSubImage2D(GL_TEXTURE_2D, 0, XTexS<<1, YTexS<<1,\r
DXTexS<<1, DYTexS<<1,\r
- GL_RGBA, GL_UNSIGNED_BYTE, texturebuffer);\r
+ GL_RGBA, GL_UNSIGNED_BYTE, texturebuffer); glError();\r
+ //LOGE("DefineSubTextureSortHiRes x:%d y:%d",XTexS<<1,YTexS<<1);\r
}\r
\r
/////////////////////////////////////////////////////////////////////////////\r
\r
if(!gTexName)\r
{\r
- glGenTextures(1, &gTexName);\r
- glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ glGenTextures(1, &gTexName); glError();\r
+ glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType); glError();\r
\r
if(iFilterType)\r
{\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glError();\r
}\r
else\r
{\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter);\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, iFilter); glError();\r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, iFilter); glError();\r
}\r
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0,GL_RGBA, GL_UNSIGNED_BYTE, texturepart);\r
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0,GL_RGBA, GL_UNSIGNED_BYTE, texturepart); glError();\r
}\r
- else glBindTexture(GL_TEXTURE_2D, gTexName);\r
+ else glBindTexture(GL_TEXTURE_2D, gTexName); glError();\r
\r
glTexSubImage2D(GL_TEXTURE_2D, 0, XTexS, YTexS,\r
DXTexS, DYTexS,\r
- GL_RGBA, GL_UNSIGNED_BYTE, texturepart);\r
+ GL_RGBA, GL_UNSIGNED_BYTE, texturepart); glError();\r
+ //LOGE("DefineSubTextureSort x:%d y:%d w:%d h:%d",XTexS,YTexS,DXTexS,DYTexS);\r
}\r
\r
/////////////////////////////////////////////////////////////////////////////\r