Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (741)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (823)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [JOGL] Starting with frame buffers  (Read 622 times)
0 Members and 1 Guest are viewing this topic.
Offline Chennorris

Junior Newbie


Exp: 10 years



« Posted 2017-05-16 12:00:06 »

Hello everyone,

I'm currently working on a new part of my JOGL project, following tutorials about Framebuffers (this one looks rather good to me). I'm stuck at the very beginning of this tutorial, with a strange status for my framebuffer (1280 does not seem to correspond to any status).

To understand a bit more my problem, here's how my code looks like :
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
public static void renderAll(GLAutoDrawable drawable) throws NullPointerException {
    GL3 gl = drawable.getGL().getGL3();
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT);
    gl.glClearColor(0.3f, 0.3f, 0.3f, 0);

    // Enabling alpha transparency
    gl.glEnable(GL3.GL_BLEND | GL3.GL_PROGRAM_POINT_SIZE);
    gl.glBlendFunc(GL3.GL_SRC_ALPHA, GL3.GL_ONE_MINUS_SRC_ALPHA);
    gl.glPolygonMode(GL3.GL_FRONT_AND_BACK, isInPlayMode() ? GL3.GL_FILL : GL3.GL_LINE);

    // Updating camera position, direction and zoom
    CameraManager.updateCamera();

    SceneManager.renderIntoFramebuffer(gl, mainWindow.getWidth(), mainWindow.getHeight());

    gl.glFlush();
}

...

SceneManager.renderIntoFramebuffer(GL3 gl, int viewportWidth, int viewportHeight) {
    // Creation of the framebuffer
    IntBuffer idFramebuffer = GLBuffers.newDirectIntBuffer(1);
    gl.glGenFramebuffers(1, idFramebuffer);
    gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, idFramebuffer.get(0));

    // Checking the framebuffer status
    int framebufferStatus = gl.glCheckFramebufferStatus(idFramebuffer.get(0));
    switch (framebufferStatus) {
        case GL3.GL_FRAMEBUFFER_COMPLETE:
            logger.info("Framebuffer is complete :)");
            break;
        case GL3.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
            logger.error("Incomplete attachment");
            break;
        case GL3.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
            logger.error("Incomplete dimensions");
            break;
        case GL3.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
            logger.error("Incomplete draw buffer");
            break;
        case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
            logger.error("Incomplete layer targets");
            break;
        case GL3.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:
            logger.error("Incomplete read buffer");
            break;
        case GL3.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
            logger.error("Missing attachment");
            break;
        case GL3.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
            logger.error("Incomplete multisample");
            break;
        case GL3.GL_FRAMEBUFFER_UNDEFINED:
            logger.error("Undefined");
            break;
        case GL3.GL_FRAMEBUFFER_UNSUPPORTED:
            logger.error("Not supported");
            break;
        default:
            logger.warn("Unknown framebuffer status (" + framebufferStatus + ")");
    }
    gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0);
    gl.glDeleteFramebuffers(1, idFramebuffer);
}


In my logs, the only result I obtain is "Unknown framebuffer status (1280)".
Do you see anything I could have forgotten / made wrong ?

Thanks in advance for your help Smiley
Offline elect

JGO Knight


Medals: 47



« Reply #1 - Posted 2017-05-16 12:19:09 »

1280 is GL_INVALID_ENUM

from the doc:
Quote
For glCheckFramebufferStatus, the framebuffer checked is that bound to target, which must be GL_DRAW_FRAMEBUFFER, GL_READ_FRAMEBUFFER or GL_FRAMEBUFFER. GL_FRAMEBUFFER is equivalent to GL_DRAW_FRAMEBUFFER.

You are passing instead the fbo id/name and that's why the error
Offline Chennorris

Junior Newbie


Exp: 10 years



« Reply #2 - Posted 2017-05-16 12:33:42 »

Wow, feeling impressed by the speed at which you spotted the point Shocked
I'm gonna think about putting your name in the thanks part of my project (if it's released one day Grin)

Now, I have a Missing attachment error, but it seems far better than this 1280 error code


_____________________
EDIT :

I just un-commented the part where I was creating a texture and attaching it to the framebuffer and now I get the GL_FRAMEBUFFER_COMPLETE.
Thanks a lot Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline elect

JGO Knight


Medals: 47



« Reply #3 - Posted 2017-05-16 13:08:04 »

Wow, feeling impressed by the speed at which you spotted the point Shocked

Got the same error of your somewhere in the past, it took me a while.. and I learnt that
Pages: [1]
  ignore  |  Print  
 
 

 
xxMrPHDxx (12 views)
2017-11-21 16:21:00

xxMrPHDxx (10 views)
2017-11-21 16:14:31

xxMrPHDxx (10 views)
2017-11-21 16:10:57

Ecumene (113 views)
2017-09-30 02:57:34

theagentd (148 views)
2017-09-26 18:23:31

cybrmynd (246 views)
2017-08-02 12:28:51

cybrmynd (242 views)
2017-08-02 12:19:43

cybrmynd (242 views)
2017-08-02 12:18:09

Sralse (257 views)
2017-07-25 17:13:48

Archive (875 views)
2017-04-27 17:45:51
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!