3D "Line" Drawing?
Ok, again, i'm off with the weird questions.
And all though this seems to be pretty Flash(Yes i'm talking about the Macromedia Product) oriented, it will serve to let me have fun with my website and also learn 3D aspects of OpenGL.
Now, lets kick this dog and poney show off.
First off, lets start some background. I am very new to OpenGL, and C++ in that matter (though i am a recovering C++ Book Junkie). What i wish to do, is learn to code OpenGL 3D enviorments, based entierly in lines. Now from my understanding (which is almost none existant), OpenGL has this feature, however i dont think it is ment for anything more than dev applications.
What in the hell am i talking about already? Well I would like to Draw nice, goodlooking full white lines to build frames of all my objects. I havent decided what i will be drawing, as itll take me plenty of time to learn how to do it anyway. Just advanced 3D objects, with camera animations, to create a movie in a sense, then frame by frame copy it for flash importing, but thats all taken care of.
So, in short, how can i draw good looking lines and use them for 3D applications? I assume there is basically 2 ways to do lines, A to B, and A to B with x amount of Curve.
So, with that being said, how can i do that?
Thanks to any replies, and keep inmind i'm a nub lol, so links/detailed explanations(Atleast enough to find good google info) are always helpful! :)
Rank: OpenGL & Glut "Nub", C++ Freshman.
Well, in OpenGL your really limited to just A-B but if you want to do curves youd use nurbs and calculate different positions along the curve (i beleive glu will take care of this for you). basically, the short answer is you use GL_LINES or GL_LINE_STRIP, the first says that it every 2 vertices(points) will form a line, and the second, says that the first 2 vertices will form a line, and then the next vertex will form a line with the vertex before it, so that you are drawing just one long connected (and not necessarily straight) line, and it really wouldnt be a line it would most likely be some crazy zig zag thing.
the simplest way to draw a line would be to do this:
glBegin(GL_LINES);
glColor3ub(255, 255, 255); //set the current color to white
glVertex3f(3, 5, 4);
glVertex3f(6, 8, 7);
glEnd();
that code will draw a WHITE line between the point <3,5,4> and <6,8,7> ill assume you understand RGB colors, thats all glColor3ub() does, is take R,G,B values
There is one final way to draw lines, and that is to draw your mesh (made out of polygons) after having set the polygon mode to GL_LINE which would look like this:
glPolygonMode(GL_FRONT /*you want to change the front face's properties*/, GL_LINE); //not LINES just LINE
glPolygonMode(GL_BACK /*you want to change the back face's properties*/, GL_LINE); //not LINES just LINE
(note i changed it for both back facing and front facing polygons, that way you see the whole mesh)
to set it back to normal you would replace GL_LINE with GL_FILL
hope that helps
-Dan
the simplest way to draw a line would be to do this:
glBegin(GL_LINES);
glColor3ub(255, 255, 255); //set the current color to white
glVertex3f(3, 5, 4);
glVertex3f(6, 8, 7);
glEnd();
that code will draw a WHITE line between the point <3,5,4> and <6,8,7> ill assume you understand RGB colors, thats all glColor3ub() does, is take R,G,B values
There is one final way to draw lines, and that is to draw your mesh (made out of polygons) after having set the polygon mode to GL_LINE which would look like this:
glPolygonMode(GL_FRONT /*you want to change the front face's properties*/, GL_LINE); //not LINES just LINE
glPolygonMode(GL_BACK /*you want to change the back face's properties*/, GL_LINE); //not LINES just LINE
(note i changed it for both back facing and front facing polygons, that way you see the whole mesh)
to set it back to normal you would replace GL_LINE with GL_FILL
hope that helps
-Dan
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
Ok, couple more things. And ya, this sounds exactly like what i want :).
1.) In your opinion, since i'll be using this for various things on websites, what looks best to you?
2.) And as far as textures go, with dif types of texturing, where some look better than other types (its been so long i forget offhand what their called lol), Is there anything like this for none textured lines? In otherwords when i draw my lines, is there any form to make them look really good and smooth, not aliased or w/e, ect.
Oh, and a 3rd.
3.) I believe its called modeling software, to allow you to easily draw say people, buildings, w/e, without figuring it out from point to point. But is there any software like that for free thats worth a damn?
Thanks!
1.) In your opinion, since i'll be using this for various things on websites, what looks best to you?
2.) And as far as textures go, with dif types of texturing, where some look better than other types (its been so long i forget offhand what their called lol), Is there anything like this for none textured lines? In otherwords when i draw my lines, is there any form to make them look really good and smooth, not aliased or w/e, ect.
Oh, and a 3rd.
3.) I believe its called modeling software, to allow you to easily draw say people, buildings, w/e, without figuring it out from point to point. But is there any software like that for free thats worth a damn?
Thanks!
Rank: OpenGL & Glut "Nub", C++ Freshman.
3) Yeah, modeling programs/software,
-blender is free, many people dont like it because its complex,
-milkshape is (as far as i can tell) a nice free to try $30 to buy low polygon modeler.
-anim8or- doesnt spark my interest, it is free though, you may want to take a look at it
-wings3d- again, didnt interest me (didnt strike me as a high poly modeler)
-gmax- i believe this is free, as far as i know its stripped down 3ds max, so it should be relatively good (3ds max is a standard as far as i can tell)
2) antialiased lines, i dont know how to do it specifically, but a quick google should serve you well
1) you cant put a c++ program on a site the way you can with flash, you could of course distribute a zip file containing the exe and such, but anyways, if you want to use a modeling program, your going to end up with a polygon mesh, in which case your better off using the third method i described involving the polygon fill mode
hope that helps
-Dan
-blender is free, many people dont like it because its complex,
-milkshape is (as far as i can tell) a nice free to try $30 to buy low polygon modeler.
-anim8or- doesnt spark my interest, it is free though, you may want to take a look at it
-wings3d- again, didnt interest me (didnt strike me as a high poly modeler)
-gmax- i believe this is free, as far as i know its stripped down 3ds max, so it should be relatively good (3ds max is a standard as far as i can tell)
2) antialiased lines, i dont know how to do it specifically, but a quick google should serve you well
1) you cant put a c++ program on a site the way you can with flash, you could of course distribute a zip file containing the exe and such, but anyways, if you want to use a modeling program, your going to end up with a polygon mesh, in which case your better off using the third method i described involving the polygon fill mode
hope that helps
-Dan
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
ya sorry about the website c++ junk, i musta said somethin wrong. What i am going to do is make small logo's, intro's, ect.. out of OpenGL, capture them frame by frame, then import the Animation into Flash.
Anyway, Thanks! :)
Anyway, Thanks! :)
Rank: OpenGL & Glut "Nub", C++ Freshman.
As to the antialiasing... I can help you out with that part.
I coded an accumulation buffer tut some time ago which never made it:
http://members.lycos.nl/digicoaster/
BTW this demo only runs FAST on cards with hardware accumulation buffer as i use the real one... if it is TOO slow i can also get it to render to texture for ya...
I coded an accumulation buffer tut some time ago which never made it:
http://members.lycos.nl/digicoaster/
BTW this demo only runs FAST on cards with hardware accumulation buffer as i use the real one... if it is TOO slow i can also get it to render to texture for ya...
The world isn't unpredictable. It's CHAOTIC.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement