www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - dmedia.dprogramming.com - two new tutorials

reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
I have written two new tutorials for DMedia
( http://dmedia.dprogramming.com/ )

- Getting started with OpenGL - creating a window
- Drawing basic primitives using OpenGL

Grab them while they're hot ;)


Disclaimer: I'm not a native speaker so if you encounter any language 
errors, please report them to the email given in the Contact section: 
http://dmedia.dprogramming.com/Main/Contact


-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O 
!M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y
------END GEEK CODE BLOCK------

Tomasz Stachowiak  /+ a.k.a. h3r3tic +/
May 07 2006
parent reply Hasan Aljudy <hasan.aljudy gmail.com> writes:
Tom S wrote:
 I have written two new tutorials for DMedia
 ( http://dmedia.dprogramming.com/ )
 
 - Getting started with OpenGL - creating a window
 - Drawing basic primitives using OpenGL
 
 Grab them while they're hot ;)
 
 
 Disclaimer: I'm not a native speaker so if you encounter any language 
 errors, please report them to the email given in the Contact section: 
 http://dmedia.dprogramming.com/Main/Contact
 
 

Nice! I just started reading, and noticed you're using toStringz for strings. I've tried using SDL with D before, and I noticed that you don't need to use toStringz at all, for example, this works just fine: SDL_WM_SetCaption("My SDL Window", null); at least it worked when I tried it.
May 07 2006
next sibling parent reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
Hasan Aljudy wrote:
 Nice! I just started reading, and noticed you're using toStringz for 
 strings.
 I've tried using SDL with D before, and I noticed that you don't need to 
 use toStringz at all, for example, this works just fine:
 
 SDL_WM_SetCaption("My SDL Window", null);
 
 at least it worked when I tried it.

Please, please, please read the whole thing before you write comments like this one :S Quote from my article: `But then if you know the D specification inside-out, you might say “Hey, but when the compiler allocates space for string literals, it inserts an additional zero just after that memory range !”. Calm down, please, you can remove the toStringz function call and its associated import if you know what you're doing. But if someone wanted to have a window with some dynamically - generated caption, they would be in some serious trouble.` -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/
May 07 2006
parent Hasan Aljudy <hasan.aljudy gmail.com> writes:
Tom S wrote:
 Hasan Aljudy wrote:
 
 Nice! I just started reading, and noticed you're using toStringz for 
 strings.
 I've tried using SDL with D before, and I noticed that you don't need 
 to use toStringz at all, for example, this works just fine:

 SDL_WM_SetCaption("My SDL Window", null);

 at least it worked when I tried it.

Please, please, please read the whole thing before you write comments like this one :S Quote from my article: `But then if you know the D specification inside-out, you might say “Hey, but when the compiler allocates space for string literals, it inserts an additional zero just after that memory range !”. Calm down, please, you can remove the toStringz function call and its associated import if you know what you're doing. But if someone wanted to have a window with some dynamically - generated caption, they would be in some serious trouble.`

oops, my mistake. I apologize :(
May 07 2006
prev sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Hasan Aljudy" <hasan.aljudy gmail.com> wrote in message 
news:e3lqt1$2h1f$1 digitaldaemon.com...
 I've tried using SDL with D before, and I noticed that you don't need to 
 use toStringz at all, for example, this works just fine:

 SDL_WM_SetCaption("My SDL Window", null);

 at least it worked when I tried it.

That works because string literals in D are implicitly null-terminated, although the literal length won't reflect that. The problem arises when you try to pass in a dynamically created string, which is usually not null-terminated.
May 07 2006
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
news:e3lv9h$30du$1 digitaldaemon.com...
 That works because string literals in D are implicitly null-terminated, 
 although the literal length won't reflect that.  The problem arises when 
 you try to pass in a dynamically created string, which is usually not 
 null-terminated.

Damn crossposted topic. I hate these.
May 07 2006
parent reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
Jarrett Billingsley wrote:
 Damn crossposted topic.  I hate these. 

Per one suggestion from some time ago, I postedo to D.announce and D.learn so people can see the announcement and reply to D.learn... Not many do this though, I'll have to include explicit instructions ;) -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/
May 07 2006
parent reply DBloke <DBloke NoSpam.org> writes:
Tom,
Well done on this site, the tutorials are a little basic but are good 
for anyone wanting to get started with SDL & OpenGL.

I had to do a Geometry refresh for tutorial 3 :) .

How about in the future a simple but effective 2D or 3D killer Game for 
D written in D, SDL &| OpenGL?

Keep up the excellent work
DBloke
May 08 2006
parent reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
 Tom,
 Well done on this site, the tutorials are a little basic but are good 
 for anyone wanting to get started with SDL & OpenGL.

That's what I intended... I didn't want to send people over to NeHe, especially because I didn't like some of their explanations, like "we're going to discuss it in later tutorials" - expanations never came ;) My tutorials are still lacking some images and descriptions but I hope I'll get there ;)
 I had to do a Geometry refresh for tutorial 3 :) .

That's pretty inevitable when doing 3d graphics ;)
 How about in the future a simple but effective 2D or 3D killer Game for 
 D written in D, SDL &| OpenGL?

Hmmm... If you have any cool ideas, visit #dmedia on the irc.freenode.net server. I'm just going to sleep (my timezone is GMT+1) but I'll be there tomorrow ;) Maybe making a Pong or something like it would work... as for a simple (but not simple enough for a tutorial) game: <shamelessPlug> http://www.mat.uni.torun.pl/~h3r3tic/STFU.zip </shamelessPlug>
 Keep up the excellent work

Thanks ! :) -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/
May 08 2006
parent reply DBloke <DBloke NoSpam.org> writes:
 That's what I intended... I didn't want to send people over to NeHe, 
 especially because I didn't like some of their explanations, like "we're 
 going to discuss it in later tutorials" - expanations never came ;)
 My tutorials are still lacking some images and descriptions but I hope 
 I'll get there ;)
 

 
 I had to do a Geometry refresh for tutorial 3 :) .

