bool OGL_Start(void) { float f; OGL_InitStates(); #ifdef USE_SDL /////// paulscode, graphics bug-fixes float depth = gDP.fillColor.z ; glDisable( GL_SCISSOR_TEST ); glDepthMask( GL_TRUE ); // fixes side-bar graphics glitches glClearDepth( 1.0f ); // fixes missing graphics on Qualcomm Adreno glClearColor( 0, 0, 0, 1 ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glFinish(); Android_JNI_SwapWindow(); // paulscode, fix for black-screen bug glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glFinish(); OGL_UpdateDepthUpdate(); glEnable( GL_SCISSOR_TEST ); //////// #endif //check extensions if ((config.texture.maxAnisotropy>0) && !OGL_IsExtSupported("GL_EXT_texture_filter_anistropic")) { LOG(LOG_WARNING, "Anistropic Filtering is not supported.\n"); config.texture.maxAnisotropy = 0; } f = 0; glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &f); if (config.texture.maxAnisotropy > ((int)f)) { LOG(LOG_WARNING, "Clamping max anistropy to %ix.\n", (int)f); config.texture.maxAnisotropy = (int)f; } //Print some info LOG(LOG_VERBOSE, "[gles2n64]: Enable Runfast... \n"); OGL_EnableRunfast(); //We must have a shader bound before binding any textures: ShaderCombiner_Init(); ShaderCombiner_Set(EncodeCombineMode(0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0), -1); ShaderCombiner_Set(EncodeCombineMode(0, 0, 0, SHADE, 0, 0, 0, 1, 0, 0, 0, SHADE, 0, 0, 0, 1), -1); TextureCache_Init(); memset(OGL.triangles.vertices, 0, VERTBUFF_SIZE * sizeof(SPVertex)); memset(OGL.triangles.elements, 0, ELEMBUFF_SIZE * sizeof(GLubyte)); OGL.triangles.num = 0; #ifdef __TRIBUFFER_OPT __indexmap_init(); #endif OGL.renderingToTexture = false; OGL.renderState = RS_NONE; gSP.changed = gDP.changed = 0xFFFFFFFF; VI.displayNum = 0; glGetError(); return TRUE; }
void Android_GL_SwapWindow(_THIS, SDL_Window * window) { Android_JNI_SwapWindow(); }
void COGLGraphicsContext::UpdateFrame(bool swaponly) { status.gFrameCount++; //glFlush(); //OPENGL_CHECK_ERRORS; //glFinish(); //wglSwapIntervalEXT(0); /* if (debuggerPauseCount == countToPause) { static int iShotNum = 0; // get width, height, allocate buffer to store image int width = windowSetting.uDisplayWidth; int height = windowSetting.uDisplayHeight; printf("Saving debug images: width=%i height=%i\n", width, height); short *buffer = (short *) malloc(((width+3)&~3)*(height+1)*4); glReadBuffer( GL_FRONT ); // set up a BMGImage struct struct BMGImageStruct img; memset(&img, 0, sizeof(BMGImageStruct)); InitBMGImage(&img); img.bits = (unsigned char *) buffer; img.bits_per_pixel = 32; img.height = height; img.width = width; img.scan_width = width * 4; // store the RGB color image char chFilename[64]; sprintf(chFilename, "dbg_rgb_%03i.png", iShotNum); glReadPixels(0,0,width,height, GL_BGRA, GL_UNSIGNED_BYTE, buffer); WritePNG(chFilename, img); // store the Z buffer sprintf(chFilename, "dbg_Z_%03i.png", iShotNum); glReadPixels(0,0,width,height, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, buffer); //img.bits_per_pixel = 16; //img.scan_width = width * 2; WritePNG(chFilename, img); // dump a subset of the Z data for (int y = 0; y < 480; y += 16) { for (int x = 0; x < 640; x+= 16) printf("%4hx ", buffer[y*640 + x]); printf("\n"); } printf("\n"); // free memory and get out of here free(buffer); iShotNum++; } */ // if emulator defined a render callback function, call it before buffer swap if(renderCallback) (*renderCallback)(); //CoreVideo_GL_SwapBuffers(); //eglSwapBuffers(EGL_display, EGL_surface); Android_JNI_SwapWindow(); // paulscode /*if(options.bShowFPS) { static unsigned int lastTick=0; static int frames=0; unsigned int nowTick = SDL_GetTicks(); frames++; if(lastTick + 5000 <= nowTick) { char caption[200]; sprintf(caption, "%s v%i.%i.%i - %.3f VI/S", PLUGIN_NAME, VERSION_PRINTF_SPLIT(PLUGIN_VERSION), frames/5.0); CoreVideo_SetCaption(caption); frames = 0; lastTick = nowTick; } }*/ glDepthMask(GL_TRUE); OPENGL_CHECK_ERRORS; glClearDepthf(1.0f); OPENGL_CHECK_ERRORS; if( !g_curRomInfo.bForceScreenClear ) { glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); OPENGL_CHECK_ERRORS; } else needCleanScene = true; status.bScreenIsDrawn = false; }