mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 15:49:25 +01:00
revert update the rasterfont shader to GLSL3.3 - OGL 2.0 should be enough
This commit is contained in:
parent
79a7ce4827
commit
399a6af66d
@ -125,22 +125,19 @@ const u8 rasters[char_count][char_height] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const char *s_vertex_shader =
|
static const char *s_vertex_shader =
|
||||||
"#version 330 core\n"
|
"attribute vec2 vertexPosition;\n"
|
||||||
"layout(location = 0) in vec2 vertexPosition;\n"
|
"attribute vec2 texturePosition;\n"
|
||||||
"layout(location = 1) in vec2 texturePosition;\n"
|
"varying vec2 tpos;\n"
|
||||||
"out vec2 tpos;\n"
|
|
||||||
"void main(void) {\n"
|
"void main(void) {\n"
|
||||||
" gl_Position = vec4(vertexPosition,0,1);\n"
|
" gl_Position = vec4(vertexPosition,0,1);\n"
|
||||||
" tpos = texturePosition;\n"
|
" tpos = texturePosition;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
static const char *s_fragment_shader =
|
static const char *s_fragment_shader =
|
||||||
"#version 330 core\n"
|
|
||||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||||
"uniform sampler2DRect textureSampler;\n"
|
"uniform sampler2DRect textureSampler;\n"
|
||||||
"uniform vec4 color;\n"
|
"uniform vec4 color;\n"
|
||||||
"in vec2 tpos;\n"
|
"varying vec2 tpos;\n"
|
||||||
"out vec4 gl_FragColor;\n"
|
|
||||||
"void main(void) {\n"
|
"void main(void) {\n"
|
||||||
" gl_FragColor = texture2DRect(textureSampler,tpos) * color;\n"
|
" gl_FragColor = texture2DRect(textureSampler,tpos) * color;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
@ -162,16 +159,6 @@ RasterFont::RasterFont()
|
|||||||
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, char_width*char_count, char_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture_data);
|
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, char_width*char_count, char_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture_data);
|
||||||
delete [] texture_data;
|
delete [] texture_data;
|
||||||
|
|
||||||
// generate VBO & VAO
|
|
||||||
glGenBuffers(1, &VBO);
|
|
||||||
glGenVertexArrays(1, &VAO);
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
|
||||||
glBindVertexArray(VAO);
|
|
||||||
glEnableVertexAttribArray(0); // vertexPosition
|
|
||||||
glVertexAttribPointer(0, 2, GL_FLOAT, 0, sizeof(GLfloat)*4, NULL);
|
|
||||||
glEnableVertexAttribArray(1); // texturePosition
|
|
||||||
glVertexAttribPointer(1, 2, GL_FLOAT, 0, sizeof(GLfloat)*4, (GLfloat*)NULL+2);
|
|
||||||
|
|
||||||
// generate shader
|
// generate shader
|
||||||
shader_program = OpenGL_CompileProgram(s_vertex_shader, s_fragment_shader);
|
shader_program = OpenGL_CompileProgram(s_vertex_shader, s_fragment_shader);
|
||||||
|
|
||||||
@ -183,6 +170,16 @@ RasterFont::RasterFont()
|
|||||||
cached_color = -1;
|
cached_color = -1;
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
|
|
||||||
|
// generate VBO & VAO
|
||||||
|
glGenBuffers(1, &VBO);
|
||||||
|
glGenVertexArrays(1, &VAO);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||||
|
glBindVertexArray(VAO);
|
||||||
|
glEnableVertexAttribArray(glGetAttribLocation(shader_program, "vertexPosition"));
|
||||||
|
glVertexAttribPointer(glGetAttribLocation(shader_program, "vertexPosition"), 2, GL_FLOAT, 0, sizeof(GLfloat)*4, NULL);
|
||||||
|
glEnableVertexAttribArray(glGetAttribLocation(shader_program, "texturePosition"));
|
||||||
|
glVertexAttribPointer(glGetAttribLocation(shader_program, "texturePosition"), 2, GL_FLOAT, 0, sizeof(GLfloat)*4, (GLfloat*)NULL+2);
|
||||||
|
|
||||||
// TODO: this after merging with graphic_update
|
// TODO: this after merging with graphic_update
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user