mirror of
https://github.com/fjvallarino/monomer.git
synced 2024-09-11 12:05:35 +03:00
Request RenderOnce in OpenGLWidget example
This commit is contained in:
parent
3f7acc98ed
commit
afc6a56ae7
@ -32,10 +32,12 @@ related tasks.
|
||||
|
||||
In the example the `init` function takes care of loading the vertex and fragment
|
||||
shaders that will be used for rendering, and also for allocating the Vertex
|
||||
Array Object and Vertex Buffer Object. The corresponding ids are stored in the
|
||||
widget's state for further usage. As in other widgets, it is important to
|
||||
implement merge to keep this information when the UI is rebuilt. The `dispose`
|
||||
function releases these OpenGL resources.
|
||||
Array Object and Vertex Buffer Object. The ids of these buffers are stored in
|
||||
the widget's state for further usage, and a `RenderOnce` request is made to make
|
||||
sure the initial version of the widget is displayed correctly. The `dispose`
|
||||
function, also using `RunInRenderThread`, takes care of releasing these OpenGL
|
||||
resources. As in other widgets, it is important to implement merge to keep the
|
||||
current widget state when the UI is rebuilt.
|
||||
|
||||
### Rendering passes
|
||||
|
||||
|
@ -88,10 +88,11 @@ makeOpenGLWidget color state = widget where
|
||||
reqs = [RunInRenderThread widgetId path disposeOpenGL]
|
||||
|
||||
handleMessage wenv node target msg = case cast msg of
|
||||
Just (OpenGLWidgetInit shaderId vao vbo) -> Just (resultNode newNode) where
|
||||
Just (OpenGLWidgetInit shaderId vao vbo) -> Just result where
|
||||
newState = OpenGLWidgetState True shaderId vao vbo
|
||||
newNode = node
|
||||
& L.widget .~ makeOpenGLWidget color newState
|
||||
result = resultReqs newNode [RenderOnce]
|
||||
_ -> Nothing
|
||||
|
||||
getSizeReq wenv node = (sizeReqW, sizeReqH) where
|
||||
|
Loading…
Reference in New Issue
Block a user