渲染到 FBO 然后渲染到屏幕缓冲区似乎会使纹理更暗。如此处所示-> http://imgur.com/QZNyY8U
RenderTarget target = new RenderTarget(Display.getWidth(), Display.getHeight());
RenderTarget 类可以在这里找到:http: //pastebin.com/anpBPsgv
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
// set the color of the quad (R,G,B,A)
GL11.glColor4f(5/255f, 35/255f,70/255f, 1f);
//Bind Render Target
target.bind();
// draw quad on FBO
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(0,0);
GL11.glVertex2f(0+200,0);
GL11.glVertex2f(0+200,0+200);
GL11.glVertex2f(0,0+200);
GL11.glEnd();
target.unBind();
glEnable(GL_TEXTURE_2D); // enable texturing
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);// switch to rendering on the framebuffer
glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);// Clear Screen And Depth Buffer on the framebuffer to black
glBindTexture(GL_TEXTURE_2D, target.colorTextureID); // bind our FBO texture
//Draw FBO on screen buffer
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex2i(0, 0);
glTexCoord2f(1.0f, 0.0f); glVertex2i(Display.getWidth(), 0);
glTexCoord2f(1.0f, 1.0f); glVertex2i(Display.getWidth(), Display.getHeight());
glTexCoord2f(0.0f, 1.0f); glVertex2i(0, Display.getHeight());
glEnd();
glDisable(GL_TEXTURE_2D);
//Draw same colour image without gonig through FBO
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(200,0);
GL11.glVertex2f(200+200,0);
GL11.glVertex2f(200+200,0+200);
GL11.glVertex2f(200,0+200);
GL11.glEnd();
glFlush ();
可以在此处找到使用的类pastebin.com/YRChp5vB和此处pastebin.com/anpBPsgv