D, Derelict2, and OpenGL
Chris Pons
cmpons at gmail.com
Wed Feb 22 17:29:53 PST 2012
Ok, thanks for clearing that up. I am really looking forward to
seeing what D and Derelict2 can offer. However, I would have
liked to post this in the Derelict forums because it seems like
the more appropriate place.
I know that Aldacron is only one man, and I appreciate his hard
work, but how long does it take to get approved to post on that
forum?
I read that I had to wait for moderator activation (unless I was
mistaken) ?
On Thursday, 23 February 2012 at 01:15:17 UTC, David wrote:
> Am 23.02.2012 01:20, schrieb Chris Pons:
>> Hey David and Vijay,
>>
>> Thank you for the swift replies. It seems like this foray into
>> D and
>> OpenGL could be a bit overwhelming considering I would be
>> learning D and
>> SDL/OpenGL at the same time. So because of this, i'm going to
>> make sure
>> I have a solid base in D to start with.
>>
>> I am an Intermediate level C++ programmer, and I have used
>> SDL/SFML/DirectX so the majority so far in the D programming
>> book is
>> very familiar.
>>
>> I however, do have a newbie Derelict2/OpenGL question. I have
>> a basic
>> program that simply spawns a window using SDL which I found
>> from one of
>> the SDL/OpenGL tuts on the derelict website.
>>
>> In order to use DerelictGL and DerelictSDL do I simply need to
>> import
>> derelict.opengl.gl and import derelict.sdl.sdl and then
>> initialize the
>> modules by typing DerelictSDL.load() , DerelictGL.load()?
>>
>> After this am I free to use SDL/OpenGL functions, like
>> SDL_Init(...),
>> SDL_Quit(); etc?
>>
> No you need also do init opengl after creating the context,
> here's how I am (was) doing it:
>
> ----------
> static this() {
> DerelictSDL.load();
> DerelictGL.load();
> }
>
> void main() {
> writefln("main");
> if(SDL_Init(SDL_INIT_VIDEO)) {
> writefln("error: SDL_INIT_VIDEO");
> return;
> } else {
> writefln("no error (SDL_INIT_VIDEO)");
> }
>
> SDL_WM_SetCaption("titel", "nirgends");
> SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 16);
> SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
> SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0);
> SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
> //SDL_SetVideoMode(1000, 800, 32, SDL_OPENGL |
> SDL_RESIZABLE);
> SDL_SetVideoMode(1000, 800, 32, SDL_OPENGL);
>
> DerelictGL.loadModernVersions(GLVersion.GL30);
> DerelictGL.loadExtendedVersions();
> //DerelictGL.loadExtensions();
>
>
> // rendering goes here
> }
>
> ---------------
More information about the Digitalmars-d-learn
mailing list