How do I start in graphics programming???


#1

Hi, I got a basic knowledge of c, c++, and I do wanna learn how to program in opengl, well basicly I just wanna start in 3d programming.
I got no idea about aps, can I use the microsoft programming enviroment to do it?
I´ll apreciate very much your help, thanks in advance.


#2

The question would be,
What do you want to program in 3d?

[ul]
[li]Games? (And if so, what kind? Web, desktop)[/li][li]We Plug-ins for 3d Apps?[/li][li]Web animations?[/li][/ul]
Answering this we might be able to help.
Suerte.

-R


#3

http://nehe.gamedev.net

That site has lessons from scratch to help you get started. It uses a library called GLUT which really simplifies the whole process of creating a window and setting it up to render in OpenGL. You will need a C/C++ compiler, and you’ll need to know how to use it, plus basic knowledge of how to build the EXE. You’ll need to link your program against the GLUT library, ect.

As far as tools, Visual C++ is the first thing that comes to mind. The standard version is only $99 USD, there’s plenty of free tools available. If you say you have a basic knowledge of C/C++, then I will assume you’re written some simple programs? And if you’ve written some programs already, then I will also assume you have a compiler to work with. Chances are, whatever you have, you can use it with GLUT to make OpenGL programs.


#4

The Visual C++ 2003 optimising compiler is free for download of the microsoft site. They also have the beta of the 2005 IDE available for free download. Only thing then left is the debugging tools, platform SDK, .NET SDK, DirectX SDK, all of which can be downloaded for free. (links via link below). Saves yourself some cash for the full on pro Visual C++ Setup…

gluts probably the easiest starting point, though longterm, the Win32 nehe framework would be more beneficial…

some links to get you started


#5

Mind if I join the discussion? This seems interesting to me too.

Rather than getting tutorials off the web, what would you guys recomend as books to get to learn graphics programming from? I am interested in game programming (desktop), but I don’t know whether I want to go for openGL or DirectX. I am already learning C++ from this book, and math from this one. I would think I need a very beginner book, so whatever book you know that is best for learning would probably be more important than opengl vs directx right now. Although, if the site is better than any book, then I should probably go with that :).

Oh, and for OpenGl, where would I get the sdk/glut? Thanks.


#6

The problem I got is that I don´t know how to add a library in my visual microsoft enviroment,
can you tell me how, or show me any tutorial for it?
thanks.


#7

I’m working in a Visual Studios 6 environment, so apologies if my ‘walkthrough’ doesn’t match your environment.

Whenever I add a library, I:

“Tools” -> “Options…”

Click on the “Directories” tab

Add the directory where the new lib’s include files are held.

Click on the pull down called “Show directories for:” and select “Library Files”

Add the directory where the “*.lib” files for your library are held, and do the same for any source files should the library come with them.

Hope that this helps,
Pete.


#8

MSDN is your friend

this is the subsection handling compiling & linking … via the menubar on the left you may get back to other sections that may of interest to you as well


#9

Thanks very much, that was very useful cause I got the 6 version too.

I will be asking as doubts come.


#10

Can anyone provide me with the gltk library?
cause I don´t find it on the net.


#11

A Google search for “GLTK” comes up with this site third on the list…

Unless you mean GLUT? In which case, the first google link is the one you’re after…


#12

To answer your question, starting with the sticky at the top of the page might have
helped :wink:

See my post on this thread

for a link to an

OpenGL/GLUT tutorial.

There is a wealth of info in this one thread alone.

Hope this points you in the right direction.


#13

You can also find the GLUT libraries at www.opengl.org. :slight_smile:


#14

Thanks thalaxis, I went to the page but when I try to open a sample in microsoft visual studio, it says that it cannot start the glut32.lib, so to say, I get you a picture. Please see if you can help me with this one, I wanna compile something in 3d…


#15

Did you make sure you added the glut32.lib to the project options? On project properties panel, there’s a linker options page.

