Advertisement

help with glutWireCube(...

Started by September 25, 2000 12:32 AM
10 comments, last by Dave_Johnson 24 years, 1 month ago
I would like to ask a simple question. I know this is probably a "ignorant" question, but once again...isn''t that the best way to learn? Here goes: If I want to use openGL to create a Solid Cube or a Wire Frame Cone how do I put that code in to my visual C++ program? I know the commander are: void glutSolidCube(GLdouble size); and void glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); but when I implement these statements into my code I get an error that states a redefinition to the parameters. Any help would be greatly appreciated. --David
--David
I dont program in c++, but i dont think you need to redefine those procedures into your code, as openGL has them already included.. just use them.

no need to rewrite them into your code..


-- wAVaRiaN
Advertisement
why the hell are you learning opengl if you dont even know c++???

go pick up a good c++ book and read it all the way through
then try to learn an API
yeah, you need to learn c++ before you do anything else. but to answer your question, those 2 lines are "blueprints." they tell you the structure of what''s called a function. the first term is called the return type. the word void means none, so it returns nothing. the second term is the actual function name. the things in parentheses are called arguments. these also have data "types" called GLdouble, and GLint. obviously, the gl is for graphics library, but the double means double-sized float, or floating point number, or decimal, if you wanna reduce it to that. int is merely an integer. the second term in each of the arguments is a description of what that argument is for. you pass these arguments into the function, and it would execute the function. however, that''s not all to the program. you''ve got lots more to learn. LOTS MORE. the way you''d implement these functions, however, is like this:

glutSolidCube(4);

or

glutSolidCube(5.8);

etc.

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
It appears that people in these forums use C & C++ interchangably!

He probably knows C (a procedural language) but not C++ (an object-oriented language). I think you guys are being a bit rough on wAVaRiaN. Hey he may even be writing his code in VB, Delphi, etc as there are plenty of tutes on this site that DO use OpenGL in these languages!

Also, knowing C++ means you know C (usually) but it doesn't necessarily follow that knowing C means you know C++! I know quite a few people who understand a procedural language like C but cannot make the transition to C++ or Java because it's OO. Anyway, OpenGL is a procedural API and doesn't use classes unless you create them yourself or obtain them somewhere else.

I think you guys who know more (and better) should be a bit more tolerant of us beginners. Remember, you were beginners once too.

Edited by - firesoft on September 25, 2000 12:35:57 AM
on a tangent could Dave_Johnson mean what he says, how to implement it into a VC++ project as in Visual MFC Dialogs and all? If that is so i haven''t a clue, but maybe someone else could explain...
Advertisement
on a tangent could Dave_Johnson mean what he says, how to implement it into a VC++ project as in Visual MFC Dialogs and all? If that is so i haven''t a clue, but maybe someone else could explain...
Lol.. u guys were talking about me?

shit.. okies then.. Im quite happy where i am atm.. ive been through qbasic, vb, pascal & now delphi.. delphi does everything i want it to, & i dont see any problems with its productivity. Im not saying that c++ isnt the ''elite'' programming language to use, i''ll move on to that later, but at the moment, i see no reason to change.

Hey, if it accesses the windows api, we''re happy

-- wAVaRiaN
Ok. Just to clarify....

I am a second year CS major that has had a few programming languages. To list, they are Fortran, Java (1 and 2), C++ (2 only...explain that one!!), Data Structures with C++, and some (and might I stress SOME!!) VB. The problem has been that I have not had much teaching in any of these. Even though I am being taught these languages from a Dr. o-programming, most of my actual learning is self taught from a book purchased at the local hastings or some online bookstore.

Want to know how bad the openGl is going? On that code to implement the solid cube and wire cube there were 5 out of 30 turned in that actually worked.

Anyway, to get off my soapbox...

I appreciate all the help from you guys. Even the statement that I need to learn C++ first. I agree completely!!


Keep helping all us little guys.


--David Johnson

--David
--David
you included the prototypes and got a redefinition error. this is because when you include the header files for glut these are already declared for you. meaning, the compiler already knows
what these functions are and how they are declared and is wondering why you are telling it twice.

this will cause a redefinition error, and maybe it makes more sense to you now?

void main()
{
int i=0;
int i=1;

return void;
}

so long answer made short, in your drawscene routine just USE the function as posted above:

glutSolidCube(4);

and you''re done.

as for learning c++ and opengl at the same time, the world is full of morons. it''s a shame, this is such an awesome site which is all about the sharing of information between people who have experience and those who don''t. if you can''t offer constructive comments you''re better off somewhere else where people are willing to tolerate you.

This topic is closed to new replies.

Advertisement