/********************************************* Does all the 2D rendering (fonts, HUD, etc) **********************************************/ void App::render2D(){ glShadeModel(GL_FLAT); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); drawStatusBar(); if(isConnected()){ mFlowMgr->render2d(); } ps()->render2D(); //Render the GUI #ifdef ENABLE_GUI renderGUI(); #endif #ifdef ENABLE_CGL_COMPAT //Get rid of the system mouse cursor, it's useless SDL_ShowCursor(SDL_DISABLE); //render a mouse cursor on our end int x = iMouseX; int y = iMouseY; int s = iScreenX / 32; Texture *tex = texGet("mouse.png"); LOG("Creating mouse cursor\n"); if(!tex){ LOG("No mouse cursor texture!\n"); }else{ tex->bind(); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glColor4f(1,1,1,0.0f); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(x, y); glTexCoord2f(1, 0); glVertex2f(x + s, y); glTexCoord2f(1, 1); glVertex2f(x + s, y + s); glTexCoord2f(0, 1); glVertex2f(x, y + s); glEnd(); glDisable(GL_BLEND); } #endif }
void DisplayGUI::drawMenu() { display->clear(); if(root == NULL){ display->gotoXY(0, 0); display->print("Error! ROOT UNDEFINED"); } else{ drawStatusBar(); drawSlider(currentMenu->getOverallItemNumber(), currentSelection); drawEntrys(); drawCursor(); } display->renderAll(); }
void renderFrame(u8 bgColor[3], u8 waterBorderColor[3], u8 waterColor[3]) { // background stuff drawBackground(bgColor, waterBorderColor, waterColor); // status bar drawStatusBar(wifiStatus, charging, batteryLevel); // debug text // drawDebug(); //menu stuff if(rebootCounter<257) { //about to reboot drawError(GFX_BOTTOM, "Reboot", " You're about to reboot your console into home menu.\n\n" " A : Proceed\n" " B : Cancel\n"); }else if(!sdmcCurrent) { //no SD drawError(GFX_BOTTOM, "No SD detected", " It looks like your 3DS doesn't have an SD inserted into it.\n" " Please insert an SD card for optimal homebrew launcher performance !\n"); }else if(sdmcCurrent<0) { //SD error drawError(GFX_BOTTOM, "SD Error", " Something unexpected happened when trying to mount your SD card.\n" " Try taking it out and putting it back in. If that doesn't work,\n" "please try again with another SD card."); }else if(netloader_active){ char bof[256]; u32 ip = gethostid(); sprintf(bof, " NetLoader Active\n" " IP: %lu.%lu.%lu.%lu, Port: %d\n" " B : Cancel\n", ip & 0xFF, (ip>>8)&0xFF, (ip>>16)&0xFF, (ip>>24)&0xFF, NETLOADER_PORT); drawError(GFX_BOTTOM, "NetLoader", bof); }else{
void fwDraw ( ESContext *esContext ) //void fwUpdate ( ESContext *esContext, float delta ) { fwl_RenderSceneUpdateScene(); updateButtonStatus(); //poll Model & update UI(View) updateConsoleStatus(); //poll Model & update UI(View) checkFileLoadRequest(); /* status bar, if we have one */ finishedWithGlobalShader(); drawStatusBar(); // UI/View restoreGlobalShader(); //drawStatusBarFE(); eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface ); }
bool snapshot () { nosnapshot (); if (! freeze ()) return false; setPixelCoords (true); glGenTextures (1, &snapshotTextureName); int w = winWidth; int h = winHeight; if (! NPOT_textures) { w = getNextPOT(winWidth); h = getNextPOT(winHeight); snapTexW = ((double)winWidth) / w; snapTexH = ((double)winHeight) / h; } glBindTexture(GL_TEXTURE_2D, snapshotTextureName); 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); texImage2D (GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, snapshotTextureName); // Render scene glDepthMask (GL_TRUE); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen glDepthMask (GL_FALSE); drawBackDrop (); // Draw the room drawZBuffer(cameraX, cameraY, false); glEnable(GL_DEPTH_TEST); drawPeople (); // Then add any moving characters... glDisable(GL_DEPTH_TEST); viewSpeech (); // ...and anything being said drawStatusBar (); // Copy Our ViewPort To The Texture copyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, viewportOffsetX, viewportOffsetY, winWidth, winHeight, snapshotTextureName); setPixelCoords (false); unfreeze (false); return true; }
void drawNetloaderBackground() { rgbColour * bgc = backgroundColour(); gfxFillColor(GFX_BOTTOM, GFX_LEFT, (u8[]){bgc->r, bgc->g, bgc->b}); gfxFillColor(GFX_TOP, GFX_LEFT, (u8[]){bgc->r, bgc->g, bgc->b}); //Wallpaper if (themeImageExists(themeImageTopWallpaperInfo)) { drawThemeImage(themeImageTopWallpaperInfo, GFX_TOP, 0, 0); } else if (themeImageExists(themeImageTopWallpaper)) { drawThemeImage(themeImageTopWallpaper, GFX_TOP, 0, 0); } if (themeImageExists(themeImageBottomWallpaperNonGrid)) { drawThemeImage(themeImageBottomWallpaperNonGrid, GFX_BOTTOM, 0, 0); } else if (themeImageExists(themeImageBottomWallpaper)) { drawThemeImage(themeImageBottomWallpaper, GFX_BOTTOM, 0, 0); } drawStatusBar(wifiStatus, charging, batteryLevel); }
void renderFrame(u8 bgColor[3], u8 waterBorderColor[3], u8 waterColor[3]) { // background stuff drawBackground(bgColor, waterBorderColor, waterColor); // status bar drawStatusBar(wifiStatus, charging, batteryLevel); // current directory printDirectory(); // debug text // drawDebug(); //menu stuff if(rebootCounter<257) { //about to reboot if(!menuret_enabled) { drawError(GFX_BOTTOM, "Reboot", " You're about to reboot your console into Home Menu.\n\n" " A : Proceed\n" " B : Cancel\n", 0); } else { drawError(GFX_BOTTOM, "Reboot", " You're about to reboot your console into Home Menu.\n\n" " A : Proceed\n" " B : Cancel\n" " X : Return to Home Menu (no reboot)\n", 0); } }else if(!sdmcCurrent) { //no SD drawError(GFX_BOTTOM, "No SD detected", " It looks like your 3DS doesn't have an SD inserted into it.\n" " Please insert an SD card for optimal homebrew launcher performance !\n", 0); }else if(sdmcCurrent<0) { //SD error drawError(GFX_BOTTOM, "SD Error", " Something unexpected happened when trying to mount your SD card.\n" " Try taking it out and putting it back in. If that doesn't work,\n" "please try again with another SD card.", 0); }else if(hbmenu_state == HBMENU_NETLOADER_ACTIVE){ char bof[256]; u32 ip = gethostid(); sprintf(bof, " NetLoader Active - waiting for 3dslink connection\n" " IP: %lu.%lu.%lu.%lu, Port: %d\n\n" " B : Cancel\n", ip & 0xFF, (ip>>8)&0xFF, (ip>>16)&0xFF, (ip>>24)&0xFF, NETLOADER_PORT); drawError(GFX_BOTTOM, "NetLoader", bof, 0); }else if(hbmenu_state == HBMENU_NETLOADER_UNAVAILABLE_NINJHAX2){
void Game::drawStatusGUI() { auto director = CCDirector::sharedDirector(); auto visibleSize = director->getVisibleSize(); drawStatusBar(visibleSize); drawInventory(visibleSize); }
void sludgeDisplay () { #if defined(HAVE_GLES2) #ifndef GL_DEPTH24_STENCIL8 #define GL_DEPTH24_STENCIL8 0x88F0 #endif // create an FBO static GLuint fbo = 0; static GLuint fbo_tex = 0; static GLuint fbo_rbo = 0; static float fbo_tex_w, fbo_tex_h; static GLuint fbo_shad, fbo_vert, fbo_frag; if(fbo==0) { // create FBO int width = 1; while (width<realWinWidth) width *= 2; int height = 1; while (height<realWinHeight) height *= 2; glGenFramebuffers(1, &fbo); glGenTextures(1, &fbo_tex); glGenRenderbuffers(1, &fbo_rbo); glBindTexture(GL_TEXTURE_2D, fbo_tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); glBindTexture(GL_TEXTURE_2D, 0); glBindRenderbuffer(GL_RENDERBUFFER, fbo_rbo); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height); glBindRenderbuffer(GL_RENDERBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, fbo); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fbo_tex, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fbo_rbo); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo_rbo); GLenum ret = glCheckFramebufferStatus(GL_FRAMEBUFFER); printf("Screen is %dx%d, FBO(%dx%d) Status = 0x%04X\n", realWinWidth, realWinHeight, width, height, ret); glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, fbo); fbo_tex_w = (float)realWinWidth / width; fbo_tex_h = (float)realWinHeight / height; // create shader for blitting the fbo... const char _blit_vsh[] = " \n\t" \ "attribute highp vec2 aPosition; \n\t" \ "attribute highp vec2 aTexCoord; \n\t" \ "varying mediump vec2 vTexCoord; \n\t" \ "void main(){ \n\t" \ "gl_Position = vec4(aPosition.x, aPosition.y, 0.0, 1.0);\n\t" \ "vTexCoord = aTexCoord; \n\t" \ "} \n\t"; const char _blit_fsh[] = " \n\t" \ "uniform sampler2D uTex; \n\t" \ "varying mediump vec2 vTexCoord; \n\t" \ "void main(){ \n\t" \ "gl_FragColor = texture2D(uTex, vTexCoord); \n\t" \ "} \n\t"; GLint success; fbo_frag = glCreateShader( GL_FRAGMENT_SHADER ); const char* src[1]; src[0] = _blit_fsh; glShaderSource( fbo_frag, 1, src, NULL ); glCompileShader( fbo_frag ); glGetShaderiv( fbo_frag, GL_COMPILE_STATUS, &success ); if (!success) { printf("Failed to produce default fragment shader.\n"); } fbo_vert = glCreateShader( GL_VERTEX_SHADER ); src[0] = _blit_vsh; glShaderSource( fbo_vert, 1, src, NULL ); glCompileShader( fbo_vert ); glGetShaderiv( fbo_vert, GL_COMPILE_STATUS, &success ); if( !success ) { printf( "Failed to produce default vertex shader.\n" ); } fbo_shad = glCreateProgram(); glBindAttribLocation( fbo_shad, 0, "aPosition" ); glBindAttribLocation( fbo_shad, 1, "aTexCoord" ); glAttachShader( fbo_shad, fbo_frag ); glAttachShader( fbo_shad, fbo_vert ); glLinkProgram( fbo_shad ); glGetProgramiv( fbo_shad, GL_LINK_STATUS, &success ); if( !success ) { printf( "Failed to link default program.\n" ); } glUniform1i( glGetUniformLocation( fbo_shad, "uTex" ), 0 ); } #endif glDepthMask (GL_TRUE); // glClearColor(0.5, 0.5, 1.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen glDepthMask (GL_FALSE); drawBackDrop (); // Draw the room drawZBuffer(cameraX, cameraY, false); glEnable(GL_DEPTH_TEST); drawPeople (); // Then add any moving characters... glDisable(GL_DEPTH_TEST); viewSpeech (); // ...and anything being said drawStatusBar (); displayCursor (); if (brightnessLevel < 255) fixBrightness (); // This is for transitionLevel special effects glFlush(); #if !defined(HAVE_GLES2) SDL_GL_SwapBuffers(); #else if(fbo) { // blit the FBO now glBindFramebuffer(GL_FRAMEBUFFER, 0); GLuint old_prog; glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&old_prog); glUseProgram(fbo_shad); glViewport(0, 0, realWinWidth, realWinHeight); const float vert[] = { -1.0, -1.0, +0.0, +0.0, +1.0, -1.0, fbo_tex_w, +0.0, -1.0, +1.0, +0.0, fbo_tex_h, +1.0, +1.0, fbo_tex_w, fbo_tex_h }; glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, fbo_tex); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (float*)vert); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (float*)vert + 2); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glBindTexture(GL_TEXTURE_2D, 0); glUseProgram(old_prog); glViewport (viewportOffsetX, viewportOffsetY, viewportWidth, viewportHeight); } EGL_SwapBuffers(); if(fbo) { // Rebind FBO now glBindFramebuffer(GL_FRAMEBUFFER, fbo); } #endif }