don't stream in rasterfont
mapping blocks on nvidia workstation, so use glBufferData
This commit is contained in:
parent
afb5be10d9
commit
01d8c21e1d
|
@ -208,11 +208,7 @@ RasterFont::~RasterFont()
|
||||||
void RasterFont::printMultilineText(const char *text, double start_x, double start_y, double z, int bbWidth, int bbHeight, u32 color)
|
void RasterFont::printMultilineText(const char *text, double start_x, double start_y, double z, int bbWidth, int bbHeight, u32 color)
|
||||||
{
|
{
|
||||||
size_t length = strlen(text);
|
size_t length = strlen(text);
|
||||||
|
GLfloat *vertices = new GLfloat[length*6*4];
|
||||||
glBindVertexArray(VAO);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, length*4*6*sizeof(GLfloat), NULL, GL_STREAM_DRAW);
|
|
||||||
GLfloat *vertices = (GLfloat*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
|
||||||
|
|
||||||
int usage = 0;
|
int usage = 0;
|
||||||
GLfloat delta_x = GLfloat(2*char_width)/GLfloat(bbWidth);
|
GLfloat delta_x = GLfloat(2*char_width)/GLfloat(bbWidth);
|
||||||
|
@ -272,7 +268,17 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta
|
||||||
|
|
||||||
x += delta_x + border_x;
|
x += delta_x + border_x;
|
||||||
}
|
}
|
||||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
|
||||||
|
if(!usage) {
|
||||||
|
delete [] vertices;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glBindVertexArray(VAO);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, usage*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
||||||
|
|
||||||
|
delete [] vertices;
|
||||||
|
|
||||||
ProgramShaderCache::SetBothShaders(s_fragmentShader.glprogid, s_vertexShader.glprogid);
|
ProgramShaderCache::SetBothShaders(s_fragmentShader.glprogid, s_vertexShader.glprogid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue