Thread: I want to learn openGL......... but

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    33

    I want to learn openGL......... but

    No doubt openGL is far superior compared to directX. In addition to bein avaliable for multiple platforms, it also has more features than DirectX.

    But still I can't find ANY good tutorials for programming openGL in LINUX. Right now I'm fluent in DirectX & C++, but I want to extend my grip to linux, my primary operating system.

    Also, it seems there is more to openGL than just.... openGL. I've heard that it can only draw primitives. I know that primitives make up everything in any graphics language, but what I'm talking about is that it can't load models. I've heard of things like Crystal Space, and ogre that advertise the ability to easily load models and scenery, but I tried Crystal Space in linux, and it is so poorly documented I didn't even know where to start.

    So is there a way to load model files in openGL similar to how DirectX loads .x files?

  2. #2
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Nope. And yes I agree that Crystal Space is hard and poorly documented. Personally I'm going to be using irrlicht.sourceforge.net/ for anything I do related to 3d graphics. Extremely easy and I believe it supports DirectX meshes (along with 3DS, Quake maps, etc).

  3. #3
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    DirectX is a combination of sound, input, and graphics libraries, so in that sense is far beyond OpenGL. However Direct3D compared to OpenGL is no contest. OpenGL is cross compatible (only real thing that makes it superior), and generally easier to use and learn, but I wouldnt go as far as saying has more functions. I mean sheesh Direct3D library is huge. However little things make it better, like conditionally better renderings, and that new functions can be implimented and used by hardware manufacturers with OpenGL, but not Direct3D without having M$ hardcode it in. Of course you can mix other input, sound, etc. libraries with OpenGL so thats cool.. and it seems like the company developing OpenGL is making those libraries too, which would put "Open" up there with DirectX.

    From the links topic in this forum:

    _OpenGL:
    |-- OpenGL (official) - http://www.opengl.org/
    |-- NeHe Productions - http://nehe.gamedev.net/ //great start to OGL 3D programming
    |-- Red Book I - http://www.opengl.org/documentation..._1.0/index.html //eBook
    |-- Megabyte Softworks - http://www.megasoft.wz.cz/main.php
    |-- Cone3D - http://cone3d.gamedev.net/cgi-bin/i...ls/ogladv/index
    |-- Null Terminator - http://www.nullterminator.net/opengl32.html //opengl/c++/win32 tutorial
    |-- Delphi3D - http://www.delphi3d.net/listfiles.php?category=2 //opengl/delphi demos
    |-- Lighthouse 3D - http://www.lighthouse3d.com/opengl/ //tutorials
    |-- OpenGL Source - http://www.openglsource.com/ //CHINESE

    NeHe's teaches pure OpenGL after you setup how you plan on creating your window. It also converts it to many types of code or for different compilers at the bottom of each tutorial. For windows you would use win32 API, for linux.. I dont know, it shows you on the first tutorial page. Then there are extensions to OpenGL, which do all that work of which OS you are using OpenGL on for you, you just use their library thats cross-platform (usually). I prefer Qt as an extension to OpenGL.

    The Red Book II is a good OpenGL book, but I is free so you could start there.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  4. #4
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Quote Originally Posted by Dae
    DirectX is a combination of sound, input, and graphics libraries, so in that sense is far beyond OpenGL.
    Well, DirectX is a combination of Sound (DirectSound), Input (DirectInput) and Graphics (DirectDraw and Direct3D), but doesn't OpenGL have all that? I mean input and graphics are handled by opengl itself, and sound is handled by OpenAL.. right? Or am I missing something?
    what does signature stand for?

  5. #5

    Join Date
    May 2005
    Posts
    1,042
    OpenGL handles graphics and nothing else
    OpenAL handles audio and nothing else

    You get to do everything else.
    I'm not immature, I'm refined in the opposite direction.

  6. #6
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by Ruski
    Well, DirectX is a combination of Sound (DirectSound), Input (DirectInput) and Graphics (DirectDraw and Direct3D), but doesn't OpenGL have all that? I mean input and graphics are handled by opengl itself, and sound is handled by OpenAL.. right? Or am I missing something?
    OpenGL is just graphics (thats the G part) rendering and such. Though there are 'extensions' and such like GLUT that you can use for buttons/events/etc.

    A lot of people use SDL (http://www.libsdl.org) and OpenGL together, SDL handles low level input, sound, etc.

    Open*insert letter here*L is not exactly some kind of company, it means its a library that is open source I believe, and the people making different libraries arent necessary affiliated (though they generally are), because using 'Open*something*L' isnt some copyright to a company, and if a group comes along and sees a library needed develop it under the Open name. That means OpenGL is just 1 library, and so is OpenAL, etc. while DirectX is something like 4 libraries. Theres advantages and disadvantages of this of course, however the fact that the Open products/SDL are cross-platform own DirectX.

    We've got OpenGL (http://opengl.org) which is a trademark of SGI (http://www.sgi.com), where they have more specific API's using OpenGL API's using OpenGL (http://www.sgi.com/products/software/): OpenGL Multipipe™, OpenGL Multipipe™ SDK, OpenGL Performer™, OpenGL Vizserver™, OpenGL Volumizer™. From the Khronos Group (seperate, member founded, http://www.khronos.org/) we've got OpenGL|ES, OpenML, OpenVG, OpenMAX coming. It looks like OpenGL|ES is an extension of OpenGL just like all the other extensions. OpenML/VG/MAX each handle some video/flash input kind of thing, so you can use those if you need that done. Then you have OpenAL (http://openal.com), which looks like its being developed by Creative (http://developer.creative.com/, sound card people), and has been extensively tested on a fair amount of games, but still quite new.

    I wonder if you can use OpenGL/SDL but use OpenAL audio instead of SDL's. If so I'd use that combo, if not id use the OpenGL/SDL combo, then add an extension for buttons and such like GLUT, or Qt (I've listed most of the extensions available in the Links topic).
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  7. #7
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,071
    How about using FMOD for audio??

    -psychopath
    M.Eng Computer Engineering Candidate
    B.Sc Computer Science

    Robotics and graphics enthusiast.

  8. #8
    ---
    Join Date
    May 2004
    Posts
    1,379
    I would also recommend FMOD. I haven't used it extensivly but I have looked into it and it seems very good.

  9. #9
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,071
    It is. I would recommend FMOD above everything else. In my opinion, its the easiest to use (as long as you read some of the documentation ).

    -psychopath
    M.Eng Computer Engineering Candidate
    B.Sc Computer Science

    Robotics and graphics enthusiast.

  10. #10
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    SDL is pretty good and easy to learn and cross-platform.. but I still didnt find out how to render opengl stuff (scenes) on an sdl screen.. should I specify some settings in the SetVideoMode or something?
    what does signature stand for?

  11. #11
    myNegReal
    Join Date
    Jun 2005
    Posts
    100
    OpenGL is open source, hence Open. DirectX is, of course being it by M$, not open, and is only available on Windows. As Dae said, OpenGL is graphics only. You have to handle your own input. Being OpenGL is cross-platform I don't think it's different learning it for Windows or Linux other than creating a basic window and linking it to it for drawing. Dae reccomended NeHe(http://nehe.gamedev.net), I think it would be a great start for you. It's done in Windows however there is a part for setting up an OpenGL window in Linux. Really that's all that should be different. So check out the tutorials anyway you should be able to just take the gl code and put it in your linux window code. Also you said you're fluent in DirectX so obviously you've coded for winblows(hehe) before and understand some basics. So you should understand the tutorials for Win32 and after you read the linux article I assume it shouldn't be too hard to replace the linux parts for the win parts.
    Using Dev-C++ on Windows

  12. #12
    ---
    Join Date
    May 2004
    Posts
    1,379
    It might not be the best but this is what I used

    Code:
    #include "SDL/SDL.h"
    #include "GL/GL.h"
    #include "GL/GLU.h"
    
    #define scrX 1024
    #define scrY 768
    #define scrZ 32
    #define SDLFLAGS SDL_OPENGL|SDL_HWSURFACE
    
    GLvoid init(void);
    GLvoid process(void);
    GLvoid finalise(void);
    GLvoid Events(int*, SDL_Event);
    
    GLuint texid[2];
    
    int main(int argc, char *argv[]){
      init();
      process();
      finalise();
      return 0; 
    }  
    
    GLvoid init(void){
      // Set up SDL
      if(SDL_Init(SDL_INIT_VIDEO) < 0){
        printf("Error loading SDL: %s\n",SDL_GetError());
      }
      if(SDL_SetVideoMode(scrX, scrY, scrZ, SDLFLAGS) < 0){
        printf("Error setting video mode SDL: %s\n",SDL_GetError());
      }
      SDL_ShowCursor(SDL_DISABLE);
      SDL_WM_SetCaption("OpenGL",NULL);
      
      // Set up view port
      glViewport  (0, 0, scrX, scrY); 
      
      // Set up perspective etc...
      gluPerspective( 45.0f, (GLfloat)(scrX)/(GLfloat)(scrY), 0.1f, 1000.0f );							
    	glMatrixMode  (GL_MODELVIEW);	
      glShadeModel  (GL_SMOOTH);
      glClearColor  (0.0f, 0.0f, 0.5f, 0.0f);
      glClearDepth  (1.0f);				
    	glEnable      (GL_DEPTH_TEST);	
    	glDepthFunc   (GL_LEQUAL);
    	glHint        (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    	glLoadIdentity();	
      
    }
    
    void process(void){
      int done = 0;
      SDL_Event event;
    
    
      while (!done){    
        
        Events(&done, event);
    
        SDL_GL_SwapBuffers(); 
      }   
    }  
    
    GLvoid Events(int *done, SDL_Event event){
      //static Uint8 *keys = SDL_GetKeyState(NULL);;
      while ( SDL_PollEvent(&event) ){
        if( event.type == SDL_QUIT ){
          *done = 1;
        }
        if ( event.type == SDL_KEYDOWN ){
          if ( event.key.keysym.sym == SDLK_ESCAPE ){
            *done = 1;
          } 
        }    
      }
    }  
    
    void finalise(void){
      SDL_Quit();
    }

  13. #13

    Join Date
    May 2005
    Posts
    1,042
    OpenGL is open source
    wrong.
    I'm not immature, I'm refined in the opposite direction.

  14. #14
    ---
    Join Date
    May 2004
    Posts
    1,379
    Mesa is an open source implementation of OpenGL. OpenGL itself is not open source

  15. #15
    Trolley boy JackGL's Avatar
    Join Date
    Jan 2005
    Location
    UK
    Posts
    15
    The difference between OpenGL and DirectX is that DirectX is a complete multi-media platform.

    It handles input, audio, video... the works.

    OpenGL is just a Graphics Library.

    So you have to do all of the input and sound yourself.

    I've learned everything I know about OpenGL from http://nehe.gamedev.net

    The first program I ever wrote in C (I jumped in at the deep end good and proper ) was a 3D pong game.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  2. OpenGL lighting
    By BabyG in forum Game Programming
    Replies: 3
    Last Post: 08-29-2004, 09:58 AM
  3. You have to learn C in order to learn C++
    By gandalf_bar in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 07-16-2004, 10:33 AM
  4. What is it with OpenGL tutorials?
    By Eibro in forum Game Programming
    Replies: 22
    Last Post: 01-12-2003, 04:49 PM
  5. Witch to learn first?
    By Unregistered in forum Windows Programming
    Replies: 2
    Last Post: 06-17-2002, 12:06 AM