Nehe tutorial
BlitzMax Forums/BlitzMax Tutorials/Nehe tutorial
| ||
Nehe tutorial 2 to 13 - 16 to 43. For more info see http://nehe.gamedev.net/ Tested with Win32 BMax core 1.10. Not tested with MacOs and linux, report error if you have one. jb update I have added frameworks to NeHe (2 to 43) and changed HideMouse to bglSetMouseVisible False in order to get the tutorials working under BlitzMax v1.10 This fixes the 'mixing Max2D & PureGL' issue where the window opens then immediately closes again Thanks to him. Nehe Tutorial Tuto list : 2-Your First Polygon 3-Adding Color 4-Rotation 5-3D Shapes 6-Texture Mapping 7-Texture Filters, Lighting & Keyboard Control 8-Blending 9-Moving Bitmaps In 3D Space 10-Loading And Moving Through A 3D World 11-Flag Effect (Waving Texture) 12-Display Lists 13-Bitmap Fonts 16-Cool Looking Fog 17-2D Texture Font 18-Quadrics 19-Particle Engine Using Triangle Strips 20-Masking 21-Lines, Antialiasing, Timing, Ortho View And Simple Sounds 22-Bump-Mapping, Multi-Texturing & Extensions 23-Sphere Mapping Quadrics In OpenGL 24-Tokens, Extensions, Scissor Testing And TGA Loading 25-Morphing & Loading Objects From A File 26-Clipping & Reflections Using The Stencil Buffer 27-Shadows 28-Bezier Patches 29-Blitter Function, RAW Texture Loading 30-Collision Detection 31-Model Loading 32-Picking, Alpha Blending, Alpha Testing, Sorting 33-Loading Compressed And Uncompressed TGA's 34-Beautiful Landscapes By Means Of Height Mapping 35-Playing AVI files in OpenGL (BMF file) 36-Radial Blur & Rendering To A Texture 37-Cel-Shading 38-Loading Textures From A Resource File & Texturing Triangles (Use incbin) 39-Introduction to Physical Simulations 40-Rope Physics 41-Volumetric Fog & IPicture Image Loading 42-Multiple Viewports 43-FreeType Fonts in OpenGL You can add or change "bglSetSwapInterval(0)" after the window creation. bglSetSwapInterval(0) disable Vsync bglSetSwapInterval(1) enable Vsync bglSetSwapInterval(2) Vsync/2 Etc... You can add "| BGL_FULLSCREEN" to the "bglCreateContext" for fullscreen. All tutorials work by default in 800*600*32. |
| ||
hey.. this is great.. thanks for sharing.. (although it runs reeeeeeaaaaal slow on the mac) |
| ||
Cool. Mark said no exe's in the beta anouncement, so you should take those out! |
| ||
Corrected. ;) |
| ||
Nice work! |
| ||
Very nice. In contradiction to LarsG they run quite fast on my Mac (60fps and more). Nicolas. |
| ||
Added Nehe tutorial 9 Add "BGL_FULLSCREEN" to the bglcreatecontext. Humm..., i have 3500-4500 fps in Win32 windowed and 3000/7000 fps in fullscreen. |
| ||
Hmmm, I see what LarsG mend with slow. I thought 60 fps and up is more than reasonable for my Macintosh (three year old iMac, G4 @ 700Mhz, 512MB Ram and an Geforce MX 2) but 60 and 7000 fps is a big diference isn't it :-)? But nice work again whit tutorial 9. Nicolas. |
| ||
I don't know the Imac world! Added Nehe tutorial 10 and i go to sleep. :) Good night. |
| ||
I get exactly 60fps on my 867mhz G4 powerbook... Is this because the display "refresh" is set at 60 ? If so, how do you override it? Also, I had to change rotation numbers from things like 0.003 to 0.3 to make things spin and move at a reasonable pace... Are these values meant to be fps independent, or if you are getting 1000fps, does say, the cube, rotate faster? :o) Brucey |
| ||
Is this because the display "refresh" is set at 60 Possible! Try "bglSetSwapInterval(0)" before or after "bglcreatecontext". For me i desactivated the Opengl vsync via the control panel of the card. I don't know if it's possible on Imac. |
| ||
Great tutorials - thanks! Do consider using more KeyDown commands than KeyHit for better effect, especially for those of us with slow computers. :) |
| ||
It's this! Add "bglSetSwapInterval(0)" after "bglcreatecontext". bglSetSwapInterval(0) desactivate vsync. bglSetSwapInterval(1) activate vsync. bglSetSwapInterval(2) vsync/2. bglSetSwapInterval(3) vsync/3. Etc..... See comment for this command in the doc. ;) Nehe tutorial is very basic and not well optimised. :) |
| ||
I spent a while wondering what a 'NeHe' was - I thought it was a 'something' - it's the name of the developer. I looked at the webpage and sat their thinking 'What the hell is a NeHe? - why are there NeHe tutorials?' |
| ||
Added Nehe tutorial 11 and 12. |
| ||
Thanks a lot! Now I can learn OpenGL. Please continue doing this! |
| ||
Well Done Extron! Keep up the good work 8) L8r, |
| ||
Added tutorial 13, 16 and 17. Tutorial 14 and 15 are very specific. |
| ||
Added tutorial 18, 19 and 20. Quadratic, particle and masking. |
| ||
Extron your a machine:) Good work.. Keep it up! L8r, |
| ||
Extron go and have Christmas! =] |
| ||
Added tutorial 21 and 22. Tutorial 21 is a little game. Tutorial 22 introduce multitexturing and bumpmapping. Infortunaly tutorial 22 don't use ARB Extension, Bmax have no support to this extension at this time. I have disabled ARB extension but the code can do this to the future. Very interesting Tutorial and hard to translate. :) |
| ||
extorn: there is a module for GLEW (GL extenstion Wrapper) that lets you use the GL extensions. it is in pub.mod/glew.mod |
| ||
Argggg.... :) Yes i see, but it seem there is a bug with this command "glActiveTextureARB" "Unhandled Exception: Unhandled Memory Exception Error" |
| ||
Added tutorial 23, 24 and 25. 23 : Environment mapping 24 : Token, extensions, scissoring etc... 25 : Morphing points |
| ||
Thanks for porting these Extron... you're a legend. If you haven't done so already, you should think about submitting these ports to the NeHe site, that way both you and BRL could get some well earned recognition. |
| ||
Yes, but Win32 Bmax is in beta version. I can't actually do this until it was released. |
| ||
I don't think you'd be going against BRL's wishes by uploading the ported source code. I think the only real restriction with the betas, other than obvious copyright/piracy infringments, was that you weren't allowed to distribute any executables created with the beta's. Given that BMax has been formally released on the Mac, and that BMax source code is supposed to be the same for all three versions, the source code you have created by porting the NeHe tutorials is effectively valid Mac BMax source and thus should be allowed to be distributed. But regardless, you do what you feel is right. I am greatful to you for porting these tutorials, and I'm certain once they're posted on NeHe, a whole lot of other people will be too. |
| ||
Yes you are right, but Nehe archive come with an executable. Source code can be compiled whith all the Bmax version, but the executable compiled for the specific OS don't work with other OS. Why provide executable?, simply for those which don't have the compiler and see how it work. Because Bmax is multiplatform, i would provide the executable for the 3 versions. Somebody can tell me if the tutorial 22 (multitexturing and bumpmapping) work with the GL ARB extension activated on the Mac. You need to change __ARB_ENABLE to True. |
| ||
Added tutorial 26, 27 and 28. 26 : Stencil and reflection 27 : Shadow casting 28 : Bezier surface Happy new year! |
| ||
Génial, toujours aussi prolifique :) Happy new year |
| ||
Extron, you are a machine =] |
| ||
Cool. Should texture filtering work at example 22? Pressing "T" shows no effect. |
| ||
Now it work. I have updated the archive. |
| ||
thnx, nice work. Realy thought it would take more lines of code to create that nice shadow demo in example 27. Sweet surprise. |
| ||
Yeah! 27 is really nice ;) |
| ||
theres a problem with tut10 only 1/3 of the scenes polys are rendered near the end of the nehe10() function ' Process Each Triangle For loop_m = 0 To numtriangles - 1 Step 3 should read ' Process Each Triangle For loop_m = 0 To (numtriangles - 1)*3 Step 3 now you can see the 4 corridors like in the c sample! good to see these tuts in max! |
| ||
Archive updated There is an error in the Visual C++ source code. Thanks Chris. |
| ||
Could you add #37 Toon Rendering, thanks for all your hard work |
| ||
Added tutorial 29 and 30 29 : Blitter function, RAW texture loading. 30 : Collision detection (OOP) see instruction in the source code. ShowMenu don't work in this tut. Beware, tutorial 30 is very difficult to understand, study it, very interisting tutorial and very hard to translate. :) Could you add #37 Toon Rendering, thanks for all your hard work Not a problem Rob, i'll see your other thread. ;) |
| ||
Added tutorial 37. 37 : Cel-Shading |
| ||
Awesome, many many thanks |
| ||
De rien! :) |
| ||
Adding list and tuto description to the first post. |
| ||
I see you use a dedicated function for loading and converting textures. Have you tried bglTexFromPixmap?Function LoadTexture(f$) Local pm:TPixmap=LoadPixmap(f$) Local texname=bglTexFromPixmap(pm) pm=Null ; FlushMem Return texname End Function tex=LoadTexture("test.bmp") glEnable GL_TEXTURE_2D glBindTexture GL_TEXTURE_2D,tex glBegin ' blah glEnd |
| ||
There is a reason, BlitzMax module use maximum mip level where Nehe tutorial use, in general, 0 or 3. For a 512*512 image size : Local pm:TPixmap=LoadPixmap(f$) Local texname=bglTexFromPixmap(pm) Result 512*512, 256*256, 128*128, 64*64, 32*32, 16*16, 8*8, 4*4, 2*2, 1*1 glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage.width, TextureImage.height, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage.pixels) Second parameter generate 0 mip levels, this can be replaced by : Local pm:TPixmap=LoadPixmap(f$) Local texname=bglTexFromPixmap(pm,false) Result 512*512. gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage.width, TextureImage.height, GL_RGB, GL_UNSIGNED_BYTE, TextureImage.pixels) Second parameter generate only 3 mipmap levels. Result 512*512, 256*256 and 64*64. You don't need to release pm because it's local to the function and released after return. |
| ||
Ah I see. Great amount of knowledge you have. Good stuff. |
| ||
Added tutorial 31,32,33 and 34. 31-Model Loading (ms3d, not 100% oprerational) 32-Picking, Alpha Blending, Alpha Testing, Sorting (little game) 33-Loading Compressed And Uncompressed TGA's This one use Stdc module just for demonstration, pure translation. 34-Beautiful Landscapes By Means Of Height Mapping |
| ||
Extron, thanks! (again!) |
| ||
Is this just a Mac thing? |
| ||
Nope, they all work in the windows beta as well. (Except the first number of tutorials run extremely slow on my PC, the later ones are all just fine) |
| ||
thx a lot, great as usual :) but pb with tuto 33 with the new core (1.03) it doesn't compile, nothing happens, no error message !!! works only if you puts a comment on the line : Import "pub.stdc" |
| ||
but pb with tuto 33 with the new core (1.03) it doesn't compile, nothing happens, no error message !!! works only if you puts a comment on the line : Import "pub.stdc" Etrange! ;) It work for me with a 1.03 core in Win32. But it work also without, it's a good thing. :) I'll remove this and update all tutos to core 1.03 (release error message). Merci flaith! |
| ||
De rien Extron, have you tried to compile tuto33 after deleting the exe ? |
| ||
Ok i see "Process failure" :) |
| ||
le c.. que je suis : Import "pub.stdc" <- PAS BON Import pub.stdc <- BEAUCOUP MIEUX donc guillemets : ATTENTION ;) |
| ||
Better solution is without. :)) It work without Import pub.stdc and with Import pub.stdc |
| ||
First of all: GREAT JOB Extron! Has anyone got tutorial 37 runniging on the mac? I just got a blank screen with the menu and the frame rate, very high :-) Having problems with all the thirty-ish tutorials. No big problem because I'm still trying to understand nr. 30 :-) |
| ||
Hummm... check if you have a sub-folder data in your directory. If Tutorial 37 don't find "Model.txt" and "Shader.txt" you will have a blank screen. |
| ||
Hi Extron, Thanks for the quick reply. All is found in the subfolder but I found out that polyNum=Readint(In) returns -939261952 Can you tell me what polyNum should be so I can test if that's the whole problem? |
| ||
1224 Possibility an Endian problem. This text file isn't really a text file, but a binary file. Mac and Intel store the number in different way, basically in inverse order. You can swap this number to see if you find 1224. In Intel platform this number is stored in the file has $C8040000 and reversed when it is read ($000004C8 = 1224 in decimal). |
| ||
Added tutorial 35 35-Playing AVI files in OpenGL This tutorial is tweaked, he don't play a AVI file but a BMF file, a jpeg encapsulation file. Result is identical, except a less quality. Play it in 640*480 for a better quality. BMF format is explained in the source. |
| ||
Thanks Extron. When I give 1224 as polyNum something happens. The tutorial runs but the model gives me some weird modern art :-) This could be an offset-problem or maybe the floats aren't read well either. I'll have a look in the cocoa app. That runs OK. |
| ||
You were right about tutorial 37 extron; I changed lin 161 on my Mac to ; In=LittleEndianStream:TStream(OpenFile("Data/model.txt")) ' Open The File Running perfectly now Thanks |
| ||
last bit now; I think the code should read; ?LittleEndian In=OpenFile("Data/model.txt") ?BigEndian In=LittleEndianStream:TStream(OpenFile("Data/model.txt")) |
| ||
These really are tremendous, great effort and work Extron. Welldone mate and huge cheers for doing them bud. |
| ||
In Nehetut31 in the Milkshape model on the Mac; Method loadModelData(filename:String) ?LittleEndian In=OpenFile(filename) ?BigEndian In=LittleEndianStream:TStream(OpenFile(filename)) This makes it work for the Apple's. |
| ||
Yes for all binary file. :) I will correct that. |
| ||
These are great! |
| ||
Added tutorial 36, 38 and 39 36-Radial Blur & Rendering To A Texture 38-Loading Textures From A Resource File & Texturing Triangles (Use incbin) 39-Introduction to Physical Simulations (OOP, type, method and type extended) |
| ||
A Grand Job Extron! |
| ||
Added tutorial 40, 41, 42 and 43 40-Rope Physics (extend tutorial 39) 41-Volumetric Fog & IPicture Image Loading 42-Multiple Viewports 43-FreeType Fonts in OpenGL |
| ||
Man, you are a ninja and there cant be enough ninjas out there((8) |
| ||
cool job , maybe a pixel shaders Sample ??? |
| ||
you guys are just discovering the NEHE site!!!!!!!!!! :) great job compiling all the tuts Extron... BIG THANKS... --Mike |
| ||
Also, I had to change rotation numbers from things like 0.003 to 0.3 to make things spin and move at a reasonable pace... Could it be that these values are radiant and need to be converted to degrees (* 180 / Pi)?Are these values meant to be fps independent, or if you are getting 1000fps, does say, the cube, rotate faster? I am too new to BMax (2 days) and OpenGL to know much about it - but I saw and tested the original tutorials in VisualC++ and they were much faster. After converting they have the original speed. Thank you very much, Extron. This is really great. |
| ||
Grand work Extron. Btw - Extron you might want to update your to do list ;) Fantastic. Also there's no speed difference between BMAX and C++ conversions of the Nehe tuts and examples. Which is nice. |
| ||
I'm very occupied this time. But who say. :) |
| ||
is anyone doing anything 3d with Nehe and Bmax? How does it compare to the Irrilct (SP?!) wrapper |
| ||
Personaly, i'm waiting for an official (and simple to use) 3D engine i want retrieve the blitz3d like style coding :) Coding directly opengl ? not for me :) When i see the command to type for make a simple cube... |
| ||
>> How does it compare to the Irrilct (SP?!) wrapper Irrlicht is easier to use than OpenGL, (IMO) and it allows you to create a 3D scene without having to type in hundreds of lines. |
| ||
Irrlicht is an Engine, OpenGL a graphics API (which is used by Irrlicht as well) ... comparing them is quite pointless ;) I started with the BM NEHE tutorials once again with learning OpenGL after I threw my C++ far far out the window (and TAO framework for .NET isn't that good at least out of my sight) |
| ||
I have added frameworks to NeHe (2 to 43) and changed HideMouse to bglSetMouseVisible False in order to get the tutorials working under BlitzMax v1.10 This fixes the 'mixing Max2D & PureGL' issue where the window opens then immediately closes again. Download the BMX files - nehe 2to43 Some of the examples fail with: Unable to convert 'Byte Ptr' to 'String'Try nehe22.bmx for instance. The error occours at: Local extensions:String extensions=glGetString(GL_EXTENSIONS) |
| ||
Shouldnt this thread be In the BMAX Tutorials section, rather than as under miscellaneous - showcase? All fabulous stuff and once again top effort :D |
| ||
I can't get any of the examples to run under BlitzMax, most compile ok but then bomb out and complain with a run time error.Are these blitz or BlitzMax examples ? update:I had to read all the threads to find the working zip that fixes the hidemouse problems. |
| ||
Try nehe22.bmx for instance. The error occours at: I corret this lines by this : ' Fetch Extension String extensions="".FromCString(Byte Ptr glGetString GL_EXTENSIONS)) In addition, i update first post and host new archive with your corrections jb. Thanks |
| ||
Holy moses, this is so cool! I may finally buy BMax in order to play with this stuff. |
| ||
I still can't get some exaples to run, and I downloaded from the first post today, 8-26-2005. I have to go. But later I will run each example and tell you what errors I get. I did manage to run the one with the colored balloons bouncing around inside a box with green rods, particles, and sounds. That was awesome! :) I can't wait to try and make a game out of it. |
| ||
hi guy's it looks pretty neet. finally some inside examples on OGL in Bmax. but it's all pretty non documented and what about making it into some kind of wrapper/MOD... with doc's it seems through out the NeHe tut's, everything is coded differently... would be nice with a standard and then it's a smacker tool : )... (until the LONG waited MAX3D pop's it's head) by the way, are there any good 3D mod engiens or wrappers for BMax, haven seen any since month's. ? |
| ||
just wanna note that these dont seem to work now with the latest version of BlitzMax. I could be doing something retarded...who knows |
| ||
Has anybody thought about adding their BlitzMax code for the tutorials? There are a bunch of links at the bottom of each lesson with source code conversions... it would be nice to have BlitzMax there. Who knows, maybe some crazy person will buy BlitzMax and start giving away all of his professional quality 3d models to us ;) |
| ||
well I managed to get mine working again just replace the command glcreatecontext with glgraphics and remove flushmem. Also there is a command swapbuffer replace that with flip |
| ||
#27 doesnt work like it should, shadows do not appear anymore and I cant seem to fix it but will keep trying |
| ||
well done! |
| ||
anyone figure out #27's problem? |
| ||
Is it possible to load and display fonts in BlitzPlus with wrapper (NEHE lesson 13)? I got stuck with it. Thanks in forward. Edit: I have problems with the bits in display function. |
| ||
I can't compile tutorial 27 in BlitzMax 1.16:Building Nehetut27 Compiling:3dobject.bmx Compile Error: Can't find interface for module 'brl.blitzgl' [C:/Documents and Settings/Administrator/Desktop/Nehe_Tutorial/Nehe_Tutorial/3dobject.bmx;4;1] Build Error: failed to compile C:/Documents and Settings/Administrator/Desktop/Nehe_Tutorial/Nehe_Tutorial/3dobject.bmx Process complete |
| ||
Working versions of NeHe 1..5 are currently included in the tutorials section of the BlitzMax distribution. Has anyone got any newer versions compatible with BlitzMax1.20? |
| ||
Leadwerks: Read http://nehe.gamedev.net/lesson.asp?index=01 to fix Compile Error: Can't find interface for module 'brl.blitzgl |
| ||
NeheTutorials for BMax 1.22 Tutorial 6/7: |
| ||
Tutorial 6/7: Both fail with error: unhandled exception: attempt to access field or method of null object on line: TexWidth=tex01.Width |
| ||
Have you downloaded the tutorials on the top of this thread? You should download it and replace the source with the source i have posted. It seems it`s missing the Texture which is in the original Tutorials above. It should work then, but i will check it again if i am at home from work. |
| ||
I have checked it. It work`s. You need the data folder from the original Tutorials above. |
| ||
Hmm.. they don't work for me.... Its says somefin like "can' fin interface for module brl.blitzgl" |
| ||
I have the same problem. @DannyD: what exactly do you mean by "Read nehe.gamedev.net/lesson.asp?index=01 to fix Compile Error: Can't find interface for module 'brl.blitzgl"? I do not see any solution there. |
| ||
brl.blitzgl doesn't exist any more so you should remove it. |
| ||
I sort of explained this yesterday to sanctus http://www.blitzbasic.com/Community/posts.php?topic=57336#656370 I found this by searching "interface for module brl.blitzgl" (Most the problems for Nehe have been fixed (for the first 30 definatly), all you have to do is "Search" with the error) |
| ||
I'm finally going to read these... You guys have done some really great work with it so far :) Just one thing: Is there someplace I can look to find these tutorials presented in a more readable way? (Without the crazy white on black, curvy glowing corners web design). I can't see myself reading through many of them when they're like this... Edit: Aha, I can change the theme! They even have a black on white one for me :) Oh well, it's much nicer now. Still, I'd like a printer-friendly thing. Wasting paper is fun, and learning OGL is probably best done sitting somewhere comfortable without a glaring LCD screen. |
| ||
http://wizz.gamedev.lt/Tutorials/NeHeTutorials_A4_Book.pdf http://perso.club-internet.fr/gilles.keil/Bmax/Nehe_Tutorial.zip |
| ||
This is the beginnings of a little compatibilizer for these tutorials, to get the old source working in the newer BlitzMax. Just compile it (don't compile and run), move the result to the directory containing the source code, and run it. It will silently (not by design but because I can't figure out how to make an application run in Windows's console :/) create a directory called Fixed containing your new tutorials, many of which are now working! Remember to copy the data directory over or move the fixed files back. I've probably missed a few (such as glsetmousevisible, which for now is just getting commented out in a manner that can break single-line if then else statements), and there are a few things which seem to have changed in the language itself that are just totally beyond me and would probably require this app become complicated. Running in windowed mode doesn't seem to work, either. It would be great to get these working 100% again! It's a real shame that all this great software was made obsolete :( |
| ||
uncheck Program->Build Options->Build GUI App |
| ||
I did some manual rework on Lessons one to Lessons eight. All the sourcecode is in the moment in a single file, im made it Superstrict and used "singletons" for the lessons. Download Link: http://www.lavainsel.net/blitzmax/Nehe_2008.zip |
| ||
Thanks robobimbo. |
| ||
I can't get these tutorials to work :( Used Picklesworth's "compatabilizer" and still couldn't get it to work |
| ||
Because Bmax is 20 versions latter than when these where written. However I think most of the problems have been fixed in earlier posts. So... when you get an error search the forums the specific command the error is on, and someone somewhere probably had the same problem. I think most of them where just that the naming convention in bmax changed so you need a slightly different named command, and also the framework is slightly different. (For Example my post 8 up addresses one, and as you said pickles' post four up corrected some, admitedly for the bmax 4 years ago.) Other Than that Post the command that compilation fails at, and maybe we could help Last edited 2011 Last edited 2011 Last edited 2011 |
| ||
Just for the fun of it, I'm going to bring these tutorials up to speed over the next couple days. Just finished tutorials 2 through 10. Get the from here, https://github.com/kfprimm/nehe_bmx If anyone would like to help, fork it and send over a pull request. |
| ||
I would love to learn the whole 48 lessons! So thank you for the first 10 re-write :) |
| ||
@kfprim here are the the rest with the exception of 13 and 43 which I couldn't figure out: http://www.mediafire.com/?h1c9hqtbgqq5wb6 I had to make a slight modification to the framework file for it to work with all of them but it's set so it's backwards compatible with the first 10. 11 to 42 need the new framework. If anybody figures out the rest, it would help me as well. Last edited 2012 |
| ||
Ok. I've updated the repo. Thanks! Though, I just realized I forgot to update the README to credit your contribution. I will take care of that shortly. |