Hello Carsten,
On 03.03.2014 19:25, Carsten Neumann wrote: > > hmm, what do you mean by "the buffer is provided from outside"? I > would have thought UniformBufferObjectChunk contains an MFUChar8 that > is used as an array of bytes as the OpenSG side copy of the buffer? > I wanted to say the user is responsible for buffer layout setup according to std140 and that he provides this buffer to the chunk. The chunk takes the buffer. So, basically, I think we mean the same. >> b) update time >> glBindBuffer(GL_UNIFORM_BUFFER, _ubo_id); >> GLubyte* pBuffer = static_cast<GLubyte*>( >> glMapBuffer(GL_UNIFORM_BUFFER, GL_WRITE_ONLY)); >> >> // overwrite pBuffer by buffer content with memcpy... >> >> glUnmapBuffer(GL_UNIFORM_BUFFER); >> glBindBuffer(GL_UNIFORM_BUFFER, 0); > > ok, just to be sure: this is meant to happen when OpenSG detects that > it needs to update the contents of the UBO? Yes > Since OpenSG in general > assumes that there is no OpenGL context active in an application > thread there is a mechanism for this kind of update of a GL object - > you could take a look at what happens for textures, since the case > here seems quite analogous: some application memory (image/buffer > content) changes and needs to be transferred to GL. Good hint... >> c) is desirable > > Sure, after all there is at least your use case, so that seems like > something useful to have ;) > My vision is to switch completely to core OpenGL 3/4 in the long term. In order to efficiently describe state IMHO uniform buffers/blocks are unavoidable. Additionally, I would like to provide material state via a material database represented by an UBO array and to draw my geometry instanced with a vertex attribute indexing into the array. This way I hope to overcome the performance bottle neck I'm currently facing. > > Ok. It would be easiest to have an idea what your concrete questions > are, ... Ok, here are the first questions I have: - With respect to the extension mechanism i) Could you give me some overall explanation of the route OpenSG is taking? ii) What is the correct way to address symbols? With 'ARB' or 'EXT' or directly? iii) The OpenGL symbols like GL_UNIFORM_BUFFER etc. are not known by OpenSG. At least not in the naive approach starting with #include "OSGGL.h" #include "OSGGLU.h" #include "OSGGLEXT.h" #include "OSGGLFuncProtos.h" However, I found them in glextarb.h, glcorearb.h and gl3.h. I expect that I have to expand "OSGGLEXT.h" for getting proper symbols. Is that correct? From what place do I have to take the symbols declaration then? iv) The function names like glMapBuffer are also unknown with the simple setup. After looking at the code I suspect that I have to write something like the following; _extVertexBufferObject= Window::registerExtension("GL_ARB_vertex_buffer_object"); _funcUnmapBuffer = Window::registerFunction( OSG_DLSYM_UNDERSCORE"glMapBufferARB", _extVertexBufferObject); OSGGETGLFUNCBYID_GL3_ES( glMapBuffer, osgGlMapBuffer, _funcMapBuffer, pWin); Is that correct? Is there a simpler way of doing things? Do I have also to expand "OSGGLFuncProtos.h"? v) Could you briefly outline the steps you perform when introducing new extensions? Is there any tool support or do you modify the "OSGGLEXT.h" and "OSGGLFuncProtos.h" by hand? vi) Why does OpenSG not use glew? - with respect to the handleGL calls: Am I correct with the following order of things? The Chunk::changed() evaluates the bitmask and any other relevant information, and signals the task to be happen to the delayed Chunk::handleGL() execution by calls to the Window::reinitializeGLObject(), ... functions and that these correspond to the mode enumerations notused = 0x0001, /**< Object is not used at all right now. */ initialize = 0x0002, /**< Object is being initialized for the first time. */ reinitialize = 0x0003, /**< Object is being re-initialized (ie. significant change) */ initialized = 0x0004, /**< Object is initialized and valid. */ needrefresh = 0x0005, /**< Object is initialized but needs a refresh. */ destroy = 0x0006, /**< Object is to be destroyed (removed from context) */ finaldestroy = 0x0007 /**< Object has been removed from contexts, now release resources. */ taken by the Chunk::handleGL() method. That are the current questions at hand. Thank you for taking your time to give me advise. Best, Johannes ------------------------------------------------------------------------------ Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users