Thread overview
Troubles with devisualization/window
Apr 06, 2015
ddos
Apr 06, 2015
Rikki Cattermole
Apr 06, 2015
ddos
Apr 06, 2015
Rikki Cattermole
Apr 07, 2015
ddos
Apr 07, 2015
Rikki Cattermole
April 06, 2015
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
April 06, 2015
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.
April 06, 2015
it's getting warmer, window doesnt freeze anymore and opengl calls don't crash the window, but it's still all white after calling
glClearColor(1,0,1,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

updated src: https://github.com/oggs91/OpenVG_D/blob/master/demo_DvisualizationWT/source/app.d
April 06, 2015
On 7/04/2015 10:34 a.m., ddos wrote:
> it's getting warmer, window doesnt freeze anymore and opengl calls don't
> crash the window, but it's still all white after calling
> glClearColor(1,0,1,1);
> glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
>
> updated src:
> https://github.com/oggs91/OpenVG_D/blob/master/demo_DvisualizationWT/source/app.d

Ohhh right, call swapBuffers on the context after drawing. Probably be in the run loop (while).

April 07, 2015
On Monday, 6 April 2015 at 22:56:15 UTC, Rikki Cattermole wrote:
> On 7/04/2015 10:34 a.m., ddos wrote:
>> it's getting warmer, window doesnt freeze anymore and opengl calls don't
>> crash the window, but it's still all white after calling
>> glClearColor(1,0,1,1);
>> glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
>>
>> updated src:
>> https://github.com/oggs91/OpenVG_D/blob/master/demo_DvisualizationWT/source/app.d
>
> Ohhh right, call swapBuffers on the context after drawing. Probably be in the run loop (while).

thanks a lot, problems fixed now, i've missing your test example :) if anyone else has problems -> this works https://github.com/Devisualization/window/blob/master/test/main.d

to get the vector graphics working i had to make a small change in the pixelformatdescriptor
https://github.com/Devisualization/window/blob/master/platforms/win32/devisualization/window/context/opengl.d
PIXELFORMATDESCRIPTOR, changed stencil buffer bits from 0 to 8
you may want to change this to default 8 to avoid problems.

http://imgur.com/ME4b6ZO
April 07, 2015
On 7/04/2015 12:10 p.m., ddos wrote:
> On Monday, 6 April 2015 at 22:56:15 UTC, Rikki Cattermole wrote:
>> On 7/04/2015 10:34 a.m., ddos wrote:
>>> it's getting warmer, window doesnt freeze anymore and opengl calls don't
>>> crash the window, but it's still all white after calling
>>> glClearColor(1,0,1,1);
>>> glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
>>>
>>> updated src:
>>> https://github.com/oggs91/OpenVG_D/blob/master/demo_DvisualizationWT/source/app.d
>>>
>>
>> Ohhh right, call swapBuffers on the context after drawing. Probably be
>> in the run loop (while).
>
> thanks a lot, problems fixed now, i've missing your test example :) if
> anyone else has problems -> this works
> https://github.com/Devisualization/window/blob/master/test/main.d
>
> to get the vector graphics working i had to make a small change in the
> pixelformatdescriptor
> https://github.com/Devisualization/window/blob/master/platforms/win32/devisualization/window/context/opengl.d
>
> PIXELFORMATDESCRIPTOR, changed stencil buffer bits from 0 to 8
> you may want to change this to default 8 to avoid problems.
>
> http://imgur.com/ME4b6ZO

Tagged v0.1.1