libpsys

diff src/psys_gl.c @ 16:3871a45a4e4b

Almost there
author John Tsiombikas <nuclear@mutantstargoat.com>
date Tue, 11 Sep 2012 02:13:12 +0300
parents 9c24273f211b
children 0a53b22f7caf
line diff
     1.1 --- a/src/psys_gl.c	Mon Sep 10 21:57:49 2012 +0300
     1.2 +++ b/src/psys_gl.c	Tue Sep 11 02:13:12 2012 +0300
     1.3 @@ -1,5 +1,6 @@
     1.4  #include <string.h>
     1.5  #include <errno.h>
     1.6 +#include <assert.h>
     1.7  
     1.8  #ifndef __APPLE__
     1.9  #ifdef WIN32
    1.10 @@ -85,6 +86,7 @@
    1.11  	if(!(pixels = img_load_pixels(fname, &xsz, &ysz, IMG_FMT_RGBA32))) {
    1.12  		return 0;
    1.13  	}
    1.14 +	printf("%s: creating texture %s (%dx%d)\n", __func__, fname, xsz, ysz);
    1.15  
    1.16  	glGenTextures(1, &tex);
    1.17  	glBindTexture(GL_TEXTURE_2D, tex);
    1.18 @@ -92,7 +94,9 @@
    1.19  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    1.20  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    1.21  	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
    1.22 -	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, xsz, ysz, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
    1.23 +	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, xsz, ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
    1.24 +
    1.25 +	assert(glGetError() == GL_NO_ERROR);
    1.26  
    1.27  	img_free_pixels(pixels);
    1.28  	return tex;