mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Tidied up some further loose ends.
This commit is contained in:
parent
3084c465d6
commit
1f02c5df88
@ -36,13 +36,7 @@ class MachineDocument: NSDocument, CSOpenGLViewDelegate, CSOpenGLViewResponderDe
|
|||||||
private var cycleCountError: Int64 = 0
|
private var cycleCountError: Int64 = 0
|
||||||
private var lastTime: CVTimeStamp?
|
private var lastTime: CVTimeStamp?
|
||||||
private var skippedFrames = 0
|
private var skippedFrames = 0
|
||||||
// private var frameSkip = 0
|
|
||||||
final func openGLView(view: CSOpenGLView, didUpdateToTime time: CVTimeStamp, didSkipPreviousUpdate : Bool, frequency : Double) {
|
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 {
|
if let lastTime = lastTime {
|
||||||
// perform (time passed in seconds) * (intended cycles per second), converting and
|
// perform (time passed in seconds) * (intended cycles per second), converting and
|
||||||
// maintaining an error count to deal with underflow
|
// maintaining an error count to deal with underflow
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "TextureTarget.hpp"
|
#include "TextureTarget.hpp"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
using namespace OpenGL;
|
using namespace OpenGL;
|
||||||
|
|
||||||
@ -29,7 +30,9 @@ TextureTarget::TextureTarget(GLsizei width, GLsizei height, GLenum texture_unit)
|
|||||||
glGenTextures(1, &_texture);
|
glGenTextures(1, &_texture);
|
||||||
glActiveTexture(texture_unit);
|
glActiveTexture(texture_unit);
|
||||||
glBindTexture(GL_TEXTURE_2D, _texture);
|
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_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_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)
|
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
||||||
throw ErrorFramebufferIncomplete;
|
throw ErrorFramebufferIncomplete;
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureTarget::~TextureTarget()
|
TextureTarget::~TextureTarget()
|
||||||
|
Loading…
Reference in New Issue
Block a user