LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-30-2011, 04:34 AM   #1
anon02
Member
 
Registered: Aug 2011
Posts: 223

Rep: Reputation: Disabled
OpenGL in C


Recently I decided to add 3D graphics to my game (swarm.bentatman.co.uk, blog.bentatman.co.uk) to make the game more enjoyable, however I am not sure of anything to do with OpenGL. Are there any good tutorials about it?

Also, if you can, can you go to the (first) website and see if there are any other things I should add to the game, and, if indeed I should add graphics (see my blog post on the second website about graphics).
 
Old 10-30-2011, 04:53 AM   #2
SigTerm
Member
 
Registered: Dec 2009
Distribution: Slackware 12.2
Posts: 379

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by ThatPerson View Post
OpenGL in C
OpenGL is the same regardless of language.

Quote:
Originally Posted by ThatPerson View Post
Recently I decided to add 3D graphics to my game (swarm.bentatman.co.uk, blog.bentatman.co.uk) to make the game more enjoyable, however I am not sure of anything to do with OpenGL.
Not a good idea, unless you have artists. It is your decision, though.

Quote:
Originally Posted by ThatPerson View Post
Are there any good tutorials about it?
This should get you started:
http://www.opengl.org/documentation/red_book/
http://fly.cc.fer.hr/~unreal/theredbook/

Also I liked "Computer Graphics using OpenGL" by Francis Hill - that book covers a lot of ground.

And you'll definitely want to check www.opengl.org.

To use OpenGL on multiple platforms you'll need cross-platform library to initialize it - libsdl or Qt 4.

Please note that OpenGL/3d graphics is a HUGE subject whose difficulty is on par (or surpasses) C++ programming language. Also, there are multiple versions, and starting with version 3.0 OpenGL heavily concentrates on shaders, which is another huge topic.
 
Old 10-30-2011, 04:57 AM   #3
anon02
Member
 
Registered: Aug 2011
Posts: 223

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by SigTerm View Post
OpenGL is the same regardless of language.
What I meant by that was because many of the tutorials I have found are C++ ones, so I was looking for one more centered around C.

Quote:
Originally Posted by SigTerm View Post
Not a good idea, unless you have artists. It is your decision, though.
The idea is still in the pipeline, but I thought I could try it. If it doesn't work, then it is no massive problem, but if it does, great!
Quote:
Originally Posted by SigTerm View Post
This should get you started:
http://www.opengl.org/documentation/red_book/
http://fly.cc.fer.hr/~unreal/theredbook/

Also I liked "Computer Graphics using OpenGL" by Francis Hill - that book covers a lot of ground.

And you'll definitely want to check www.opengl.org.

To use OpenGL on multiple platforms you'll need cross-platform library to initialize it - libsdl or Qt 4.

Please note that OpenGL/3d graphics is a HUGE subject whose difficulty is on par (or surpasses) C++ programming language. Also, there are multiple versions, and starting with version 3.0 OpenGL heavily concentrates on shaders, which is another huge topic.
Thanks for the links. I will check them out.

Last edited by anon02; 10-30-2011 at 04:59 AM.
 
Old 10-30-2011, 05:02 AM   #4
SigTerm
Member
 
Registered: Dec 2009
Distribution: Slackware 12.2
Posts: 379

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by ThatPerson View Post
What I meant by that was because many of the tutorials I have found are C++ ones, so I was looking for one more centered around C.
There's no difference between using OpenGL in C++, C, Pascal, Python or any other language. API is the same regardless of language.

If you feel particularly adventurous, you could go to opengl.org and start reading specification for version 1.4 (anything newer than that will concentrate on shaders, which will induce massive headache for beginner), but that may be difficult.

Or you could start with either "red book" or "Computer Graphics using OpenGL".

Last edited by SigTerm; 10-30-2011 at 05:06 AM.
 
Old 10-30-2011, 05:17 AM   #5
anon02
Member
 
Registered: Aug 2011
Posts: 223

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by SigTerm View Post
There's no difference between using OpenGL in C++, C, Pascal, Python or any other language. API is the same regardless of language.

If you feel particularly adventurous, you could go to opengl.org and start reading specification for version 1.4 (anything newer than that will concentrate on shaders, which will induce massive headache for beginner), but that may be difficult.

Or you could start with either "red book" or "Computer Graphics using OpenGL".
Ah, ok. I am going to read through the openGL website, and see.
 
Old 10-30-2011, 09:03 AM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Check out Nehe's series of "legacy" tutorials, which are still current and accurate. They're written for OpenGL 2, so they still work perfectly:

Nehe Productions

The ones that I've read do indeed provide example code in C.

The OpenGL Superbible, which is a very good tutorial-style book on OpenGL (you have to buy it though), also gives all its example code in C.

Last edited by dugan; 10-30-2011 at 09:27 AM.
 
Old 10-30-2011, 10:41 AM   #7
anon02
Member
 
Registered: Aug 2011
Posts: 223

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
Check out Nehe's series of "legacy" tutorials, which are still current and accurate. They're written for OpenGL 2, so they still work perfectly:

Nehe Productions

The ones that I've read do indeed provide example code in C.

The OpenGL Superbible, which is a very good tutorial-style book on OpenGL (you have to buy it though), also gives all its example code in C.
Nice, thanks for the links.
 
Old 10-30-2011, 10:59 AM   #8
SigTerm
Member
 
Registered: Dec 2009
Distribution: Slackware 12.2
Posts: 379

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by dugan View Post
Check out Nehe's series of "legacy" tutorials, which are still current and accurate. They're written for OpenGL 2, so they still work perfectly:
Well, it doesn't quite work this way. OpenGL starting with version 3 introduced core and compatibility profile. "compatibility" profile is backwards compatible with OpenGL 2, but "core" profile is not (and it is shader-centric). Deprecated features that are not present in "core" profile include glVertex2f, entire fixed-function rendering pipeline (lighting) and all matrix functions - all those functions were heavily used in OpenGL 2. See OpenGL 3.2 specification appendix E. Modern hardware supports OpenGL 3 or 4.

Fortunately, libraries such as LibSDL provide "compatibility" profile by default.

Also NeHe (in addition to weird color scheme) has a bad habit of posting windows-only tutorials (for example, tutorial that uses wglUseFontOutlines), which pretty much defeats the point of using OpenGL.
 
Old 12-15-2011, 02:20 PM   #9
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
BUMP!

I've since found this free online book, which covers OpenGL 3 and is supposed to be very good:

http://www.arcsynthesis.org/gltut/
 
Old 12-15-2011, 02:35 PM   #10
anon02
Member
 
Registered: Aug 2011
Posts: 223

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
BUMP!

I've since found this free online book, which covers OpenGL 3 and is supposed to be very good:

http://www.arcsynthesis.org/gltut/
Perfect! Thanks.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: What Mesa Has Left With OpenGL 3, OpenGL 4 LXer Syndicated Linux News 0 08-11-2011 10:00 PM
Bad opengl performance with two or more OpenGL windows on nvidia drivers (GF 7600 GS) psokol Linux - Software 0 02-21-2009 10:40 AM
opengl window not having title bar-using freeglut for opengl programming in c++ ashjas Fedora 0 01-19-2008 02:46 AM
Overwrite Mesa OpenGL with ATI OpenGL Carl-Fredrik Slackware 12 10-01-2004 03:33 PM
Changing from MESA OpenGL to ATI OpenGL tillyoubreakit Linux - Hardware 19 10-07-2003 07:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration