www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D for game Development

reply "RedShift" <cmpons gmail.com> writes:
Can I use OpenGL or DirectX with D? If so, where can I find a 
guide to get everything setup?
Feb 14 2012
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-02-15 07:51, RedShift wrote:
 Can I use OpenGL or DirectX with D? If so, where can I find a guide to
 get everything setup?
Derelict contains bindings to OpenGL and various other game and media related libraries: http://www.dsource.org/projects/derelict -- /Jacob Carlborg
Feb 15 2012
prev sibling next sibling parent "MattCodr" <matheus_nab hotmail.com> writes:
On Wednesday, 15 February 2012 at 06:51:11 UTC, RedShift wrote:
 Can I use OpenGL or DirectX with D? If so, where can I find a 
 guide to get everything setup?
I'm writing a tutorial explaining how to set everything with game example included! I don't like to predict dates, but I'll release it pretty soon.
Feb 15 2012
prev sibling next sibling parent reply "Kiith-Sa" <42 theanswer.com> writes:
On Wednesday, 15 February 2012 at 06:51:11 UTC, RedShift wrote:
 Can I use OpenGL or DirectX with D? If so, where can I find a 
 guide to get everything setup?
Derelict provides bindings for OpenGL and SDL (and many other game-related libraries) - these are used exactly the same way they are used in C/C++, so any OpenGL/SDL tutorials for C/C++ apply. Derelict has a few of its own functions that can/need to be called when initializing, described in its documentation. The current stable version of Derelict supports only OpenGL up to 2.1 and SDL 1.2, but support for OpenGL 3.0+ and SDL2 is being worked on. For the current development version, see https://github.com/aldacron/Derelict3 (Derelict moved to GitHub recently)
Feb 15 2012
next sibling parent reply Mike Parker <aldacron gmail.com> writes:
On 2/16/2012 12:41 AM, Kiith-Sa wrote:
 On Wednesday, 15 February 2012 at 06:51:11 UTC, RedShift wrote:
 Can I use OpenGL or DirectX with D? If so, where can I find a guide to
 get everything setup?
Derelict provides bindings for OpenGL and SDL (and many other game-related libraries) - these are used exactly the same way they are used in C/C++, so any OpenGL/SDL tutorials for C/C++ apply. Derelict has a few of its own functions that can/need to be called when initializing, described in its documentation. The current stable version of Derelict supports only OpenGL up to 2.1 and SDL 1.2, but support for OpenGL 3.0+ and SDL2 is being worked on.
To clarify, Derelict 2 fully supports up to OpenGL 3.3. 4.x support is partial (but will be fully implemented very soon). Derelict 3 supports all versions of OpenGL, minus features deprecated in 3.x (i.e. core OpenGL profiles only).
 For the current development version, see

 https://github.com/aldacron/Derelict3

 (Derelict moved to GitHub recently)
Feb 15 2012
parent reply "Kiith-Sa" <42 theanswer.com> writes:
 To clarify, Derelict 2 fully supports up to OpenGL 3.3. 4.x 
 support is partial (but will be fully implemented very soon). 
 Derelict 3 supports all versions of OpenGL, minus features 
 deprecated in 3.x (i.e. core OpenGL profiles only).
Does that mean it is not possible to use old OpenGL 2.x style code with Derelict3? I'm planning to move to a GL3 video backend for my project, but I still expect to support GL2 for platforms where GL3 is not supported - e.g. Linux with open source drivers (although those should be getting basic GL 3.0 support this year) I can understand if old GL is too much effort to support, though - in the worst case, I can use Derelict2 based code for a few more years.
Feb 15 2012
parent Mike Parker <aldacron gmail.com> writes:
On 2/16/2012 1:23 AM, Kiith-Sa wrote:
 To clarify, Derelict 2 fully supports up to OpenGL 3.3. 4.x support is
 partial (but will be fully implemented very soon). Derelict 3 supports
 all versions of OpenGL, minus features deprecated in 3.x (i.e. core
 OpenGL profiles only).
Does that mean it is not possible to use old OpenGL 2.x style code with Derelict3? I'm planning to move to a GL3 video backend for my project, but I still expect to support GL2 for platforms where GL3 is not supported - e.g. Linux with open source drivers (although those should be getting basic GL 3.0 support this year) I can understand if old GL is too much effort to support, though - in the worst case, I can use Derelict2 based code for a few more years.
If you aren't using any deprecated features, you'll be fine with DerelictGL3. However, I realize that there will be a number of people who aren't ready to fully migrate to 3.x and may need to continue using deprecated features for a while. So I will be making a package that supports that sort of thing, i.e. a port of what's in Derelict 2.
Feb 16 2012
prev sibling parent reply "Chris Pons" <cmpons gmail.com> writes:
On Wednesday, 15 February 2012 at 15:41:02 UTC, Kiith-Sa wrote:
 On Wednesday, 15 February 2012 at 06:51:11 UTC, RedShift wrote:
 Can I use OpenGL or DirectX with D? If so, where can I find a 
 guide to get everything setup?
