mirror of https://github.com/bjornbytes/lovr.git
Small reference count fixes;
This commit is contained in:
parent
d014daaa53
commit
0eea694bdd
|
@ -53,6 +53,9 @@ Buffer* lovrBufferCreate(int size, BufferFormat* format, BufferDrawMode drawMode
|
|||
|
||||
void lovrBufferDestroy(const Ref* ref) {
|
||||
Buffer* buffer = containerof(ref, Buffer);
|
||||
if (buffer->texture) {
|
||||
lovrRelease(&buffer->texture->ref);
|
||||
}
|
||||
glDeleteBuffers(1, &buffer->vbo);
|
||||
glDeleteVertexArrays(1, &buffer->vao);
|
||||
vec_deinit(&buffer->map);
|
||||
|
@ -101,6 +104,8 @@ void lovrBufferDraw(Buffer* buffer) {
|
|||
// Set texture
|
||||
if (buffer->texture) {
|
||||
lovrTextureBind(buffer->texture);
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
// Determine range of vertices to be rendered and whether we're using an IBO or not
|
||||
|
|
|
@ -485,6 +485,7 @@ void lovrGraphicsSkybox(Skybox* skybox, float angle, float ax, float ay, float a
|
|||
}
|
||||
|
||||
Shader* lastShader = lovrGraphicsGetShader();
|
||||
lovrRetain(&lastShader->ref);
|
||||
lovrGraphicsSetShader(state.skyboxShader);
|
||||
|
||||
float cos2 = cos(angle / 2);
|
||||
|
@ -552,5 +553,6 @@ void lovrGraphicsSkybox(Skybox* skybox, float angle, float ax, float ay, float a
|
|||
glDepthMask(GL_TRUE);
|
||||
|
||||
lovrGraphicsSetShader(lastShader);
|
||||
lovrRelease(&lastShader->ref);
|
||||
lovrGraphicsPop();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue