PDA

View Full Version : NeHe Lessons and other opengl api code



kryton9
08-05-2007, 06:21
I was wondering-- in looking at Matthews NeHe lesson's, he is very nicely declaring the opengl api calls at the top of his programs. Couldn't he just use this instead, and not have to type all that stuff in?

#INCLUDE "%APP_INCLUDEPATH%\thinbasic_gl.inc"
#INCLUDE "%APP_INCLUDEPATH%\thinbasic_glu.inc"

ErosOlmi
08-05-2007, 06:59
Yes, he could but ...
I suppose he just declared the needed functions and equates in order not to have script dependancies.

kryton9
08-05-2007, 07:09
Thanks Eros, I see so it can be done either way. Good to know :)

ErosOlmi
08-05-2007, 07:16
Yes, of course.
#INCLUDE directive is just a simple way to modularize and better organize source code.
When a script is executed by thinBasic, a big script buffer is created in memory. Every #INCLUDE directive is expanded with the code found in the included file. At the end thinBasic just have big buffer with all the code inline. An internal structure keep track abou every script line in order to know to which included file (if any) it belongs and, in case of runtime error, give appropriate indications.

So you can use #INCLUDE files or you can type your declare function. Up to you.

Ciao
Eros

kryton9
08-05-2007, 07:27
From what it sounds like, topdown will soon have include files and take advantage of project files that have been added to thinAir and thinBasic. It will make it nicer to work on smaller chunks of code that is for sure.

matthew
08-05-2007, 12:14
I was wondering-- in looking at Matthews NeHe lesson's, he is very nicely declaring the opengl api calls at the top of his programs. Couldn't he just use this instead, and not have to type all that stuff in?

#INCLUDE "%APP_INCLUDEPATH%\thinbasic_gl.inc"
#INCLUDE "%APP_INCLUDEPATH%\thinbasic_glu.inc"


The reason why I did it the way I did was because I thought I had to. :D

The way you're doing it kryton looks much neater. :)

To be honest it didn't require much typing out I just Copied and Pasted the relevant Information from the Gl or Glu Include Files. ;)

kryton9
08-05-2007, 19:48
I didn't know either, but nice to know we have both options that is for sure!!