Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

OpenGL - Getting started


  • Please log in to reply

#1
tomPee

tomPee

    New Member

  • Member
  • Pip
  • 4 posts
Hi, so i'm Tom.

I believe i've ran for help to this forum once before, i was quite desperate about some desktop-hijack thingy that was doing what it does :help:
Well, now i'm becoming quite desperate again and i believe i could find salvation here.

I've got about, a problems and a question. I'll start out with the problem.
I've started downloading OpenGL ( I have Microsoft Visual C++ 2005 ( enterprise ) installed so should already have the glu32.dll and the opengl32.dll, and i do have those, confirmed it by searching for em , yay ! ) So then i started downloading the glut API ( i believe it is an api right :whistling: ? ). Now he problem is that these api's have an
#include <windows.h>
And, thats my problem... I don't seem to have any windows headers... Or i'm just to stupid to be able to find them which i do believe might be a possibility. Now they are suposed to come automatically with Microsoft Visual C++ right ? Or doesn't that count for the Enterprise version. Because i'd really need them to be able to use any bit of OpenGL at all.


Then, the question :).
Would anybody of you perhaps now a good book that starts out with basic OpenGL and provides quite a bit of information about Graphics Algorithms like Shading, RayTracing and those kind of algorithms.
Actually the only thing i really want to use form OpenGL ( if that's possible ) would be to draw lines and and color pixels in a Window. Because i basically want to implement the algorithms myself. Got to Backface culling, HiddenLine Removal, Depth Buffering programmed in Oberon. That's a language that you can't find anything about :help: We learned that at college and now we got an introduction to c++, so my plan this summer is to put my 3D Engine (... noobish engine, but , heck with it :)) in c++ using OpenGL, or any other program that would give me the opportunity to open a window in which i can render and stuff.
So, if anybody would be able to help me out here ? So far i've found two books that sound promising.
-Computer Graphics With OpenGL ( 3/E ) - Donald Hearn & M. Pauline Baker
-Computer Graphics: A mathematical introduction with OpenGL - Samuel R. Buss ( which i already found in e-book version )

I have a book "Computer Graphics using OpenGL" - F.S. Hill, Jr. ( international edition )
But this one seems to date from 2001... Still living in the times of windows 95 and 98. Now, i wouldn't mind this so much if not all the information about OpenGL, or more so, about obtaining and installing it is very limited and most often outdated and wrong.
I've looked at e.g. www.opengl.org but that site is a terrible mess, not clear at all, so much texts and not a single handy direction.
So my biggest problem after all seems to be in actually getting the right OpenGL files at the right locations with the right libraries installed at the right locations, and then getting the whole to compile. Because ( i also never used Microsoft Visual C++ before ) i also don't know how to 'add extra libraries to projects????' with Visual C++. Well, quite new to C++ too, but that shouldn't be a problem.

Well if anybody could shed some light on this for me i'd be absolutely totally gratefull, i'd even be inclined to yell a sincere
"ME LOVE YOU LONG TIME !!". That must count for something :blink:

Thanks a million in advance,
-Tom
  • 0

Advertisements


#2
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts

how to 'add extra libraries to projects????'


Not 100% on these directions, as I use Visual Basic 2005 Express, but it should be more or less the same.

Go to: Project > Add Reference > COM > (your needed dll) > Ok.

Hopefully that helps.

Quick question for you: Why OpenGL? Not that there's anything wrong with it, but you'd probably have a lot easier time finding books for C++ about DirectX.
  • 0

#3
tomPee

tomPee

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts

Why OpenGL? Not that there's anything wrong with it, but you'd probably have a lot easier time finding books for C++ about DirectX.

First of, Thanks for the reply ! :help:


Well, to be honest, i don't quite know why OpenGL. I think it'd be easier than DirectX, and i don't know if DirectX is free or not :blink:. I'd be happy to use whichever i can get working, be it DirectX, or OpenGL.
Is DirectX better than OpenGL? Because i know even less about DirectX than OpenGL, which most likely isn't even possible anymore.
The initial idea was i guess, i had a computer graphics book, and it used OpenGL, so from there the OpenGL part. Now it seems that the book dates from 2001 so i don't quite mind getting a new book if DirectX would work better.
Do you perhaps know any good computer graphics book using DirectX ?
Thanks in advance :whistling:

-Tom
  • 0

#4
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
Both OpenGL and DirectX are very difficult to master, especially in an already difficult language like C++.

Both DirectX and OpenGL are free to program with, and it's also free to run programs that use either DirectX or OpenGL.

The main difference is that DirectX is made by Microsoft, for Microsoft. So, if you use DirectX, your programs will only work (natively) on Windows computers (with a compatible graphics card, of course). OpenGL is supported on all major operating systems. Programs using OpenGL will work on any computer (again, a compatible graphics card is required).

So, which one to choose? For your needs, either should be fine. Most major 3d game programmers use DirectX, mainly because it is more powerful and flexible. However, until you get into super advancing shading and the like, OpenGL can perform just as well as DirectX.

Unfortunately, I don't know any good books on either OpenGL or DirectX using C++. You might want to check on amazon.com and read the user reviews for books.

A final note: Don't be too worried about the age of your book. For some programs I have made, I use DirectX7 (the most current version is DirectX10) because it fits my needs. So, even if your books tells you how to use older versions of OpenGL (the most current version is 2.1), if it does what you want, it doesn't really matter.
  • 0

#5
tomPee

tomPee

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
I see :help:

Well i got OpenGL to a near - working status now. It appeared that i had to download a windows SDK to get all the needed headers, libraries and such. Then i installed and after much cursing and browsing forums i found that i had to put a platformSDK map in my visual c++ / VC map :blink:

So, now i got this simple program, that actually shouldn't do much more than spawn a window.

// OpenGLTestN1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <windows.h>
#include <GL/GL.h>
#include <GL/GLU.h>
#include <GL/glut.h>

void myDisplay(void);
void myReshape( int, int);
void myMouse(int, int, int, int);
void myKeyboard( unsigned char, int, int);
void myInit(void);

void main( int argc, char** argv )
{
	glutInit( &argc, argv ); //Initialize the GL Toolkit.
	glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB ); //Set the display mode
	glutInitWindowSize( 640, 480 );	//Set window size
	glutInitWindowPosition( 100, 150 ); //Set the window position on the screen.
	glutCreateWindow("My first attempt!" ); //Open the screen.

	//Register the callback functions.
	glutDisplayFunc( myDisplay );
	glutReshapeFunc( myReshape );
	glutMouseFunc( myMouse );
	glutKeyboardFunc( myKeyboard );	

//	myInit();	//Additional initializations as necessary.
	glutMainLoop();	//Go into the perpetual loop.
}

