1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-26 09:29:45 +00:00

Tidied up some further loose ends.

This commit is contained in:
Thomas Harte 2016-05-08 20:58:18 -04:00
parent 3084c465d6
commit 1f02c5df88
2 changed files with 4 additions and 9 deletions

View File

@ -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

View File

@ -8,6 +8,7 @@
#include "TextureTarget.hpp"
#include <math.h>
#include <stdlib.h>
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()