X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=source%2Fgles2n64%2Fsrc%2FOpenGL.cpp;h=3e778217d61c5d6dd7d54830a9eed08fdb1f4458;hb=ad0f154dfe4248c7dd6b603b10f3a9a422ab1114;hp=dd0ca4d671b764c523e0e8ec181fc9bfb512c3f3;hpb=0ced54f867d36e8b324155bef49e8abfebfc3237;p=mupen64plus-pandora.git diff --git a/source/gles2n64/src/OpenGL.cpp b/source/gles2n64/src/OpenGL.cpp index dd0ca4d..3e77821 100755 --- a/source/gles2n64/src/OpenGL.cpp +++ b/source/gles2n64/src/OpenGL.cpp @@ -81,6 +81,7 @@ const char _default_fsh[] = " \n\t" \ "gl_FragColor = texture2D(uTex, vTexCoord); \n\t" \ "} \n\t"; + void OGL_EnableRunfast() { #ifdef ARM_ASM @@ -224,10 +225,12 @@ void OGL_ResizeWindow(int x, int y, int width, int height) config.window.width = width; config.window.height = height; - config.framebuffer.xpos = x; - config.framebuffer.ypos = y; - config.framebuffer.width = width; - config.framebuffer.height = height; + if (config.framebuffer.enable!=1) { + config.framebuffer.xpos = x; + config.framebuffer.ypos = y; + config.framebuffer.width = width; + config.framebuffer.height = height; + } OGL_UpdateScale(); glViewport(config.framebuffer.xpos, config.framebuffer.ypos, @@ -305,20 +308,23 @@ else*/ //set xpos and ypos config.window.xpos = x; config.window.ypos = y; - config.framebuffer.xpos = x; - config.framebuffer.ypos = y; //set width and height config.window.width = (int)videoWidth; config.window.height = (int)videoHeight; - config.framebuffer.width = (int)videoWidth; - config.framebuffer.height = (int)videoHeight; + if (config.framebuffer.enable!=1) { + config.framebuffer.xpos = x; + config.framebuffer.ypos = y; + config.framebuffer.width = (int)videoWidth; + config.framebuffer.height = (int)videoHeight; + } EGL_Open(800, 480); //// return true; } #endif + ////// #ifdef USE_SDL @@ -328,7 +334,6 @@ void Android_JNI_SwapWindow() } #endif - bool OGL_Start() { // paulscode, initialize SDL @@ -368,13 +373,18 @@ bool OGL_Start() } glGenFramebuffers(1, &OGL.framebuffer.fb); - glGenRenderbuffers(1, &OGL.framebuffer.depth_buffer); glGenTextures(1, &OGL.framebuffer.color_buffer); - glBindRenderbuffer(GL_RENDERBUFFER, OGL.framebuffer.depth_buffer); - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24_OES, config.framebuffer.width, config.framebuffer.height); glBindTexture(GL_TEXTURE_2D, OGL.framebuffer.color_buffer); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, config.framebuffer.width, config.framebuffer.height, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, NULL); - glBindFramebuffer(GL_FRAMEBUFFER, OGL.framebuffer.fb); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glBindTexture(GL_TEXTURE_2D, 0); + glGenRenderbuffers(1, &OGL.framebuffer.depth_buffer); + glBindRenderbuffer(GL_RENDERBUFFER, OGL.framebuffer.depth_buffer); + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24_OES, config.framebuffer.width, config.framebuffer.height); + glBindFramebuffer(GL_FRAMEBUFFER, OGL.framebuffer.fb); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, OGL.framebuffer.color_buffer, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, OGL.framebuffer.depth_buffer); @@ -1159,8 +1169,8 @@ void OGL_ClearDepthBuffer() /////// paulscode, graphics bug-fixes glDisable( GL_SCISSOR_TEST ); glDepthMask( GL_TRUE ); // fixes side-bar graphics glitches -// glClearDepthf( depth ); // broken on Qualcomm Adreno - glClearDepthf( 1.0f ); // fixes missing graphics on Qualcomm Adreno + glClearDepthf( depth ); // broken on Qualcomm Adreno // Should be ok on Pandora +// glClearDepthf( 1.0f ); // fixes missing graphics on Qualcomm Adreno glClearColor( 0, 0, 0, 1 ); glClear( GL_DEPTH_BUFFER_BIT ); OGL_UpdateDepthUpdate(); @@ -1214,7 +1224,7 @@ void OGL_SwapBuffers() { //OGL_DrawTriangles(); scProgramChanged = 0; -#if 0 +#if 1 static int frames = 0; static unsigned lastTicks = 0; unsigned ticks = ticksGetTicks(); @@ -1271,17 +1281,22 @@ void OGL_SwapBuffers() } #endif + // if emulator defined a render callback function, call it before + // buffer swap + if (renderCallback) (*renderCallback)(); + if (config.framebuffer.enable) { glBindFramebuffer(GL_FRAMEBUFFER, 0); - glClearColor( 0, 0, 0, 1 ); - glClear( GL_COLOR_BUFFER_BIT ); - glUseProgram(OGL.defaultProgram); glDisable(GL_SCISSOR_TEST); glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); //*SEB* glViewport(config.window.xpos, config.window.ypos, config.window.width, config.window.height); + glClearColor( 0, 0, 0, 1 ); + glClear( GL_COLOR_BUFFER_BIT ); + static const float vert[] = { -1.0, -1.0, +0.0, +0.0, @@ -1313,6 +1328,7 @@ void OGL_SwapBuffers() glBindFramebuffer(GL_FRAMEBUFFER, OGL.framebuffer.fb); OGL_UpdateViewport(); + OGL_UpdateCullFace(); if (scProgramCurrent) glUseProgram(scProgramCurrent->program); OGL.renderState = RS_NONE; } @@ -1321,10 +1337,6 @@ void OGL_SwapBuffers() Android_JNI_SwapWindow(); // paulscode, fix for black-screen bug } - // if emulator defined a render callback function, call it before - // buffer swap - if (renderCallback) (*renderCallback)(); - OGL.screenUpdate = false; if (config.forceBufferClear) @@ -1333,8 +1345,8 @@ void OGL_SwapBuffers() float depth = gDP.fillColor.z ; glDisable( GL_SCISSOR_TEST ); glDepthMask( GL_TRUE ); // fixes side-bar graphics glitches -// glClearDepthf( depth ); // broken on Qualcomm Adreno - glClearDepthf( 1.0f ); // fixes missing graphics on Qualcomm Adreno + glClearDepthf( depth ); // broken on Qualcomm Adreno Should by ok on Pandora +// glClearDepthf( 1.0f ); // fixes missing graphics on Qualcomm Adreno glClearColor( 0, 0, 0, 1 ); glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT ); OGL_UpdateDepthUpdate();