But i get following errors:

1>OpenGLTestN1.obj : error LNK2019: unresolved external symbol "void __cdecl myKeyboard(unsigned char,int,int)" (?myKeyboard@@YAXEHH@Z) referenced in function _main
1>OpenGLTestN1.obj : error LNK2019: unresolved external symbol "void __cdecl myMouse(int,int,int,int)" (?myMouse@@YAXHHHH@Z) referenced in function _main
1>OpenGLTestN1.obj : error LNK2019: unresolved external symbol "void __cdecl myReshape(int,int)" (?myReshape@@YAXHH@Z) referenced in function _main
1>OpenGLTestN1.obj : error LNK2019: unresolved external symbol "void __cdecl myDisplay(void)" (?myDisplay@@YAXXZ) referenced in function _main
1>C:\Documents and Settings\Tom\Mijn documenten\Visual Studio 2005\Projects\OpenGLTestN1\Debug\OpenGLTestN1.exe : fatal error LNK1120: 4 unresolved externals

Now, i suppose this has something to do with the linking of the libraries, GLU32.lib, OPENGL32.lib and glut32.lib. Because, i have to admid, i have no idea how i must link libraries decently to a project in Microsoft Visual C++ Enterprise 2005.
I don't find any apparent way to do so, so, in all my creativity, which isn't all that impressive :help: i did
project properties > add > existing file > ( show all files ) And added all the libraries to the project in a way i don't know if it is correct, but i do get more errors if i delete them from my project, so i suppose they do some good after all.

If you have any idea how i must resolve this annoying little problem i'd be eternally gratefull :whistling:
Thanks once more for the reply ! :)
Cheers !

-Tom

Edited by tomPee, 02 June 2007 - 01:53 PM.

  • 0

#6
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
I haven't been able to find out much about your problem. One thing I could think of is: Perhaps you need even more libraries?
  • 0

#7
tomPee

tomPee

    New Member

  • Topic Starter
  • Member
  • Pip
  • 4 posts
Well, i've figured it out... And it makes me feel stupid :whistling:

I have put that code, and my declarations of the functions i'm using. But i never gave the definition...
So i put {} behind each function declaration and it worked :blink:

Thanks for your help though!! It's really appreciated, so you've earned a sincere
ME LOVE YOU LONG TIME !


Greets,
-Tom
  • 0

#8
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
:blink: Congrats! Glad I could help. :whistling:
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP