On 7/04/2015 10:07 a.m., ddos wrote:
Hi!

i'm trying to get devisualization/window [1] working with some simple
opengl calls. I have created a windows with opengl context using

Window window = new Window(800, 600, "My window!"w,
WindowContextType.Opengl);

If i run
writeln("type: ", context.type);
writeln("toolkit version: ", context.toolkitVersion);
writeln("shading language version: ", context.shadingLanguageVersion);
i get correct information
has context
type: Opengl
toolkit version: 4.5.0 NVIDIA 347.09
shading language version: 4.50 NVIDIA

First i tried to simply call glClearColor(1,0,0,1);, this crashes the
application (Program exited with code -1073741819)

I checked the function pointer with if(cast(void*)glClearColor !is
null){...} and well ... it's a nullpointer the first two frames. Then i
checked for nullpointer and called glClearColor(...) and glClear(...) ->
no crash but the window was just frozen.

Does anyone use Devisualization/window on Windows with success?
Fyi, if i dont do any opengl calls the window seems to work, i can close
it normally, it's completely white.

My example sourcecode can be found here:
https://github.com/oggs91/OpenVG_D/blob/master/demo_DvisualizationWT/source/app.d



[1] https://github.com/Devisualization/window

1) You need to check that the context has been created
        window.addOnDraw((Windowable window2) {
                IContext context = window.context;
                if (context !is null) {
2) The context needs to be activated
        bool hitContext;
        while(true) {
                import core.thread : Thread;
                import core.time : dur;
                Window.messageLoopIteration();

                IContext context = window.context;
                if (window.hasBeenClosed)
                        break;
                else if (context !is null) {
                        if (!hitContext) {
                                context.activate;
                                // init opengl stuff
                                hitContext = true;
                        }

                        window.onDraw;
                }
                Thread.sleep(dur!"msecs"(25));
        }
2 handles 1 already, so you don't need to add 1 only 2.

Reply via email to