Skip to content
This repository has been archived by the owner on Apr 10, 2022. It is now read-only.

Commit

Permalink
Compile under VS
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiffany Bennett committed Oct 22, 2015
1 parent 82ae857 commit ce0ff08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/tgl/fbo.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void tgl_fbo_bindTex(tgl_fbo *self, unsigned target)

void tgl_fbo_bind(tgl_fbo *self, enum tgl_fbo_type type)
{
GLenum drawbufs[self->num], target;
GLenum *drawbufs = calloc(self->num, sizeof(GLenum)), target;
unsigned i;
for (i = 0; i < self->num; i++) {
drawbufs[i] = self->targets[i].attach;
Expand All @@ -109,11 +109,12 @@ void tgl_fbo_bind(tgl_fbo *self, enum tgl_fbo_type type)
} else {
glDrawBuffers(self->num, drawbufs);
}
free(drawbufs);
}

void tgl_fbo_bind_with(tgl_fbo *self, enum tgl_fbo_type type, unsigned n, const unsigned *order)
void tgl_fbo_bind_with(tgl_fbo *self, enum tgl_fbo_type type, unsigned n, const unsigned *order)
{
GLenum drawbufs[n], target;
GLenum *drawbufs = calloc(n, sizeof(GLenum)), target;
unsigned i;
for (i = 0; i < n; i++) {
unsigned id = order[i];
Expand All @@ -136,7 +137,7 @@ void tgl_fbo_bind_with(tgl_fbo *self, enum tgl_fbo_type type, unsigned n, const
} else {
glDrawBuffers(n, drawbufs);
}

free(drawbufs);
}

void tgl_fbo_swap(tgl_fbo *self, unsigned target1, unsigned target2)
Expand All @@ -162,8 +163,8 @@ bool tgl_fbo_build(tgl_fbo *self, unsigned w, unsigned h)
for (i = 0; i < self->num; i++) {
tgl_fbo_target *t = self->targets + i;
glBindTexture(t->target, self->textures[i]);
unsigned tw = t->awidth + t->rwidth * w;
unsigned th = t->aheight + t->rheight * h;
unsigned tw = (unsigned)(t->awidth + t->rwidth * w);
unsigned th = (unsigned)(t->aheight + t->rheight * h);
if (t->multisample) {
glTexImage2DMultisample(t->target, t->samples, t->fmt,
tw, th, t->fixedsamplelocs);
Expand Down
4 changes: 4 additions & 0 deletions src/tgl/glutil.h
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef TGL_GLUTIL_H
#define TGL_GLUTIL_H

#if defined(_MSC_VER) && !defined(__func__)
#define __func__ __FUNCTION__
#endif

typedef void (*tgl_log_fn)(const char *file, int line, const char *func, const char *msg, void *user);

const char * tgl_strerror(GLenum err);
Expand Down

0 comments on commit ce0ff08

Please sign in to comment.