Rendering not working with GL3 or 4

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Rendering not working with GL3 or 4

The Typhothanian
I have a weird issue. I've used JOGL before for a game, but it isn't working this time. I have a GLJPanel as the content pane of my JFrame, and am trying to render with vertex objects. With a GL2 it works fine. However, I need GL4 for bindless textures, and upgrading to version 3 or 4 causes errors.

The clear color is working, but whatever I'm trying to draw works fine for one frame then disappears. I think this is because I'm not unbinding the vao at the end of the frame, but when I unbind it, I get GL_INVALID_OPERATION on all following frames. Has this sort of thing ever happened before? Here's a reddit post with my code (explanation is a bit outdated)
Reply | Threaded
Open this post in threaded view
|

Re: Rendering not working with GL3 or 4

gouessej
Administrator
Hello

I advise you to compare your source code with this working example:
https://jogamp.org/cgit/jogl-demos.git/tree/src/demos/es2/RawGL2ES2demo.java?id=HEAD
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Rendering not working with GL3 or 4

The Typhothanian
Yeah, I did that. Figured out the problem is that the vertex attrib pointer gets deleted or something? Calling it again before rendering fixes the issue. Right now the first frame renders fine, then on the second frame the cube I'm rendering turns into a right triangle. Shader's fine. However, this shouldn't have to be the case. Why would I have to redo the VAP?
Reply | Threaded
Open this post in threaded view
|

Re: Rendering not working with GL3 or 4

gouessej
Administrator
You don't have to redo the VAO but you have to rebind it. What's wrong with that?

P.S: Actually, you can create the VBO and the VAO once for all and reuse it many times. It's not obvious in the example, sorry.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Rendering not working with GL3 or 4

The Typhothanian
I didn't say VAO, I said Vertex Attrib Pointer. Also, I grabbed the example, moved it to GL4, plugged in my cube vertices, and it only renders a single triangle of the cube. I made sure the colors were updated.
Reply | Threaded
Open this post in threaded view
|

Re: Rendering not working with GL3 or 4

The Typhothanian
Wait, sorry, that's incorrect. I grabbed the demo you sent me, plugged in my cube vertices, updated the colors and vertex count, and it rendered the cube fine. I updated it to GL4 (replace all instances of GL2ES2 or GL2 with GL4), and now it broke and is only rendering a single triangle, just like it is in my game. Consistent across both of my computers, with completely different manufacturers.
Reply | Threaded
Open this post in threaded view
|

Re: Rendering not working with GL3 or 4

gouessej
Administrator
This post was updated on .
It's strange, can you show a diff of your example before and after the switch to GL4?

P.S: As GL4 extends the interface GL2ES2, you don't really need to replace GL2ES2 except to get a GLProfile.
Julien Gouesse | Personal blog | Website