PDA

View Full Version : opengl documentation ?



02-06-2002, 05:54 AM
Hi,
i'm new to opengl programing and i am having troubles to simply find the documentation for it.

I have already made a few things with DirectX, and i wondered if there was a documentation similar to the one given with the DirectX sdk (this document contains the description of the DirectX functions, notes from authors, ..., and i would need the same for opengl)

Miguel_dup1
02-06-2002, 06:11 AM
go to nividia's page... www.nvidia.com (http://www.nvidia.com) http://www.opengl.org/discussion_boards/ubb/smile.gif

02-06-2002, 06:23 AM
Well, i already went to nvidia's site, but i don't know what to take.

In fact, i am learning opengl init right now, and looking at some tutorials code, i see some functions and i wonder what they do... i would need a doc describing the opengl functions.

For exemple, in some tuts, they call the DescribePixelFormat, and in some other tuts, they don't call it... naturally, that excites my curiosity, then i would like to get a simple doc where the functions are listed and described briefly.

Thanks for your reply, i'll dig in nvidia's site, but could u give me the name of the document i have to look for please ? or maybe a link ?

nexusone
02-06-2002, 06:31 AM
There is complete on-line documentation on this site, on the main page you can do a search for any Opengl function.

If you have not noticed there are lot's of book's on Opengl programming.

Also book's on-line, the openGL reb book is a good source on command usage.

Red book (http://ask.ii.uib.no/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_PG/)



Originally posted by charly:
Hi,
i'm new to opengl programing and i am having troubles to simply find the documentation for it.

I have already made a few things with DirectX, and i wondered if there was a documentation similar to the one given with the DirectX sdk (this document contains the description of the DirectX functions, notes from authors, ..., and i would need the same for opengl)

[This message has been edited by nexusone (edited 02-06-2002).]

[This message has been edited by nexusone (edited 02-06-2002).]

02-06-2002, 06:35 AM
Thanks for your help.

jmathies
02-06-2002, 06:37 AM
Visual C++ has full context sensative help
for all GL and GLU functions. Just type a function name, highlight it and hit F1.

02-06-2002, 07:17 AM
Hmmm, one more thing,
i got it working a little bit now and i identified the source of the problem.
When i don't set up the projection and model matrices it seems to work. (i draw in 2D now)

Here is my code initializing the matrices :
//create a perspective projection
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();

gluPerspective (45.0f, (GLfloat) m_dwWidth / (GLfloat) m_dwHeight, 1.0f, 100.0f);

//switch to our model matrix stack
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();

Do you see something wrong in it ?

PS: i should still be able to draw in 2D even after having set up these matrices no ?

Lev
02-06-2002, 07:24 AM
If you're drawing 2D you should set up an orthographic projection and not a perspective one:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
now either
gluOrtho2D(..)
or
glOrtho(..)

-Lev

02-06-2002, 07:32 AM
Sure, if i WANTED to draw 2D, actually, i draw 2D to try to make my code work.

I use the glVertex2i function to do so, and i feel like it draws on the screen plane, right ? (these are pre-transformed vertices who dont store homogeneous information, they are considered as already transformed (their range is of course [-1,1]))

If yes, it should be independent of the matrices, and should be directly shaded/drawn on the buffer, i guess.

If no, then it is normal that i have a diferent result when using this function after having set up the matrices or not...

I hope i am understandable.

Lev
02-06-2002, 11:53 AM
The result *does* depends on how you set up your matrices, thats what matrices are for.

-Lev

Bob
02-06-2002, 11:11 PM
I use the glVertex2i function to do so, and i feel like it draws on the screen plane, right ? (these are pre-transformed vertices who dont store homogeneous information, they are considered as already transformed (their range is of course [-1,1]))

glVertex2i(x, y) is EXACTLY the same as calling glVertex4i(x, y, 0, 1). It has nothing to do with pre transformed coordinates, non homogenous coordinates, window coordinates, or anything like that. They are transformed like any other vertex, in exactly the same way. The 2-parameter vertex commands adds two components (z=0 and w=1), and the 3-parameter commands adds one (w=1). In the end, you are always specifying a four-component vertex, either directly, or by letting OpenGL add the missing components.

02-07-2002, 12:40 AM
I figured out what the glVertex2i function does during the night, and it is not at all what i thought it did.

Anyway, now i set up my matrices correctly everything goes fine.

OpenGL seems to be very powerfull by it's simple approach, i prefer that type of approach than the DirectX's one which hides everything behind complex stuff.
Why do most of the people in the game industry use DirectX ?

Thanks for your help.

marcus256
02-07-2002, 01:54 AM
Originally posted by charly:
Why do most of the people in the game industry use DirectX ?

The usual... DirectX is M$'s prefered way of doing things, and they tend to get what they want. http://www.opengl.org/discussion_boards/ubb/frown.gif They could just as well have gone for OpenGL years ago, but then they would not have 100% control over things. (Ooops - carried away again - hope this does not turn into another OpenGL/DirectX war).