Giter Club home page Giter Club logo

derelict3's Introduction

Derelict 3
------------
Consider the current repo an ALPHA version! If you don't know what Derelict is, see the old project page for info on Derelict 1 & 2:

http://www.dsource.org/projects/derelict/

And visit the forum for help:

http://www.dsource.org/forums/viewforum.php?f=19

This is a quick & dirty intro until I get the time to put together proper documentation. Several things have changed from Derelict 2.

The first thing to notice is that all source modules are located under a single import tree. When you build, .di files are no longer generated. So when building your app, you can just put the 'import' folder on the compiler's import path and away you go.

Second, Derelict is now D2 only. You should still be able to use Tango with Derelict via the recently announced D2 port. But if you need D1, go back to Derelict 2.

Third, the build process has changed. No more makefiles. I hate them with a passion. The decision to support D2-only made it practical to slap together a simple build script. You can specify which packages to build, or specify none to build all. You can run it with rdmd like so:

------
cd $Derelict/build
rdmd derelict.d

rdmd derelict.d DerelictUtil DerelictGL3
------

Or, if you prefer (as I do), you can compile it once with your D2 compiler (DMD, GDC, or LDC2) and execute it as often as you need to. You'll only need to recompile the build script if you pull down any changes to it from the repository. 

------
cd $Derelict/build
dmd derelict.d

# Build all Derelict packages
derelict

# Build specific packages.
derelict DerelictUtil DerelictGL3
------

Also, be aware that the paths are currently hardcoded such that if you execute the script from another working directory, it will fail. I'll make it more robust in the future.

Finally, the interface to DerelictGL3 is a bit different from the old DerelictGL. The primary change is that none of the symbols deprecated in the modern OpenGL specifications are present. This binding is based solely on the C header, gl3.h. You can still use older versions of OpenGL, but none of the deprecated functions will be loaded.

Here's what you need to do in order to get up and running.

Using a third party lib (like GLFW 3, for which you can use DerelictGLFW3 in this repo):
------------
// One import -- this pulls in all OpenGL core 1.1 - 4.2
// functions & types as well as the ARB extensions.
import derelict.opengl3.gl3;

// Use GLFW 3 to create a forward-compatible core context
import derelict.glfw3.glfw3;

void someFunc()
{

// Load the OpenGL library and all functions up to OpenGL 1.1
DerelictGL3.load();

// Create your (preferably forward-compatible) OpenGL context
...

// Now load OpenGL versions 1.2 & higher as well as ARB extensions
// Note that no platform-specific extensions and no extensions
// other than ARB are implemented at the moment.
GLVersion glver = DerelictGL3.reload();

// If you need a specific version, like OpenGL3.3 for example
if(glver < GLVersion.GL33)
    throw new Exception("OpenGL version too low.");

// Or use the loadedVersion property
if(DerelictGL3.loadedVersion < GLVersion.GL33)
    ...

// To test if an extenstion is loaded, just use the extension name as a bool value
if(!ARB_sync)
   throw new Exception("No ARB_sync extension!");

}
--------------------

You should call reload anytime you change contexts. This is required on Windows, but not on other platforms. There's a little bit more to do if you want to create a context yourself, but there's no support for that right now as I haven't yet implemented the WGL extensions.

Please bear in mind that this is all in an ALPHA state. It's perfectly usable as is, but there needs to be more work done on the build script, testing on different platforms/compilers, and, of course, the addition of a few more packages. Pull requests for bugfixes and enhancements are extremely welcome. However, I make no promises about accepting pull requests that add new packages. I'll have to take a wait-and-see approach on that for now.

derelict3's People

Contributors

mdparker avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.