Results 1 to 7 of 7

Thread: can framebuffer object used without egl initialization?

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    3

    can framebuffer object used without egl initialization?

    I'm a newcomer to the opengl programming. I want to use opengles 2.0 to do some post-processing of images. I find that the FBO seems to be a good choice. My question is how can I use the FBO and should I use the EGL API to create a display,context,surface before that? I found that I cannot use glGetIntegerv or glGenFramebuffer until a window/pbuffer surfface is created. Is there any better ways to do the same thing?

  2. #2
    Junior Member
    Join Date
    Dec 2011
    Posts
    3

    Re: can framebuffer object used without egl initialization?

    My code is like this, when egl initialization presents the code can run, but when removed it seems any function begin with gl* will fail.


    #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);

  3. #3

    Re: can framebuffer object used without egl initialization?

    Even I am looking for an answer for the exactly same problem. I think you need to create EGLContext as it is necessary for maintaining the OpenGL ES state (hope I am not wrong here), but I am not sure if creating pBuffer surface is required as you are planning to render onto a FBO object. However, if you don't create pBuffer surface, then I am not sure what needs to be passed as argument to eglMakeCurrent!

    Please let me know if you found what you were looking far!

    Thanks,

  4. #4

    Re: can framebuffer object used without egl initialization?

    ASFIK , you can not make any gl call before creating eglContext . Create a eglContext first and then you can proceed with FBOs no need to initialize shaders' stuff.

  5. #5
    Junior Member
    Join Date
    Dec 2011
    Posts
    3

    Re: can framebuffer object used without egl initialization?

    Thank you for you reply. I know glContext is necessary,but what about surface. Logically speaking I think it not necessary, but in fact FBO will not work if you do not create a surface.

  6. #6
    Junior Member
    Join Date
    Mar 2012
    Location
    Bavaria Germany
    Posts
    12

    Re: can framebuffer object used without egl initialization?

    Hi,

    i use the context without showing any surface on the screen. Im using iOS so i don't know if this is available on your platform, but maybe it helps you. It's necessary to create a rectangle where the OpenGL ES context can render the images. But i don't use it from the main screen. I think you only search for a rendering solution without showing the image on the screen?

    My solution for this:

    I've created a OpenGLESManager which holds the context.
    The initialization looks like the following code sniped:

    Code :
        if((_instance = [super initWithFrame:CGRectMake(0.0f, 0.0f, 2000, 2860)]))
        {
            context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
     
            if(!context || ![EAGLContext setCurrentContext:context])
            {
                [self release];
                return nil;
            }
     
            [self createFramebuffer];
        }

    After this i can use the opengl methods and rendering stuff. But i don't need to show it on the screen.

    For the context maybe it helps you to understand. The OpenGL ES Api is developed like a client server structure. And with the creating of the context you can set some messages or stats to the server. (<- This is from a OpenGL ES book and it helps me to understand the stuff of the OpenGL ES)

  7. #7

    Re: can framebuffer object used without egl initialization?

    Spec currently requires an egl surface/context be made current in your thread, even if you just want to render to an FBO.

Similar Threads

  1. ReadPixels from Framebuffer Object (fbo) => wrong Colors?
    By 11&amp;2 in forum Developers Coding:Advanced
    Replies: 1
    Last Post: 10-02-2010, 08:47 AM
  2. OpenKODE and EGL initialization conflict - extend OpenKODE
    By McNopper in forum OpenKODE discussions
    Replies: 2
    Last Post: 12-03-2007, 03:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •