libdrawtext

diff src/drawgl.c @ 64:d97cfb44221b

make sure to unbind any vbo's before trying to render
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 25 Aug 2012 17:50:17 +0300
parents 9d44f6b0591f
children 462bcb69de15
line diff
     1.1 --- a/src/drawgl.c	Wed Oct 05 02:27:08 2011 +0300
     1.2 +++ b/src/drawgl.c	Sat Aug 25 17:50:17 2012 +0300
     1.3 @@ -1,6 +1,6 @@
     1.4  /*
     1.5  libdrawtext - a simple library for fast text rendering in OpenGL
     1.6 -Copyright (C) 2011  John Tsiombikas <nuclear@member.fsf.org>
     1.7 +Copyright (C) 2011-2012  John Tsiombikas <nuclear@member.fsf.org>
     1.8  
     1.9  This program is free software: you can redistribute it and/or modify
    1.10  it under the terms of the GNU Lesser General Public License as published by
    1.11 @@ -183,10 +183,17 @@
    1.12  
    1.13  void dtx_flush(void)
    1.14  {
    1.15 +	int vbo;
    1.16 +
    1.17  	if(!num_quads) {
    1.18  		return;
    1.19  	}
    1.20  
    1.21 +	if(glBindBuffer) {
    1.22 +		glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &vbo);
    1.23 +		glBindBuffer(GL_ARRAY_BUFFER, 0);
    1.24 +	}
    1.25 +
    1.26  #ifndef GL_ES
    1.27  	glPushAttrib(GL_ENABLE_BIT);
    1.28  	glEnable(GL_TEXTURE_2D);
    1.29 @@ -242,6 +249,10 @@
    1.30  	glDisable(GL_BLEND);
    1.31  #endif
    1.32  
    1.33 +	if(glBindBuffer && vbo) {
    1.34 +		glBindBuffer(GL_ARRAY_BUFFER, vbo);
    1.35 +	}
    1.36 +
    1.37  	num_quads = 0;
    1.38  }
    1.39