Advertisement

Please Help To Reduce Code Of Nehe Tutorial lesson#1

Started by December 25, 2000 09:02 PM
30 comments, last by HdZ 23 years, 10 months ago
Original post from Xsist

I learnt Open GL in 20 minutes...
Hdz, man just ignore the stuff and accept that it works and only add procedures and edit the DrawGLScene only and you''ll be fine. Relax, it is much easier further on. Download the source (lesson1) and move on to the next and use the lesson1 code to program the next lesson (practise makes perfect)

OK i think it''s only your opinion that to take the code of
lesson#1 and put there the procedures but it''s not in my opinion .
I want to understand openGl and not just use the code!!!
i hope you understood what i mean
WTF?

TIP: You'll learn by doing so just
USE
that code!!


Edited by - richardve on December 29, 2000 12:14:14 PM
Advertisement
OK, i reduced the code, so that there are no checks in it...
although i do not really understand why...
you can download it from HERE.
but i really agree to the others, that you should not reduce nehe''s code, because it''s pretty smart!
his failure-checking-routines make it a lot easier to write functional code.


SnAkE''s Programming Resources



You can only reduce the amount of lines of code when you understand what the lines of code you CURRENTLY have do. Then you can wisely decide which lines of code you want and which you can get rid off.

But reducing lines of code is stupid. Those lines are there for a reason. Same thing about comments. Some people remove all comments from their code because otherwise it''s too big. Wrong. If a function is too big for you, split it up, move it to another .cpp file, order it, so you can work in functions you want to work in, not in a big bloated piece of code that does everything.

to give you a hint: my library, demogl, which does all the overhead in your opengl program for you, contains more than 21000 lines of code. Glut is also a LOT of code (31000 lines if my wordcounter works correct and I count the right files ). that code is there for a reason. (hell, who doesn''t hate typing stuff that''s not necessary ). So if you want to get RID of code, DONT delete it, but MOVE it out of the way. Move it into a separate .cpp file and call it "winsetup.cpp" or something. In there is your systemcode. all the other files just contain effectcode.

you''ll soon notice that that works much better than a trimmed down pile of crap that misses it''s foundation.

--

Get productive, Get DemoGL: http://www.demogl.com
--
Get productive, Get DemoGL: http://www.demogl.com
You want to learn win32 or OpenGL?????


This is a classic case of bad source code and an inability of people to comprehend the question they''re asked!!

Hdz am I right in understanding that you don''t so much want to just rob the code but rather understand it fully so that you can write it yourself, I work like that anyway, although sadly I don''t progam in VC++ so I won''t be much help to you.
The best I can do is give you the following link to the OpenGL Man pages
http://www.sun.com/software/graphics/OpenGL/manpages/index.html
With a bit of effort you''ll should be able to use these and NeHe source up to lesson 6 to write your own OpenGL Apps.

And a note to NeHe: When I say bad source don''t take insult I just dislike source code in general, maybe I''ll translate your source over to my perferred style: Theory and Method. Anyway Thaks Jeff for all your great work.
Advertisement
ho ho ho!

I think there is no need for reducing the code. Ok, for newbies the win32 stuff is very hard to understand, if you have no information resources on how to do the window stuff. But you can learn it just by reading a nice book about it. Until you havent done it I suggest that you(Hdz) just use NeHes base code or the Glut LIB.
I had the same problem with NeHes tuts! I understood all openGL an c++ stuff, but all the window stuff hit me hard.
If you really want to know what ya are doing(coding) then buy a good book on win32 coding and the opengl superbibel! there, in the opengl superbibel, you can find some very well explained code on how to setup a render context in win32 without the glut LIB. I think the Superbibel is the best book on opengl for you(you are a german guy 2, heh? It is easier to read, especially if you are very young... like me)

cu
trigger

ps: if you have problems with understanding the code, you can mail me and we can try to figure out how it works.
http://trigger.xenyon.net/
[ OFFTOPIC ]

Otis:

What program (add-in?) do you use to count those lines?

[ /OFFTOPIC ]
richardve:
It''s called wc.exe, it''s in NT resourcekit utilities. (just like the unix tool). you just do wc -l *.cpp and it counts all lines in all .cpp files. Check softlib directory on ftp.microsoft.com, perhaps it''s downloadable there, or perhaps it''s downloadable somewhere on the net (i.e.: use google )

--

Get productive, Get DemoGL: http://www.demogl.com
--
Get productive, Get DemoGL: http://www.demogl.com
Otis:

thanx!
But I couldn''t find it in the softlib directory @ micro$oft so I did a search with Google and found a very nice line counter (VC Add-In) on EarthWeb.

This topic is closed to new replies.

Advertisement