That's pretty inevitable when doing 3d graphics ;)

does that suck? ;)
 Hmmm... If you have any cool ideas, visit #dmedia on the 
 irc.freenode.net server. I'm just going to sleep (my timezone is GMT+1) 
 but I'll be there tomorrow ;) Maybe making a Pong or something like it 
 would work...

 
 as for a simple (but not simple enough for a tutorial) game:
 <shamelessPlug> http://www.mat.uni.torun.pl/~h3r3tic/STFU.zip 
 </shamelessPlug>

I played this it was simple but effective and could be a great way to do a quiz type thing at the end of a tutorial, the game made me laugh and the comments and assertions in the code made me laugh more, like the sense of humour :) it definitely helps when coding for sure.
 
 Thanks ! :)
 

U R Welcome, keep up the work DBLoke
May 09 2006
parent Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
DBloke wrote:
 Looking good so far ;)

Thanks. But as I said, these tutorials need more love anyway ;)
 That's pretty inevitable when doing 3d graphics ;)

does that suck? ;)

Depends on what kind of geometry you hate... I didn't enjoy the geometry I had at school very much, but the stuff you use for 3d graphics can get really interesting. And there's a big difference between learning for yourself and learning for the classes. It shouldn't be very hard to get comfortable with the basics required for some cool 3d apps :)
 Hmmm... If you have any cool ideas, visit #dmedia on the 
 irc.freenode.net server. I'm just going to sleep (my timezone is 
 GMT+1) but I'll be there tomorrow ;) Maybe making a Pong or something 
 like it would work...


That might be a good idea, yet I think that introducing more basics before taking on a game will be a wise move ;)
 as for a simple (but not simple enough for a tutorial) game:
 <shamelessPlug> http://www.mat.uni.torun.pl/~h3r3tic/STFU.zip 
 </shamelessPlug>

I played this it was simple but effective and could be a great way to do a quiz type thing at the end of a tutorial, the game made me laugh and the comments and assertions in the code made me laugh more, like the sense of humour :) it definitely helps when coding for sure.

Like if there were many comments ! :P I didn't have the time to comment for this project :> and considering that it would need it for just a moment, it wasn't really worth it :) I've got the experience from writing it and it's enough hehe :) But as for the humor in naming conventions - I couldn't stand writing dull code ;D -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O !M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y ------END GEEK CODE BLOCK------ Tomasz Stachowiak /+ a.k.a. h3r3tic +/
May 10 2006