|
[em24]
我看教程里面说FBO调用不需要EGL支持,但发现实际上如果直接调用gl开头的函数都直接报错,这是什么原因。是否需要进行一些初始化操作。
程序在有EGL初始化并建立了surface的情况下能够正常运行,但去掉EGL部分就不行了。 EGL初始化时必须的吗?如果我只用FBO部分。
#include "./gl2.h"
#include "./gl2ext.h"
#include "./gl2extimg.h"
int main(int argc, char **argv)
{
// Fragment and vertex shaders code
const char* pszVertShader =
"attribute vec4 a_position; \n"
"void main() \n"
"{ \n"
" gl_Position = a_position; \n"
"} \n";
const char* pszFragShader =
"precision mediump float; \n"
"void main() \n"
"{ \n"
" gl_FragColor = vec4(0.5, 0.3, 0.1,1.0);\n"
"} \n";
GLuint uiFragShader, uiVertShader; // Used to hold the fragment and vertex shader handles
GLuint uiProgramObject; // Used to hold the program handle (made out of the two previous shaders
// Create the fragment shader object
uiFragShader = glCreateShader(GL_FRAGMENT_SHADER); |
|