October 06, 2016 Re: Getting GtkD working with OpenGL | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chalix | On 10/06/2016 05:18 PM, Chalix wrote: > On Thursday, 6 October 2016 at 13:35:01 UTC, Mike Parker wrote: >> So, change DerelictGL3.load to DerelictGL.load, then add a call to >> DerelictGL.reload after creating and activating the context. > > Thank you! That fixed the segmentation fault problem and the crash :) > > But I still struggle with the right Context... > > if I do something like this > > DerelictGL.load(); > area.makeCurrent(); > DerelictGL.reload(); > > I get an (runtime) error (on the terminal where I run my application): > > (LibraryTest:2984): Gtk-CRITICAL **: gtk_gl_area_make_current: assertion > 'gtk_widget_get_realized (widget)' failed > derelict.util.exception.DerelictException@gl3.d(85): DerelictGL3.reload > failure: An OpenGL context is not currently active. > [...] > > > After all, I really don't know, what a GLContext is, what I need it for > and how to use it. If somebody can explain it to me, I would be happy! I > didn't find anything about it on the Internet, but I like to know, whats > going on behind my code... > > I will keep on playing around with all the context functions, maybe I > find something by accident that works xD > When you don't register an callback for the createContext signal (addOnCreateContext), gtk does the following internally: ``` context = area.getWindow().createGlContext(); ``` to get an context that renders to the GLArea. gdk.GLContext is an platform independent abstraction for the context you would normally use with openGL. like the one's returned by wglCreateContext or glxCreateContext. makeCurrent() sets that context as the one that is rendered to. realize() i think makes sure the context is initialized, but makeCurrent() also calls realize, so makeCurrent is probably the one you want to use. -- Mike Wey |
Copyright © 1999-2021 by the D Language Foundation