MCPcopy Create free account
hub / github.com/Blakkis/PyGLMaze / __createPassBuffer

Method __createPassBuffer

pymaze/post_processing.py:60–88  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

58
59
60 def __createPassBuffer(self):
61 self.buffer = glGenFramebuffers(1)
62 glBindFramebuffer(GL_FRAMEBUFFER, self.buffer)
63
64 # -------- Add color attachment
65
66 self.color_texture = glGenTextures(1)
67 glBindTexture(GL_TEXTURE_2D, self.color_texture)
68
69 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, self.d_resolution.x, self.d_resolution.y, 0, GL_RGB, GL_UNSIGNED_BYTE, None)
70 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
71 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
72 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self.color_texture, 0)
73
74 # -------- Add depth attachment
75
76 self.depth_texture = glGenTextures(1)
77 glBindTexture(GL_TEXTURE_2D, self.depth_texture)
78
79 glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, self.d_resolution.x, self.d_resolution.y, 0, GL_DEPTH_COMPONENT, GL_FLOAT, None)
80 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
81 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
82 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, self.depth_texture, 0)
83
84 # --------
85
86 if glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE:
87 print("Framebuffer Error!")
88 # TODO: Make GL utility functions
89
90
91 def __createPassQuad(self):

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected