No idea how to start

I’ve actually figured out the problems I’ve been having, and am following this tutorial to learn openGL: http://www.arcsynthesis.org/gltut/

If you would like to help me, just check out the latest post in this thread. I’ll keep all my problems together in one thread, rather than a new thread for each.

This was what this thread was initially.

[i]So I’ve spent the last few hours scouring google for answers and haven’t gotten anything. I have a decent knowledge of c++ and Microsoft visual studio set up, and I just can’t get any openGL programs to work. The problems are weird and the programs I copy/paste are always missing stuff (even with all the include files working fine). For example I copy-pasted the code from this page: An intro to modern OpenGL. Chapter 2: Hello World: The Slideshow and there’s 3 things I’m missing apparently (‘render’ and ‘update_fade_factor’ are undeclared identifiers and ‘make_resources’ can’t be found.) and somehow the code used by the originator worked just fine.

I’m pretty newbie, and I just want to play with this thing, but it’s impossible to even get a blank window. All tutorials I have found are either outdated or assume you know how to get everything perfectly set up.

I’m eager to learn, but I can’t even start with all this crap getting in the way. If I can just make a blank window that would be totally awesome, and I could work my way from there.

PS: freeImage has no freeImage.lib file included with it now, which is annoying since tutorials using it require that this file be included.
PSS: VS refuses to acknowledge the existence of glaux.h, but it recognises all the other files in the same folder. This is really frustrating and makes no sense to me.

Any help/guidance is very much appreciated.[/i]

http://www.arcsynthesis.org/gltut/
This one should have everything you need. The author is often around these forum if you need help.

“The source to this tutorial, found in Tut1 Hello Triangle/tut1.cpp, is fairly simple. The project file that builds the final executable actually uses two source files: the tutorial file and a common framework file found in framework/framework.cpp. The framework file is where the actual initialization of FreeGLUT is done; it is also where main is. This file simply uses functions defined in the main tutorial file.”

Where am I meant to get these?

Where am I meant to get these?

Maybe from the page that explains how to build the tutorials. :wink:

The book is meant to be read front-to-back.

“MSVCRTD.lib(wcrtexew.obj) : error LNK2019: unresolved external symbol _wWinMain@16 referenced in function ___tmainCRTStartup”

I’m about to give up. I’m frustrated beyond belief

If you’re so frustrated, just stop already and come back to it when you’ve calmed down.

If there is a problem, you need to explain the steps you took that led to the problem. Simply posting an error message isn’t helpful to anyone.

Ok I calmed down, and am following this: http://www.arcsynthesis.org/gltut/Building%20the%20Tutorials.html

I’m at this line: “The SDK his library uses Premake to generate its build files. So, with premake4.exe in your path, go to the glsdk directory. Type premake4 plat, where plat is the name of the platform of choice (Type where???). For Visual Studio 2008, this would be “vs2008”; for VS2010, this would be “vs2010.” This will generate Visual Studio projects and solution files for that particular version.”

I got no idea wtf it’s talking about. I downloaded premake4 which when run opens a console window and quickly dissapears. What am I suppose to be doing here? where do type this stuff?

As stated at the top of the page, “You will need minimal familiarity with using the command line in order to build these tutorials.” You type that line into the command line. If you don’t know what that is… I’m not sure how much I can help. I don’t know of any Windows help pages that explain what a command prompt is and how to use it.

I TYPE THat line in command prompt and nothing happens. I’m in the directory.

Good news folks I did a crash course in command prompt and got it working. Just want to say, despite my frustration, you guys have actually helped a lot! I’m going to continue to bump this thread with my problems as I come accross them. You may respond or not as you see fit, but I do want to thank you helpful folks for your replies.

Just a quick question: vectors ( with x,y,z) for opengl have no relation to the vectors in c++ right (the “vector<string> words”)? Or are they somehow related?

No, none whatsoever - and a vector is not an OpenGL concept as well. In mathematics, an n-component vector is an entity of an n-dimensional vector space, i.e. a 3-component vector is an entity of the R^3. A std::vector in C++ is simply a dynamically growing (or shrinking if demanded) container with an internal C-array. C-arrays are also referred to as vectors (or sometimes as fields) but essentially represent nothing else than a contiguous, one-dimensional area in memory.

Since vectors are used to describe positions and directions in space and linear transformations between vector spaces are an essential concept in computer graphics - as is linear algebra in general - it is no coincidence you have to deal with such entities when doing graphics programming with OpenGL. When you define vertex attributes, you’ll do it using vectors. When doing a transformation from object space to eye space, you’ll do a linear transformation from R^4 to R^4 using a 4x4 matrix (or 3x4 to spare your shader the 4th row being (0,0,0,1)).

Ok so, I have these boolean arrays created in one of my header files above a bunch of functions that use them:

bool* keyStates = new bool[256]; // Create an array of boolean values of length 256 (0-255)
bool* keySpecialStates = new bool[246]; // Create an array of boolean values of length 246 (0-245)

And for some reason, I get this compiler error:

error LNK2005: “bool * keyStates” (?keyStates@@3PA_NA) already defined in main.obj
error LNK2005: “bool * keySpecialStates” (?keySpecialStates@@3PA_NA) already defined in main.obj

I’m not sure what this means, even after googling it. These are the only declarations of these arrays in the program, they are right before the functions they are used in.

Help is appreciated!

Rename your vars with something silly like append AAA to the name to rule out any name collision.
Maybe your project tries to link the same file twice ?

No they’re still apparently already defined in main.obj

If I cut and paste these lines into the .cpp file (this file doesn’t contain main, just a bunch of functions) that has all the functions declared in the .h file, the whole thing compiles and works fine. However this feels messy. Is it normal to declare variables like this? or is there a way I can have these in the header file?

Ok so, I have these boolean arrays created in one of my header files above a bunch of functions that use them:

OK, it seems clear at this point that you’re not very experienced with C/C++. I would strongly advise you to stop working on graphics and spend some time learning the ins and outs of C++. Graphics programming is hard enough; you don’t want to compound it by not having firm foundation of how the language you’re using works.

The particular problem you’re encountering has to do with the difference between a declaration and a definition in C/C++. You’re defining the same global variable in multiple .cpp files (through the inclusion of the same .h). That’s not allowed. You are allowed to declare the same global variable in multiple .cpp files, but it can only be defined in one of them. More information can be found here.

Also, do note that this is an OpenGL forum, not a general programming issues forum.

[QUOTE=Alfonse Reinheart;1239587]OK, it seems clear at this point that you’re not very experienced with C/C++. I would strongly advise you to stop working on graphics and spend some time learning the ins and outs of C++. Graphics programming is hard enough; you don’t want to compound it by not having firm foundation of how the language you’re using works.

The particular problem you’re encountering has to do with the difference between a declaration and a definition in C/C++. You’re defining the same global variable in multiple .cpp files (through the inclusion of the same .h). That’s not allowed. You are allowed to declare the same global variable in multiple .cpp files, but it can only be defined in one of them. More information can be found here.

Also, do note that this is an OpenGL forum, not a general programming issues forum.[/QUOTE]

pfft
Nahh I’m doing fine. I already got cubes an am about to animate them.

And sorry i forgot this was opengl specific. I’ll try to keep it as such.

pfft Nahh I’m doing fine.

It’s always good to arrogantly dismiss a sound advice by an experienced developer which is obviously more than justified… :doh:

I didn’t mean to be arrogant, sorry if it seems I was. At the time of reading this, I was (and still am) going strong in openGL, and think I can start creating some interesting programs soon with current knowledge.

I don’t know about the others, but to me it seemed to be. You need to plan ahead. Most interesting programs aren’t easily developed without proper knowledge of the programming language and libraries involved. Otherwise you’re going to trip and fall many many times. Personally fully I support Alfonse’s suggestion.