Jump to page: 1 2 3
Thread overview
Anyone using glad?
Jan 10, 2016
Jason Jeffory
Jan 10, 2016
Dav1d
Jan 10, 2016
Jason Jeffory
Jan 10, 2016
Dav1d
Jan 11, 2016
Jason Jeffory
Jan 11, 2016
Jason Jeffory
Jan 11, 2016
Dav1d
Jan 11, 2016
Jason Jeffory
Jan 11, 2016
Dav1d
Jan 12, 2016
Jason Jeffory
Jan 12, 2016
Dav1d
Jan 13, 2016
Jason Jeffory
Jan 13, 2016
Dav1d
Jan 13, 2016
Jason Jeffory
Jan 13, 2016
Dav1d
Jan 13, 2016
Jason Jeffory
Jan 13, 2016
Jason Jeffory
Jan 13, 2016
Dav1d
Jan 13, 2016
Jason Jeffory
Jan 13, 2016
Dav1d
Jan 13, 2016
Mike Parker
Jan 11, 2016
Dav1d
Jan 12, 2016
ParticlePeter
Jan 10, 2016
rsw0x
January 10, 2016
Seems like it is a very nice way to get into openGL from D.

http://glad.dav1d.de/

I generated the bindings for all the latest versions of the various specifications.
Does anyone have any tutorials that use this library effectively?

There's this

https://github.com/Dav1dde/glamour

But not sure what it is(diff between it and glad). Says it's a wrapper to OpenGL... but does it use the glad generated bindings?

It looks like I'd prefer this to derelict because it seems like it is a automatically generated binding... which means future extensibility and no "extra" stuff.

Would be nice if it works with dub. How could I use it easily with dub as a local library? (create a dependency from a local file location)

Thanks.



January 10, 2016
On Sunday, 10 January 2016 at 21:30:32 UTC, Jason Jeffory wrote:
> Seems like it is a very nice way to get into openGL from D.
>
> http://glad.dav1d.de/
>
> I generated the bindings for all the latest versions of the various specifications.
> Does anyone have any tutorials that use this library effectively?
>
> There's this
>
> https://github.com/Dav1dde/glamour
>
> But not sure what it is(diff between it and glad). Says it's a wrapper to OpenGL... but does it use the glad generated bindings?
>
> It looks like I'd prefer this to derelict because it seems like it is a automatically generated binding... which means future extensibility and no "extra" stuff.
>
> Would be nice if it works with dub. How could I use it easily with dub as a local library? (create a dependency from a local file location)
>
> Thanks.

Hey,

I am the guy behind glad, you are most likely looking for: https://github.com/Dav1dde/glad#d
Instead of downloading the glad sources and installing Python you can use the website http://glad.dav1d.de/
(If I have time I will write more documentation and also have it on the website)

glad is just another way to load your OpenGL functions (kinda like Derelict does it), the main difference is, it exactly allows you to generate the feature set you need, if you're in doubt, you can also just generate everything.

Another difference is, it uses the official XML-Specification files, so it is always up to date and doesn't need to be maintained. This also means it can can generate files for EGL/GLES/WGL and GLX.

Glad itself is a library which happens to include a D generator 'backend', that allows you to extend it and make a more advanced loader (e.g. introduce another layer and automatically check glGetError, see C/C++ Debug), but for your normal use the included generator is good enough.

Usage:

Basically you download the zip, add the source files to your project and build system and call gladLoadGL() (check the return value, `enforce(gladLoadGL())`) after creating a context. This will use the internal loader, if you use glfw you can pass glfwGetProcAddress to gladLoadGL(), if you use SDL you can use SDL_GL_GetProcAddress: `gladLoadGL(x => glfwGetProcAddress(x))`.

Then you can just go ahead and call the imported gl functions.

Why no dub?:

Well why would you want to use dub? Just generate the files and copy them into your source.

----

