1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| glBindTexture(GL_TEXTURE_2D, 0); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, worldColor.framebufferID);
glClearColor (1.0f, 1.0f, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glMatrixMode(GL_PROJECTION); glLoadIdentity();
glOrtho(Player.xPosition-resolution.width/2*camScale, Player.xPosition+resolution.width/2*camScale, Player.yPosition+resolution.height/2*camScale, Player.yPosition-resolution.height/2*camScale, 1, -1); cameraRender = (int)getTime();
glMatrixMode(GL_MODELVIEW); glLoadIdentity();
glActiveTexture(GL_TEXTURE0); sky.render(); skyRender = (int)getTime(); world.render(); worldRender = (int)getTime(); player.render(); playerRender = (int)getTime(); Inventory.render(); inventoryRender = (int)getTime(); Menu.render(); Cursor.render(); DebugScreen.render();
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glClearColor (1.0f, 1.0f, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glMatrixMode(GL_PROJECTION); glLoadIdentity();
GL11.glOrtho(0, resolution.width, 0, resolution.height, 1, -1);
glMatrixMode(GL_MODELVIEW); glLoadIdentity();
Color.white.bind();
glUseProgram(light.shaderProgram);
glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, worldColor.colorTextureID); glUniform1i(light.the_location0, 0);
glActiveTexture(GL_TEXTURE1); Tiles.vignette.bind(); glUniform1i(light.the_location1, 1);
glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(0, 0); glTexCoord2f(1, 0); glVertex2f(resolution.width, 0); glTexCoord2f(1, 1); glVertex2f(resolution.width, resolution.height); glTexCoord2f(0, 1); glVertex2f(0, resolution.height); glEnd();
glUseProgram(0);
glUseProgram(diffuse.shaderProgram);
glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, Tiles.characters1.getTextureID()); glUniform1i(diffuse.the_location0, 0);
glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex2f(0, 0); glTexCoord2f(1, 0); glVertex2f(200, 0); glTexCoord2f(1, 1); glVertex2f(200, 200); glTexCoord2f(0, 1); glVertex2f(0, 200); glEnd();
glUseProgram(0);
glActiveTexture(GL_TEXTURE1); |