游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2103|回复: 0

opengl es 调用FBO 需要初始化吗?

[复制链接]

1

主题

1

帖子

0

积分

新手上路

Rank: 1

积分
0
发表于 2011-12-22 11:17:00 | 显示全部楼层 |阅读模式
[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);
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-6-9 09:08

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表