Browse Source

made bind() private again, removed comments

master
Joshua Moerman 14 years ago
parent
commit
17002c9a43
  1. 16
      J/fbo.h

16
J/fbo.h

@ -23,6 +23,7 @@
// TODO: more error checking in debug build. // TODO: more error checking in debug build.
// TODO: make texture class? for easier switching between linear/nearest interpolation for example // TODO: make texture class? for easier switching between linear/nearest interpolation for example
// NOTE: stencil attachment is not supported // NOTE: stencil attachment is not supported
// NOTE: in end() we don't set a viewport, because it will be always set (the 'main' fbo is also an J::fbo)
namespace J { namespace J {
@ -59,7 +60,7 @@ public:
unbind(); unbind();
} }
// ctor from EAGLContext, not using texture, so you cannot use it as lookup, only as renderer. // ctor from EAGLContext, not using textures, so you cannot use it as lookup, only as renderer.
fbo(EAGLContext* context, CAEAGLLayer* layer); fbo(EAGLContext* context, CAEAGLLayer* layer);
~fbo() { ~fbo() {
@ -78,22 +79,14 @@ public:
void begin(){ void begin(){
bind(); bind();
// FIXME: this should be done, but also switching back should be done...
//glPushAttrib(GL_VIEWPORT);
glViewport(0, 0, width, height); glViewport(0, 0, width, height);
// NOTE: commented out, because we don't want fbo's to nest.
/*GLint savedFramebuffer = -1;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &savedFramebuffer);
std::cout << "sfb: " << savedFramebuffer << ", fbo: " << fbo_number << std::endl;*/
} }
void end(){ void end(){
unbind(); unbind();
// FIXME: switch back to previous viewport. See begin()
//glPopAttrib();
} }
private:
void bind(){ void bind(){
glBindFramebuffer(GL_FRAMEBUFFER, fbo_number); glBindFramebuffer(GL_FRAMEBUFFER, fbo_number);
check_error(); check_error();
@ -102,8 +95,7 @@ public:
void unbind(){ void unbind(){
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
} }
private:
void create_attach_renderbuffer(GLenum format, GLenum attachment_point) { void create_attach_renderbuffer(GLenum format, GLenum attachment_point) {
GLuint buffer; GLuint buffer;
glGenRenderbuffers(1, &buffer); glGenRenderbuffers(1, &buffer);