Derelict provides bindings for OpenGL and SDL (and many other game-related libraries) - these are used exactly the same way they are used in C/C++, so any OpenGL/SDL tutorials for C/C++ apply. Derelict has a few of its own functions that can/need to be called when initializing, described in its documentation. The current stable version of Derelict supports only OpenGL up to 2.1 and SDL 1.2, but support for OpenGL 3.0+ and SDL2 is being worked on. For the current development version, see https://github.com/aldacron/Derelict3 (Derelict moved to GitHub recently)
Ok, So let me get this straight. I can use Derelict with OpenGL 3. ish, and support for 4.0 is on the way. I can also use any tutorials to learn Opengl? That is really good news.
Feb 15 2012
next sibling parent reply "Chris Pons" <cmpons gmail.com> writes:
I am sorry about the double post. I am in the middle of trying to 
install derelict following this tutorial:

http://h3.gd/dmedia/?n=Tutorials.SdlGlTutorial1

However, when I get to the third step I get this error:


Error	1	Error: module gl is in file 'derelict\opengl\gl.d' which 
cannot be read	D:\Documents\Projects\Test\Test\main.d	3	

I am assuming this means that gl.d can not be found. However, my 
derelict source files are in

.../dmd2/src/ext/derelict/

In my VS project under the options panel, I pointed my DMD 
install path to D:\Documents\Projects\DMD2 .

Do I need to set the Import and Library path as well?
Feb 15 2012
parent Mike Parker <aldacron gmail.com> writes:
On 2/16/2012 4:07 AM, Chris Pons wrote:
 I am sorry about the double post. I am in the middle of trying to
 install derelict following this tutorial:

 http://h3.gd/dmedia/?n=Tutorials.SdlGlTutorial1

 However, when I get to the third step I get this error:


 Error 1 Error: module gl is in file 'derelict\opengl\gl.d' which cannot
 be read D:\Documents\Projects\Test\Test\main.d 3

 I am assuming this means that gl.d can not be found. However, my
 derelict source files are in

 .../dmd2/src/ext/derelict/
Probably not a good idea to put this in the dmd directory. It makes it less easy to upgrade dmd.
 In my VS project under the options panel, I pointed my DMD install path
 to D:\Documents\Projects\DMD2 .

 Do I need to set the Import and Library path as well?
Yes. When you compile Derelict2, .di files are generated in the import subdirectory and the libraries in the lib subdirectory. I would just pass -I<derelict-root>/import on the command line, and add pragma(lib, "path/to/DerelictSomething.lib" or (libDerelictSomething.a) to your source modules.
Feb 16 2012
prev sibling parent Mike Parker <aldacron gmail.com> writes:
On 2/16/2012 3:32 AM, Chris Pons wrote:
 On Wednesday, 15 February 2012 at 15:41:02 UTC, Kiith-Sa wrote:
 On Wednesday, 15 February 2012 at 06:51:11 UTC, RedShift wrote:
 Can I use OpenGL or DirectX with D? If so, where can I find a guide
 to get everything setup?
Derelict provides bindings for OpenGL and SDL (and many other game-related libraries) - these are used exactly the same way they are used in C/C++, so any OpenGL/SDL tutorials for C/C++ apply. Derelict has a few of its own functions that can/need to be called when initializing, described in its documentation. The current stable version of Derelict supports only OpenGL up to 2.1 and SDL 1.2, but support for OpenGL 3.0+ and SDL2 is being worked on. For the current development version, see https://github.com/aldacron/Derelict3 (Derelict moved to GitHub recently)
Ok, So let me get this straight. I can use Derelict with OpenGL 3. ish, and support for 4.0 is on the way.
No -ish to it :-) Up to 3.3 is fully supported. However, 3.x support was sort of hacked on to the existing framework and isn't entirely intuitive. It has to do with the way ARB extensions are reused in 3.x and how that doesn't fit well with DerelictGL's internal architecture. A recent post on the Derelict forums describes what to do.
 I can also use any tutorials to learn Opengl?
Any tutorials for C or C++ will work just the same for D.
 That is really good news.
Feb 16 2012
prev sibling parent Trass3r <un known.com> writes:
 Can I use OpenGL or DirectX with D?
Of course. E.g. there's a D1 game engine: http://yage3d.net I think http://3d.benjamin-thaut.de/?p=16 is D2, but it's rendering code only.
Feb 15 2012