Orthographic View Screenshot ?

thank you for that info…so it seems that since I care only about the colors of the scene when I count the background and vehicle pixels than all I need is to attach a color buffer…and since I don’t need to write into texture memory I just need to use the render buffers.

ok…now onto figuring the junk out. Thanks for the help.

[quote=“lhkbob,post:20,topic:32373”]
BURN THE HEATHEN! >:(

So I still can’t figure out how to create and attach renderbuffers and all of the sites out there show how to do textures and say that renderbuffers is the other option but none of them show squat…I have no idea what I’m doing a reading a spec isn’t going to tell me anything because I don’t speak opengl spec speak - this is really frustrating. Also, I need a color render buffer, only mention I’ve seen out there was of depth render buffers and colors are always secondary…sigh.

Initialization code … in an init() method is:

public void init() {
isFboSupported = gl.isExtensionAvailable(“GL_EXT_framebuffer_object”);
if (isFboSupported) {
// Create the frame buffer
gl.glGenFramebuffersEXT(1, framebufferName, 0);

  // Bind the frame buffer for use
  gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT,framebufferName[0]);

  // Check status of frame buffer
  checkFboStatus(gl);        [color=black]Status: GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT

  // Create the render buffer
  gl.glGenRenderbuffersEXT(1, renderbufferName, 0);

  // Bind the render buffer for use
  gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT,renderbufferName[0]);

  // Set the render buffer storage
  gl.glRenderbufferStorageEXT(GL.GL_RENDERBUFFER_EXT, GL.GL_RGB, frameWidth, frameHeight);

  // Attach the render buffer to the frame buffer
  gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT, GL.GL_RENDERBUFFER_EXT, renderbufferName[0]);
  // Unbind the frame buffer
  gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);
}

}[/color]

Now in the display loop I do the following

public void display() {


if (isFboSupported) {
// Set the viewport bit attribute
gl.glPushAttrib(GL.GL_VIEWPORT_BIT);

  // Bind the frame buffer for use
  gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, framebufferName[0])

  // Check status of frame buffer
  checkFboStatus(gl);        [color=red]Status: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT

  // Set the viewport
  gl.glViewport(0, 0, frameWidth, frameHeight);

  // Clear the color to GREEN
  gl.glClearColor(0.0f, 1.0f, 0.0f, 0.0f);

  // Draw the background scene
  drawBackgroundScene();

  // Check status of frame buffer
  checkFboStatus(gl);        Status: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT

  // Read the frame...read pixels
  gl.glReadBuffer(GL.GL_COLOR_ATTACHMENT0_EXT);
  gl.glPixelStorei( GL.GL_PACK_ALIGNMENT, 1 );
  gl.glReadPixels( 0, 0, frameWidth, frameHeight, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, pixelsRGB );

  // Unbind the frame buffer
  gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);

  // Unset the viewport bit attribute
  gl.glPopAttrib();

  // Check status of frame buffer
  checkFboStatus(gl);        Status: GL_FRAMEBUFFER_COMPLETE_EXT
}

// Reset the view and Draw the main scene
drawMainScene();

}[/color]

Doing this, and saving the pixels, I end up getting a black screen…ie the pixels are all black. They should be GREEN and some white (for the vehicle in the view) but I get all black…and I’m not sure the FBO status errors I get (the ones in red) are valid for that point of the code or if they are true errors that require a fix?

well, I feel like a damn idiot … I never set frameWidth and frameHeight before the init() method and so that was causing the darn problem…everything is working now. geez

Thank you to all that helped or tried to help. :slight_smile: Well, the code above is valid, so I hope it helps others with FBO.