Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About dudemeister

  • Rank
  1. dudemeister

    FBO renders only one colour component

    Haha, that question answered my question... I only see blue, and that's of course because the last glColor3f set is blue. I set the colour to white before i render the texture quad and now everything works!
  2. dudemeister

    FBO renders only one colour component

    The only guess I've got is that it has something to do with how I set up the texture, but I've followed the example code in the "OpenGL FrameBuffer Object 201" article, so I don't see how it could be a problem.
  3. Hi, I'm trying to write a program that uses multipass rendering. Using framebuffers I render the objects to a texture and then use the texture in a shader program to, for instance, blur the image and then render a screen sized quad to display the blurred image from the first pass. The first step I'm trying to get working is to just render a multicoloured quad to the texture attached FBO and then render a quad filling the screen with this texture. If I just draw the multicoloured quad directly to the screen all three colour components are shown, but if I render first to the frame buffer and display it via the screensized quad only one colour component is shown! I've written another program doing almost the same thing that works, but I can't find what the differance could be. Does anybody have any idea what the problem could be? Setting up the FBO void setupFramebuffer() { //Crete and bind framebuffer glGenFramebuffersEXT(1, &fbo); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); // Create and bind depth buffer glGenRenderbuffersEXT(1, &depthbuffer); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthbuffer); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height); //Setup texture glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_FLOAT, NULL); // Attatch texture to fbo glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture, 0); // Attatch depthbuffer to fbo glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthbuffer); // Check the status if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) exit(0); } Display function void display(void) { // Render to framebuffer fbo glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); glViewport(0, 0, width, height); glClearColor (0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Draw a smaller box coloured with different colours glLoadIdentity(); glBegin(GL_QUADS); glColor3f(1.0, 1.0, 1.0); glVertex3f(-.5, -.5, 0.0); glColor3f(1.0, 0.0, 0.0); glVertex3f(-.5, .5, 0.0); glColor3f(0.0, 1.0, 0.0); glVertex3f(.5, .5, 0.0); glColor3f(0.0, 0.0, 1.0); glVertex3f(.5, -.5, 0.0); glEnd(); // Render to screen glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture); glLoadIdentity(); glBegin(GL_QUADS); glTexCoord2f(0.0, 0.0); glVertex3f(-1, -1, 0.0); glTexCoord2f(0.0, 1.0); glVertex3f(-1, 1, 0.0); glTexCoord2f(1.0, 1.0); glVertex3f(1, 1, 0.0); glTexCoord2f(1.0, 0.0); glVertex3f(1, -1, 0.0); glEnd(); glDisable(GL_TEXTURE_2D); glFlush(); }
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!