I also wrote glamour, glamour is just a library which abstracts the the OpenGL API and has some glue code for gl3n (maths), SDL (texture loading), glad/Derelict (for gl).
January 10, 2016
On Sunday, 10 January 2016 at 21:53:45 UTC, Dav1d wrote:
> On Sunday, 10 January 2016 at 21:30:32 UTC, Jason Jeffory wrote:
>> Seems like it is a very nice way to get into openGL from D.
>>
>> http://glad.dav1d.de/
>>
>> I generated the bindings for all the latest versions of the various specifications.
>> Does anyone have any tutorials that use this library effectively?
>>
>> There's this
>>
>> https://github.com/Dav1dde/glamour
>>
>> But not sure what it is(diff between it and glad). Says it's a wrapper to OpenGL... but does it use the glad generated bindings?
>>
>> It looks like I'd prefer this to derelict because it seems like it is a automatically generated binding... which means future extensibility and no "extra" stuff.
>>
>> Would be nice if it works with dub. How could I use it easily with dub as a local library? (create a dependency from a local file location)
>>
>> Thanks.
>
> Hey,
>
> I am the guy behind glad, you are most likely looking for: https://github.com/Dav1dde/glad#d
> Instead of downloading the glad sources and installing Python you can use the website http://glad.dav1d.de/
> (If I have time I will write more documentation and also have it on the website)
>
> glad is just another way to load your OpenGL functions (kinda like Derelict does it), the main difference is, it exactly allows you to generate the feature set you need, if you're in doubt, you can also just generate everything.
>
> Another difference is, it uses the official XML-Specification files, so it is always up to date and doesn't need to be maintained. This also means it can can generate files for EGL/GLES/WGL and GLX.
>
> Glad itself is a library which happens to include a D generator 'backend', that allows you to extend it and make a more advanced loader (e.g. introduce another layer and automatically check glGetError, see C/C++ Debug), but for your normal use the included generator is good enough.
>
> Usage:
>
> Basically you download the zip, add the source files to your project and build system and call gladLoadGL() (check the return value, `enforce(gladLoadGL())`) after creating a context. This will use the internal loader, if you use glfw you can pass glfwGetProcAddress to gladLoadGL(), if you use SDL you can use SDL_GL_GetProcAddress: `gladLoadGL(x => glfwGetProcAddress(x))`.
>
> Then you can just go ahead and call the imported gl functions.
>
> Why no dub?:
>
> Well why would you want to use dub? Just generate the files and copy them into your source.
>
> ----
>
> I also wrote glamour, glamour is just a library which abstracts the the OpenGL API and has some glue code for gl3n (maths), SDL (texture loading), glad/Derelict (for gl).


Cool, it looks really well done. I spend several hours researching and looking at various approaches. It was basically Derelict stuff or a lot of things that didn't look well done. I was wishing there was something that would automatically do it(looked into htod, swift, etc)... then I stumbled across your work!!! Was exactly what I wanted!

glfw is separate or have you done something with it(is it wgl?)?

I'm basically trying to get a minimal setup running on winx64. I don't want a lot of hassle that other "solutions" seem to have(no derelict, sdl, etc...). I know there has to be some windows stuff(glfw) haven't yet found a solution for it(haven't really looked yet).

January 10, 2016
On Sunday, 10 January 2016 at 21:30:32 UTC, Jason Jeffory wrote:
> Seems like it is a very nice way to get into openGL from D.
>
> http://glad.dav1d.de/
>
> I generated the bindings for all the latest versions of the various specifications.
> Does anyone have any tutorials that use this library effectively?
>
> There's this
>
> https://github.com/Dav1dde/glamour
>
> But not sure what it is(diff between it and glad). Says it's a wrapper to OpenGL... but does it use the glad generated bindings?
>
> It looks like I'd prefer this to derelict because it seems like it is a automatically generated binding... which means future extensibility and no "extra" stuff.
>
> Would be nice if it works with dub. How could I use it easily with dub as a local library? (create a dependency from a local file location)
>
> Thanks.

I preferred glad over derelict when I did some opengl work with D because it was easier to just include only the functions I wanted. Derelict made much bigger binaries, not sure how much in part that was to the whole kitchen sink approach or the derelict utility itself.

