few changes?
This commit is contained in:
@@ -168,6 +168,24 @@ GLuint WriteTexture(int textw, int texth){
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
|
|
||||||
|
// The depth buffer -- OPTIONAL, REMOVE WHEN NOT NEEDED
|
||||||
|
GLuint depthrenderbuffer;
|
||||||
|
glGenRenderbuffers(1, &depthrenderbuffer);
|
||||||
|
glBindRenderbuffer(GL_RENDERBUFFER, depthrenderbuffer);
|
||||||
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, 1024, 768);
|
||||||
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthrenderbuffer);
|
||||||
|
|
||||||
|
// Set "renderedTexture" as our colour attachement #0
|
||||||
|
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, renderedTexture, 0);
|
||||||
|
|
||||||
|
// Set the list of draw buffers.
|
||||||
|
GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT0};
|
||||||
|
glDrawBuffers(1, DrawBuffers); // "1" is the size of DrawBuffers
|
||||||
|
|
||||||
|
// Always check that our framebuffer is ok
|
||||||
|
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user