Do I need to learn this and if yes, where is there a better tut?

Started by
60 comments, last by SonShadowCat 22 years, 1 month ago
now i dont plan on making any games that have dungeons, caves, or other enclosed spaces so i was wondering if i need to learn lesson #10, Loading And Moving Through A 3D World now if i still need to learn this can you plz point me to a better tut since that one really sux ass in my opinion "Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
Advertisement
There are lots of different ways for loading and moving into a 3D world. This tutorial is just an example.

It''s very important to know those things for a game engine, but if you *just* plan on making a 3D engine you don''t need to waste a lot of time on that lesson, and you gotta go on next lessons.

I also think this lesson sucks, but in fact it''s a _very_ difficult task to explain it. I don''t know a better tut. But I admit I haven''t looked very far because I don''t care that much about it.
I wrote a tutorial on the relavant part of that tutorial (movement). It''s on my now defunc site GP Nucleaus It''s only defunc because I lost the access password for it when my hard drive had to be reformatted.

A man walks into a bar.....ouch!?! Ya get it, do ya huh huh well....awww I give up.
A man walks into a bar.....ouch!?! Ya get it, do ya huh huh well....awww I give up.
I have to agree with ya. Tutorial 10 isn''t very well written. I''ve gone over it several times and still don''t understand some of it.
Well, you don''t NEED to do any of the tuts, but they all teach usefull things.

The tutorial really has very little to do with doing indoor ''dungeon'' scenes. It just uses that as test data to illustrate the lessons. Now if you''d been looking at a tut on bsp or octrees and said the same then you''d have been correct.

You are maybe misunderstanding that the tut is not on one topic, but is a ''nice'' way of showing how a few things can work together. They''re just together in one tut so you get something neat to look at in the end.

The things that tut teaches which are useful are loading things from a text file (if you can''t do that even, you''ll have problems... its a basic c++ skill and will serve you well) and moving the ''camera'' - something almost any gl game is going to need.

If you don''t like the tut maybe try a google search for "OpenGL camera tutorial"? There are at least 3 basic ways to do this (loading a matrix, gluLookAt, and using basic gl transformations like glRotatef) so its likely you''ll find one you''ll like.

Any C++ book should have a chapter on basic I/O, which can be modified for your own needs. A good way to learn how to use this in relation to opengl is maybe to get a .asc file and work out how to load it and display it in gl. This is how i first loaded a model, and was probably my first major use of file IO (aaah the nostalgia ;¬). The asc format is really easy to read (work out what info its likely to be giving you, then work out which bits you need, then how to load and finally display them). Use a viewer like 3dexploration so you know what it should look like.

Hope this has explained and/or given you some ideas of where to go next.

Dan Groom

[size="1"]
you lost me with your last paragraph..

"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday
OK, I''ll try to explain better, sorry.

The way i ended up learning the ''loading data from a text file'' bit that the tut tries to teach was the following:

I got a copy of 3d Exploration - its a free for 30 days model viewer and converter. It will export into many formats, including the ability to export simple OpenGL code that draws the model. In this version the model data (vertices, triangles etc) is specified in the actual code, rather than loaded from a file. You compile the code and can see the model. This is useful for seeing how the lists of numbers that represent the model are used in conjunction with OpenGL calls.

I then took a familiar model (a quake2 model i downloaded from polycount or somewhere) i could recognise easily (so i knew if my code was drawing it wrongly). I converted the model into a .asc file.

.ASC files are text based rather than binary. This means that it is possible to read them yourself, and fairly easy to write some code to load them using fstream, though the file is larger than its binary counterpart. While there is an exellent nehe tut on loading binary format models by Brett Porter, I think loading text based files is much easier at first (which is why the nehe tuts teach them in that order).

asc files hold all the info used in most models (vertex, triangle, texture coords, and i think material properties).

I looked at a few different asc files to find the pattern they followed. When i was fairly sure i had it sussed, i started coding. Overall you just have to work out which bits of the file tell you how many loops to do (eg how many triangles in the file etc) and write the loops to read the text out of the file.

You''ll need some basic structures to hold the data (arrays may do to start with, runtime assigned arrays are what you''ll need to do it properly though).

You''ll then need a Draw function which passes all your data to openGL for drawing. Again this''ll involve a few loops depending on your number of triangles etc.

I''m not saying this is necesarily the best way to learn it, but at the time the sense of achievement i got from working it out was tremendous. It also taught me some skills in finding patterns and and applying what you find to your code which have made me a better programmer in many ways.

To summarise:

-you NEED to know how to load data froma text file. Its a basic skill.

-asc files are a good way to learn. They''re simple enough to learn from, but non trivial enough to provide a challenge and something usefull at the end for you to use in other projects. Its much easier to keep working when you can SEE only a few bits are wrong by looking at what your code is drawing, than if you were working with some boring database file or something ;¬)

Again, hope this helps, let me know how you get on

Dan Groom
[size="1"]
i just thought I''d add the following:

The post above assumes you have no experience loading things from text files - I''m sorry if this is wrong, I don''t mean to insult your coding skills or anything :¬)

Even if you have some experience with text files, its still worth using that knowledge to help introduce yourself to the type of thing you''ll be working with in 3d model/map/scene/whatever files.

Dan
[size="1"]
I started at the lowest point, text RAW triangle files. The file looks just like this:

object1
1.04 1.32 2.43 2.04 5.44 3.43 2.12 4.34 6.44

That would be a triangle. This is as simple as model loading gets, and the raw format can be exported by many programs (including said program: 3d exploration). The only "difficult" part was finding what was a number and what was a name. I just tested to see if the first character was a-Z, easy enough. Then I moved up one level. I wrote a program that loaded RAW files and churned out binary versions of the same data. Same data, but with faster load times and less space. Then I upgraded my BIN format to support color, texture coordinates, and so on. I use my own format in my projects now, and I''m making converters for different common formats.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
i am not well versed in loading from text files
one of my books taught it well but my friend has it and i cannot look at it to re-read it

so i do not know the functions that have anything to do with file handling except for the really basic ones like read, write, fopen, fclose, and thats about it...


i need to find a place that explains file loading and looking for specific parts in a text file, know of any good places?

"Those who serve no purpose, have no purpose. SSC the Super Saiyan Cat"
--------------------------------- "Those who serve no purpose, have no purpose."- SSC Oh the possibilities!!Edited By - SonShadowCat on Your Girlfriends Birthday

This topic is closed to new replies.

Advertisement