mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-26 09:29:45 +00:00
Reinstated texture target creation, cut them down to merely RGB.
This commit is contained in:
parent
4be8053ba9
commit
04d1b65c93
@ -62,6 +62,14 @@ OpenGLOutputBuilder::OpenGLOutputBuilder(unsigned int buffer_depth) :
|
||||
}
|
||||
_buffer_builder = std::unique_ptr<CRTInputBufferBuilder>(new CRTInputBufferBuilder(buffer_depth));
|
||||
|
||||
// Create intermediate textures and bind to slots 0, 1 and 2
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
compositeTexture = std::unique_ptr<OpenGL::TextureTarget>(new OpenGL::TextureTarget(IntermediateBufferWidth, IntermediateBufferHeight));
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
filteredYTexture = std::unique_ptr<OpenGL::TextureTarget>(new OpenGL::TextureTarget(IntermediateBufferWidth, IntermediateBufferHeight));
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
filteredTexture = std::unique_ptr<OpenGL::TextureTarget>(new OpenGL::TextureTarget(IntermediateBufferWidth, IntermediateBufferHeight));
|
||||
|
||||
// create the surce texture
|
||||
glGenTextures(1, &textureName);
|
||||
glActiveTexture(GL_TEXTURE0 + first_supplied_buffer_texture_unit);
|
||||
@ -92,14 +100,6 @@ OpenGLOutputBuilder::OpenGLOutputBuilder(unsigned int buffer_depth) :
|
||||
|
||||
// map that buffer too, for any CRT activity that may occur before the first draw
|
||||
_output_buffer_data = (uint8_t *)glMapBufferRange(GL_ARRAY_BUFFER, 0, OutputVertexBufferDataSize, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT);
|
||||
|
||||
// Create intermediate textures and bind to slots 0, 1 and 2
|
||||
// glActiveTexture(GL_TEXTURE0);
|
||||
// compositeTexture = std::unique_ptr<OpenGL::TextureTarget>(new OpenGL::TextureTarget(IntermediateBufferWidth, IntermediateBufferHeight));
|
||||
// glActiveTexture(GL_TEXTURE1);
|
||||
// filteredYTexture = std::unique_ptr<OpenGL::TextureTarget>(new OpenGL::TextureTarget(IntermediateBufferWidth, IntermediateBufferHeight));
|
||||
// glActiveTexture(GL_TEXTURE2);
|
||||
// filteredTexture = std::unique_ptr<OpenGL::TextureTarget>(new OpenGL::TextureTarget(IntermediateBufferWidth, IntermediateBufferHeight));
|
||||
}
|
||||
|
||||
OpenGLOutputBuilder::~OpenGLOutputBuilder()
|
||||
@ -134,6 +134,9 @@ void OpenGLOutputBuilder::draw_frame(unsigned int output_width, unsigned int out
|
||||
// or 0 if no framebuffer is bound, in which case 0 is also what we want to supply to bind the implied framebuffer. So
|
||||
// it works either way.
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *)&defaultFramebuffer);
|
||||
|
||||
// TODO: is this sustainable, cross-platform? If so, why store it at all?
|
||||
defaultFramebuffer = 0;
|
||||
}
|
||||
|
||||
// lock down any further work on the current frame
|
||||
|
@ -18,8 +18,8 @@ TextureTarget::TextureTarget(GLsizei width, GLsizei height) : _width(width), _he
|
||||
glGenTextures(1, &_texture);
|
||||
glBindTexture(GL_TEXTURE_2D, _texture);
|
||||
|
||||
uint8_t *emptySpace = new uint8_t[width*height*4];
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, emptySpace);
|
||||
uint8_t *emptySpace = new uint8_t[width*height*3];
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, (GLsizei)width, (GLsizei)height, 0, GL_RGB, GL_UNSIGNED_BYTE, emptySpace);
|
||||
delete[] emptySpace;
|
||||
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _texture, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user