Rastar
Topic Author
Posts: 17
Joined: 13 Aug 2014, 08:42

What exactly to store/restore for OpenGL state?

15 Aug 2014, 16:29

Hi,

I am working on an integration of NoesisGUI into the C4 engine. According to your to your integration docs, the GPU state has to be stored/restored before/after calls to Render(). Now, the OpenGL state is quite a beast - is there a more specific list, what exactly has to be stored/restored or invalidates? I know of the wrapper for the Leadwerks engine - is their implementation of OpenGLState::Store() and Restore() the way to go?
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: What exactly to store/restore for OpenGL state?

18 Aug 2014, 11:25

Yes, Store() and Restore() functions written for the wrapper are correct. Although it is not the ideal path. The best way, is having a way to invalidate the state cache to avoid setting all the states to the GPU, but it seems that there is now way to do that in LeadWerks.

By the way, I wonder why you need another integration instead of reusing the existing one. We could improve it if you need it.
 
Rastar
Topic Author
Posts: 17
Joined: 13 Aug 2014, 08:42

Re: What exactly to store/restore for OpenGL state?

18 Aug 2014, 13:30

By the way, I wonder why you need another integration instead of reusing the existing one. We could improve it if you need it.
You mean another integration into Leadwerks? No, I'm itegrating this into the C4 Engine. Or is there an integration for that already?
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: What exactly to store/restore for OpenGL state?

18 Aug 2014, 14:45

No, sorry for the confusion. C4 engine, ok. Let me help with any trouble you find.
 
Rastar
Topic Author
Posts: 17
Joined: 13 Aug 2014, 08:42

Re: What exactly to store/restore for OpenGL state?

18 Aug 2014, 15:03

What function calls are you thinking of for invalidating the state cache? I am not really an OpenGL guru, and the only functions for invalidating something are for framebuffers. But I don't know if there is a function call for invalidating the state cache as a whole or even parameter by parameter. Is there?
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: What exactly to store/restore for OpenGL state?

18 Aug 2014, 15:10

The cache invalidation functionality must be provided by the engine itself, C4 in this case. Engines usually have a cache of states to avoid redundant calls. If there is no way to do that in C4, then you have to follow the LeadWerks way.
 
Rastar
Topic Author
Posts: 17
Joined: 13 Aug 2014, 08:42

Re: What exactly to store/restore for OpenGL state?

18 Aug 2014, 18:19

OK. However, it seems I am currently stuck - I get exception during the initialization phase (invalid GLenums e.g.), probably because I am using 1.1.0 which isn't conpatible with OpenGL3+ ?

Will the OSX version of 1.2beta be out soon?
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: What exactly to store/restore for OpenGL state?

18 Aug 2014, 18:29

Yes, you need v1.2. The windows version can be already downloaded. Could you test on Windows?

If you need OSX, please tell me and I will contact you in private with an internal version.
 
Rastar
Topic Author
Posts: 17
Joined: 13 Aug 2014, 08:42

Re: What exactly to store/restore for OpenGL state?

18 Aug 2014, 19:13

Ok, I'll test on Windows, and if the initialization works there wirh C4 I'll PM you for the OSX version.

One further question: The Leadwerks wrapper creates its own framebuffer - is that necessary? What for? Do I have to do any render-to-texture stuff?
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: What exactly to store/restore for OpenGL state?

18 Aug 2014, 19:47

You don't need a new framebuffer is you are rendering to the screen. LeadWerks wrapper is creating a new FrameBuffer when rendering to a texture. This functionality is optional.

You can use the same framebuffer bound by C4 when rendering with NoesisGUI, but, very important, make sure that there is Stencil active in that framebuffer.

Who is online

Users browsing this forum: No registered users and 0 guests