0:2(12): warning: extension `GL_ARB_gpu_shader5' unsupported in vertex shader
0:2(12): warning: extension `GL_ARB_gpu_shader5' unsupported in fragment shader
#include <GLES2/gl2.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#define __ALLWAYS_SHOW_SHADER_DEBUG_LOG__
#include "debug_gl.h"
GLFWwindow* window;
void main_loop();
int main()
{
glfwInit();
window = glfwCreateWindow(800, 600, "OpenGL ES", nullptr, nullptr); // Windowed
glfwMakeContextCurrent(window);
// Shader sources
const GLchar* vertexSource =
"#version 100\n"
"attribute vec2 position;"
"void main()"
"{"
" gl_Position = vec4(position, 0.0, 1.0);"
"}";
const GLchar* fragmentSource =
"#version 100\n"
"void main()"
"{"
" gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);"
"}";
//Shader compile
GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, &vertexSource, NULL);
glCompileShader(vertexShader);
GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragmentShader, 1, &fragmentSource, NULL);
glCompileShader(fragmentShader);
__CHECK_VSHADER(vertexShader)
__CHECK_FSHADER(fragmentShader)
//Shader link
GLuint shaderProgram = glCreateProgram();
glAttachShader(shaderProgram, vertexShader);
glAttachShader(shaderProgram, fragmentShader);
glLinkProgram(shaderProgram);
glUseProgram(shaderProgram);
__CHECK_SHADER_PROG(shaderProgram)
//vertice data
float vertices[] = {
0.0f, 0.5f, // Vertex 1 (X, Y)
0.5f, -0.5f, // Vertex 2 (X, Y)
-0.5f, -0.5f // Vertex 3 (X, Y)
};
//initialize buffers
GLuint vbo;
glGenBuffers(1, &vbo);
//send data to buffers
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
//Format of vertice data?
GLint posAttrib = glGetAttribLocation(shaderProgram, "position");
glEnableVertexAttribArray(posAttrib);
glVertexAttribPointer(posAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0);
__CHECK_GL_ERROR__
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(main_loop, 0, 1);
#else
while(!glfwWindowShouldClose(window))
{
main_loop();
}
#endif
glfwTerminate();
return 0;
}
void main_loop()
{
glDrawArrays(GL_TRIANGLES, 0, 3);
glfwSwapBuffers(window);
glfwPollEvents();
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I was just wandering if I was using that extension without knowing it. I've modified one of the tests in tests/glbook to show the shader logs and it confirms that's not the case. This settles my concern thanks.