However, both are great and work fine. Their analogues in C/C++ would be function pointer loaders like glew for derelict or opengl binding generators like glLoadGen(and glad, it's multi-language — I actually preferred it for C++ too) for glad.
Bye.
January 10, 2016
On Sunday, 10 January 2016 at 22:37:28 UTC, Jason Jeffory wrote:
> On Sunday, 10 January 2016 at 21:53:45 UTC, Dav1d wrote:
>> On Sunday, 10 January 2016 at 21:30:32 UTC, Jason Jeffory wrote:
>>> [...]
>>
>> Hey,
>>
>> I am the guy behind glad, you are most likely looking for: https://github.com/Dav1dde/glad#d
>> Instead of downloading the glad sources and installing Python you can use the website http://glad.dav1d.de/
>> (If I have time I will write more documentation and also have it on the website)
>>
>> glad is just another way to load your OpenGL functions (kinda like Derelict does it), the main difference is, it exactly allows you to generate the feature set you need, if you're in doubt, you can also just generate everything.
>>
>> Another difference is, it uses the official XML-Specification files, so it is always up to date and doesn't need to be maintained. This also means it can can generate files for EGL/GLES/WGL and GLX.
>>
>> Glad itself is a library which happens to include a D generator 'backend', that allows you to extend it and make a more advanced loader (e.g. introduce another layer and automatically check glGetError, see C/C++ Debug), but for your normal use the included generator is good enough.
>>
>> Usage:
>>
>> Basically you download the zip, add the source files to your project and build system and call gladLoadGL() (check the return value, `enforce(gladLoadGL())`) after creating a context. This will use the internal loader, if you use glfw you can pass glfwGetProcAddress to gladLoadGL(), if you use SDL you can use SDL_GL_GetProcAddress: `gladLoadGL(x => glfwGetProcAddress(x))`.
>>
>> Then you can just go ahead and call the imported gl functions.
>>
>> Why no dub?:
>>
>> Well why would you want to use dub? Just generate the files and copy them into your source.
>>
>> ----
>>
>> I also wrote glamour, glamour is just a library which abstracts the the OpenGL API and has some glue code for gl3n (maths), SDL (texture loading), glad/Derelict (for gl).
>
>
> Cool, it looks really well done. I spend several hours researching and looking at various approaches. It was basically Derelict stuff or a lot of things that didn't look well done. I was wishing there was something that would automatically do it(looked into htod, swift, etc)... then I stumbled across your work!!! Was exactly what I wanted!
>
> glfw is separate or have you done something with it(is it wgl?)?
>
> I'm basically trying to get a minimal setup running on winx64. I don't want a lot of hassle that other "solutions" seem to have(no derelict, sdl, etc...). I know there has to be some windows stuff(glfw) haven't yet found a solution for it(haven't really looked yet).

I would recommend using glfw for a context/window, there is a binding in Deimos https://github.com/D-Programming-Deimos/glfw - You need to either compile it yourself or just download the pre compiled package from the website and get the .lib file (http://www.glfw.org/).

There is also an abstraction I wrote once: https://github.com/Dav1dde/glwtf not sure if it still works, it *should*.
But even without the abstraction, getting a window and context up with glfw is really easy (documentation is really good! http://www.glfw.org/documentation.html). There is also a C++ example using glad: https://github.com/Dav1dde/glad/blob/master/example/c%2B%2B/hellowindow2.cpp which can easily be ported to D.

Basically all you need is glfw and glad to get started!
January 11, 2016
On Sunday, 10 January 2016 at 23:14:33 UTC, Dav1d wrote:
> On Sunday, 10 January 2016 at 22:37:28 UTC, Jason Jeffory wrote:
>> [...]
>
> I would recommend using glfw for a context/window, there is a binding in Deimos https://github.com/D-Programming-Deimos/glfw - You need to either compile it yourself or just download the pre compiled package from the website and get the .lib file (http://www.glfw.org/).
>
> There is also an abstraction I wrote once: https://github.com/Dav1dde/glwtf not sure if it still works, it *should*.
> But even without the abstraction, getting a window and context up with glfw is really easy (documentation is really good! http://www.glfw.org/documentation.html). There is also a C++ example using glad: https://github.com/Dav1dde/glad/blob/master/example/c%2B%2B/hellowindow2.cpp which can easily be ported to D.
>
> Basically all you need is glfw and glad to get started!

OK, I'll give it a try. What about GLUT and WGL? Whats the difference between them all and glfw? Are all these just OS helpers to reduce the boilerplate code?

Also, how hard would it be to support cgl? (mac bindings)

Thanks!
January 11, 2016
Ok. So I tried it out and having some issues ;/ got it basically to compile but 2 problems:


1. I have to get dub to include the lib, not a big deal, shouldn't be issue if I can get the right lib in. (not sure if I have to do all that conversion just or not, and glfw has several libs for different VS versions and such... not sure what that's all about).

2. I had to commend out the following code dealing with the keyboard callback:

	// Set the required callback functions
	//glfwSetKeyCallback(window, &key_callback);

gives the error

function app.key_callback (GLFWwindow* window, int key, int scancode, int action, int mode) is not callable using argument types ()

I tried with and without address passing. I can cast though

glfwSetKeyCallback(window, cast(GLFWkeyfun)&key_callback);

works(no errors, at least), and if that's correct, leaves only the lib issue.



alternate thing I tried but gladLoadGL undefined
	//(gladLoadGL()); // optionally you can pass a loader to this function
	//writefln("OpenGL Version %d.%d loaded", GLVersion.major, GLVersion.minor);





import std.stdio;

import glad.gl.all;
import deimos.glfw.glfw3;



// Window dimensions
const GLuint WIDTH = 800, HEIGHT = 600;

void main()
{

	glfwInit();
	// Set all the required options for GLFW
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
	glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);

	// Create a GLFWwindow object that we can use for GLFW's functions
	GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "LearnOpenGL", null, null);
	glfwMakeContextCurrent(window);
	if (window == null)
	{
		writeln("Failed to create GLFW window");
		glfwTerminate();
		return;
	}
	
	// Set the required callback functions
	//glfwSetKeyCallback(window, &key_callback);

	//(gladLoadGL()); // optionally you can pass a loader to this function
	//writefln("OpenGL Version %d.%d loaded", GLVersion.major, GLVersion.minor);

	/*
	if (!gladLoadGLLoader(cast(GLADloadproc) glfwGetProcAddress))
	{
		writeln("Failed to initialize OpenGL context");
		return;
	}*/
	
	// Define the viewport dimensions
	glViewport(0, 0, WIDTH, HEIGHT);
	
	// Game loop
	while (!glfwWindowShouldClose(window))
	{
		// Check if any events have been activated (key pressed, mouse moved etc.) and call corresponding response functions
		glfwPollEvents();
		
		// Render
		// Clear the colorbuffer
		glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
		glClear(GL_COLOR_BUFFER_BIT);
		
		// Swap the screen buffers
		glfwSwapBuffers(window);
	}
	
	// Terminates GLFW, clearing any resources allocated by GLFW.
	glfwTerminate();
	return;
}


