From 1f02c5df88dce28bf8f9229cf9e88c54d278dd1e Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 8 May 2016 20:58:18 -0400 Subject: [PATCH] Tidied up some further loose ends. --- .../Mac/Clock Signal/Documents/MachineDocument.swift | 6 ------ Outputs/CRT/Internals/TextureTarget.cpp | 7 ++++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift index db28c4456..473e81aad 100644 --- a/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift +++ b/OSBindings/Mac/Clock Signal/Documents/MachineDocument.swift @@ -36,13 +36,7 @@ class MachineDocument: NSDocument, CSOpenGLViewDelegate, CSOpenGLViewResponderDe private var cycleCountError: Int64 = 0 private var lastTime: CVTimeStamp? private var skippedFrames = 0 -// private var frameSkip = 0 final func openGLView(view: CSOpenGLView, didUpdateToTime time: CVTimeStamp, didSkipPreviousUpdate : Bool, frequency : Double) { -// frameSkip = frameSkip + 1 -// if (frameSkip % 1) == 0 && frameSkip < 50000 { -// runForNumberOfCycles(Int32(intendedCyclesPerSecond / 60)) -// view.drawViewOnlyIfDirty(true) -// } if let lastTime = lastTime { // perform (time passed in seconds) * (intended cycles per second), converting and // maintaining an error count to deal with underflow diff --git a/Outputs/CRT/Internals/TextureTarget.cpp b/Outputs/CRT/Internals/TextureTarget.cpp index 2738a43d1..ed0bffd84 100644 --- a/Outputs/CRT/Internals/TextureTarget.cpp +++ b/Outputs/CRT/Internals/TextureTarget.cpp @@ -8,6 +8,7 @@ #include "TextureTarget.hpp" #include +#include using namespace OpenGL; @@ -29,7 +30,9 @@ TextureTarget::TextureTarget(GLsizei width, GLsizei height, GLenum texture_unit) glGenTextures(1, &_texture); glActiveTexture(texture_unit); glBindTexture(GL_TEXTURE_2D, _texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)_expanded_width, (GLsizei)_expanded_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); + uint8_t *blank_buffer = (uint8_t *)calloc((size_t)(_expanded_width * _expanded_height), 4); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)_expanded_width, (GLsizei)_expanded_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, blank_buffer); + free(blank_buffer); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -37,8 +40,6 @@ TextureTarget::TextureTarget(GLsizei width, GLsizei height, GLenum texture_unit) if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) throw ErrorFramebufferIncomplete; - - glClear(GL_COLOR_BUFFER_BIT); } TextureTarget::~TextureTarget()