This part I’m not too sure about, because I haven’t done it in a while, and I don’t have VC in front of me right now (I’m on a Linux box at work). Basically, one of the parameters on that page is a list of directories that the linker will look in for .lib files. Make sure one of them points to a directory containing glut32.lib. You can do that either by putting a copy of glut32.lib in a directory already on the list, or by adding an entry, it really doesn’t matter which one you choose as far as the linker’s concerned, but I generally prefer to add an entry.

Obviously, you have to make sure that you have the glut32 stuff compiled into a statically linked library for this to work.

Another option is to compile (or download) a .dll version of it, in which case all you need to do is either add it to your PATH or add the directory it’s in to the list in project options… I THINK you can add it to the same list as for the .lib, but I’ll have to take a look at it it to be sure.

I hope that helps!


#16

Hi

I’m in a similar boat here, I’m trying to learn graphics programming using the Cg language. Now I’m quite clear on how to write the actual shader programs, my problem is actually writing the simple applications that use these programs. All the examples I have found use OpenGL as part of the application, as well as the Cg shaders. This is OK, as I am currently learning OpenGL in uni, but I was wondering if it is necessary, and also if anyone can give me an idea of what I have to do in my application? Can anyone recommend any books or tutorials that teach you how to set up this kind of application, as everything I have found basically refers to the functions for loading a Cg program into your application, but not actually how to use it?

Thanks
Twib


#17

Tricks of the 3D Game Programming Gurus-Advanced 3D Graphics and Rasterization
by André LaMothe

Tricks of the Windows Game Programming Gurus (2nd Edition)
by André LaMothe

You guys might want to try the books above. I read the 2d version and it’s pretty nice. He explains how to make your own windows without GLUT. Instead you use straight windows API, which is good since you’ll have more control. I think in the 3d version he explains how to write your own software 3d engine (ie your own OpenGL). Plus, he explains all the math involve and the language he uses won’t bore you. Oh, of course he explains how to program games on your pc, the control structures involved, and more.


#18

Thanks, I now have one of those books, with the other one in the post. I have made slight progress since my last post, but I’m afraid I now have another cry for help! OK I have found out how I write a very simple C program that uses OpenGL and Cg to display a simple model. However all I get when I run the program is a blank window. The programs I have just use a very simple passthrough shader for both vertex and fragment, that I have written in Cg. Both of these should work or at least do something, as I test compiled them with the Cg compiler, to produce no errors. I also know that my C program is OK as if i take out the Cg shaders it just uses the OpenGL inbuilt pass throughs and displays what it is ment to. I have tried to use both Visual C++, and the command prompt to run the program, MSVC++ gives me the blank screen, while the command prompt doesn’t recognise either glut or Cg just giving compile time errors, dispite the fact I tried to setting some environment variables. Clearly something hasn’t been setup, or hasn’t been setup right, but I’m pulling my hair out trying to figure out what! I’d be very greatful to anyone who could offer any help/suggestions on this.

Many Thanks
Twib


#19

hey Twib!

how does your command line instruction look like? Usually you have to type your lib as well as the compile function. On Windows something like:

cl my_prog.c glut32.lib

For VC++ i recommend always to have a look at http://nehe.gamedev.net. You can compare your app with that one’s of the site to find out what’s wrong.


#20

I think some of you should stop and sit back and ask yourself what you want out of “graphics programming”. It is a broad field and as such, some approaches may be more desirable than others. If you want to learn realtime graphics programming, then by all means start with a graphics API like OpenGL or Direct3D. However, this doesn’t give you much theory about graphics in general. Since most of you know C/C++, getting the hang of any graphics API will be trivial.

What the “real” meat is in graphics programming is knowing about the entire graphics pipeline and the countless algorithms to achieve the things that are done using graphics programming. In this regard, the scope becomes much larger and will require mastery of several math concepts. I would recommend reading and with reading understanding before doing the trivial tasks of getting a window and pushing some triangles through the renderer to get a quick realtime render.

Cheers,

-M