News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Stupid Question

Started by FlyingIsFun1217, March 16, 2007, 01:05:15 AM

Previous topic - Next topic

FlyingIsFun1217

Hey, I'm back to bother again! :P

This time my question is simple. The answer isn't though, I'm sure.
What I am interested in doing is learning openGL, preferably using Code::Blocks to learn. What needs to be done before I can create my first app using OGL? Is there anything in particular that I need to download? Is there a way I need to set it up in C::B to compile right?
Also, are there any good tutorials that anybody knows of? I prefer anything without use of the Win32 API. I'm a wxWidgets kinda guy :)

Please don't consider this spam or off-topic. I just want to know this stuff before diving into OGL :)

Thanks!
FlyingIsFun1217

Auria

#1
You need to install OpenGL (duh! i'm being helpful :p ) and some windowing toolkit (GLUT, GLFW, SDL, wxWidgets, etc.) depending on your needs.

For Code::Blocks... just learn how to add header include paths and libs to it, should work the same with pretty much all libs.

courage

Quote from: FlyingIsFun1217 on March 16, 2007, 01:05:15 AM
Also, are there any good tutorials that anybody knows of? I prefer anything without use of the Win32 API. I'm a wxWidgets kinda guy :)

NeHe OpenGL tutorials is the best tutorials I ever seen!
http://nehe.gamedev.net/

However, I consider you don't need to install OpenGL,
if you have an OpenGL accelerator video card or you don't use Win95/98.
Then, you could download any toolkit you like to instead of Win32 API.
I recommend SDL, because it supports the most platforms and has many optional packs to use.
(But in my early experience, glut seems to flip the video buffer more smoothly then SDL.
It's very strange. :?)

FlyingIsFun1217

So really, everything that I need for coding in OGL is the machine I already have? I assume that there would be more setup to it than that... :)

I did see the NeHe tutorials, and they seemed great! The only problem I saw with them was that they all had refrences to the win32 API, which of course I wouldn't want to use.

I guess I can look more into using wxWidgets to display the OGL stuff. From what I've heard, it's not that easy though (Auria, can you say whether or not it's very difficult?), but nontheless, I will look into it :)

Thanks!
FlyingIsFun1217

Auria

#4
Quote from: FlyingIsFun1217 on March 16, 2007, 05:32:48 PM
So really, everything that I need for coding in OGL is the machine I already have? I assume that there would be more setup to it than that... :)

I did see the NeHe tutorials, and they seemed great! The only problem I saw with them was that they all had refrences to the win32 API, which of course I wouldn't want to use.

I guess I can look more into using wxWidgets to display the OGL stuff. From what I've heard, it's not that easy though (Auria, can you say whether or not it's very difficult?), but nontheless, I will look into it :)

Thanks!
FlyingIsFun1217

Take a look here http://wxforum.shadonet.com/viewtopic.php?t=13195 at the bottom of the page i gave a sample of how to do it to a guy. Of course it depends what you want to do. I would recommend wxWidgets for applications, but if you want to make a game then GLFW or SDL would be more appropriate

FlyingIsFun1217

Ok, I'll look in-depth on that information.
To me, it doesn't matter whether or not I use wxWidgets, or some other windowing toolkit, as at this point I just want to learn OGL. Nothing more, Nothing less. Learn how to use it, that is all.
Eventually I of course want to do something with it (hopefully learn how to do culling and all the other stuff needed to make a simple landscape engine and what not), but like I said, easiest road is what I'm looking for :)

Thanks again for your help!
FlyingIsFun1217

courage

#6
Quote from: FlyingIsFun1217 on March 16, 2007, 05:32:48 PM
So really, everything that I need for coding in OGL is the machine I already have? I assume that there would be more setup to it than that... :)

It's really, you can see your include and lib directories
if there are gl.h, glext.h, libgl.a or libopengl.a or opengl32.lib...etc, and it's the part of libraries.

And if you have a cheap nVidia or ATI video card and install the official hardware driver,
there is the hardware driver support for OpenGL.
If you use win95/98, you have to download opengl95.exe to setup.
If you don't use win95/98, you have to do nothing to setup.

Quote from: FlyingIsFun1217 on March 16, 2007, 05:32:48 PM
I did see the NeHe tutorials, and they seemed great! The only problem I saw with them was that they all had refrences to the win32 API, which of course I wouldn't want to use.

There are many samples with different toolkits to download after each tutorial.
If you look at three or more sample codes,
you will find the principle of coding is the same. :)

Quote from: FlyingIsFun1217 on March 16, 2007, 05:32:48 PM
but like I said, easiest road is what I'm looking for :)

I think there is no royal road to program RAW OpenGL program.  :wink:
But there are surely some frameworks like Ogre to help you to make a application quickly.
Nothing but you have to learn how to use these frameworks. :D

FlyingIsFun1217

 :D
Glad everybody is so helpful :)
I think what I will try to do is use GLUT to do the windowing, and from there, it'll be easy to learn OGL.
Thanks for the help everybody! If I find anymore troubles... well, I'll be back ;P

FlyingIsFun1217 :)

FlyingIsFun1217

Ok, went and downloaded the GLUT stuff, but... I'm not quite sure where to put it!
I read that you need to put it in your include directory, but C::B doesn't seem to have one. Where can I put these files so that I can use GLUT by including <GL/glut.h>?

Thanks again!
FlyingIsFun1217

Biplab

It's simple. Simply paste your those files inside C:\MinGW\include folder. So after pasting, glut.h file should be inside C:\MinGW\include\GL folder. :)
Be a part of the solution, not a part of the problem.

FlyingIsFun1217

How stupid of me to think that the editor had an include folder :P

Thanks so much! I really appreciate your help!

FlyingIsFun1217

FlyingIsFun1217

Ok, I seem to be able to get it set up fairly well, except for one thing.
In some sample code provided by a tutorial at lighthouse3d.com, the following code

#include <GL/glut.h>

void main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("3D Tech- GLUT Tutorial");
}


Gives me the error:

QuoteC:\Documents and Settings\tanner\Desktop\CodeBlocks\Projects\GLUT-Test\GLUT-Test.cpp:4: error: `main' must return `int'
C:\Documents and Settings\tanner\Desktop\CodeBlocks\Projects\GLUT-Test\GLUT-Test.cpp:4: error: return type for `main' changed to `int'
:: === Build finished: 2 errors, 0 warnings ===

I assume that this is a code error? If it's a setup error, how do I fix this?

Thanks!
FlyingIsFun1217

Biplab

Try the following:

#include <GL/glut.h>

int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("3D Tech- GLUT Tutorial");
        return 0;
}
Be a part of the solution, not a part of the problem.

Auria


FlyingIsFun1217

Yes, it seems that I pasted code without thinking first. Forgot the return statement!
After replacing my glut files and restarting codeblocks, I seem to have everything right, but now I get:

Quoteobjects\main.o:main.c:(.text+0x2f):: undefined reference to `__glutInitWithExit'
objects\main.o:main.c:(.text+0x3b):: undefined reference to `glutInitDisplayMode'
objects\main.o:main.c:(.text+0x50):: undefined reference to `glutInitWindowPosition'
objects\main.o:main.c:(.text+0x65):: undefined reference to `glutInitWindowSize'
objects\main.o:main.c:(.text+0x7a):: undefined reference to `__glutCreateWindowWithExit'
:: === Build finished: 5 errors, 0 warnings ===

This sure seems to be something with minGW not recognizing something of glut's?

Thanks again for your help!
FlyingIsFun1217