// Is called whenever a key is pressed/released via GLFW
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)
{
	writeln(key);
	if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
		glfwSetWindowShouldClose(window, GL_TRUE);
}
January 11, 2016
On Monday, 11 January 2016 at 00:46:38 UTC, Jason Jeffory wrote:
> On Sunday, 10 January 2016 at 23:14:33 UTC, Dav1d wrote:
>> [...]
>
> OK, I'll give it a try. What about GLUT and WGL? Whats the difference between them all and glfw? Are all these just OS helpers to reduce the boilerplate code?
>
> Also, how hard would it be to support cgl? (mac bindings)
>
> Thanks!

GLUT ist dead and WGL is the windows API which you could use but is relativly low level. glfw is a cross platform toolkit (kinda like GLUT) which takes care of WGL (and other platforms) and gives you a nice API.
January 11, 2016
On Monday, 11 January 2016 at 01:46:11 UTC, Jason Jeffory wrote:
> Ok. So I tried it out and having some issues ;/ got it basically to compile but 2 problems:
>
>
> 1. I have to get dub to include the lib, not a big deal, shouldn't be issue if I can get the right lib in. (not sure if I have to do all that conversion just or not, and glfw has several libs for different VS versions and such... not sure what that's all about).

I don't remember what lib you need, there were some linking issues on windows iirc, if it doesn't work using Derelict for glfw might be easier (another possible issue: the deimos bindings are outdated).



> alternate thing I tried but gladLoadGL undefined
> 	//(gladLoadGL()); // optionally you can pass a loader to this function
> 	//writefln("OpenGL Version %d.%d loaded", GLVersion.major, GLVersion.minor);
>

gladLoadGLLoader does not exist in the D version, the D thing would be gladLoadGL(myLoaderHere), this function takes a delegate not a function as argument!

January 11, 2016
On Monday, 11 January 2016 at 10:01:11 UTC, Dav1d wrote:
> On Monday, 11 January 2016 at 01:46:11 UTC, Jason Jeffory wrote:
>> Ok. So I tried it out and having some issues ;/ got it basically to compile but 2 problems:
>>
>>
>> 1. I have to get dub to include the lib, not a big deal, shouldn't be issue if I can get the right lib in. (not sure if I have to do all that conversion just or not, and glfw has several libs for different VS versions and such... not sure what that's all about).
>
> I don't remember what lib you need, there were some linking issues on windows iirc, if it doesn't work using Derelict for glfw might be easier (another possible issue: the deimos bindings are outdated).
>
>
>
>> alternate thing I tried but gladLoadGL undefined
>> 	//(gladLoadGL()); // optionally you can pass a loader to this function
>> 	//writefln("OpenGL Version %d.%d loaded", GLVersion.major, GLVersion.minor);
>>
>
> gladLoadGLLoader does not exist in the D version, the D thing would be gladLoadGL(myLoaderHere), this function takes a delegate not a function as argument!

but as I said,

source\app.d(35,3): Error: undefined identifier 'gladLoadGL'
source\app.d(36,42): Error: undefined identifier 'GLVersion'
source\app.d(36,59): Error: undefined identifier 'GLVersion'
dmd failed with exit code 1.

I'm using deimos, but is that a glad function or some other function supposedly by deimos?



« First   ‹ Prev
1 2 3