Only use OpenGL?

Ehm... read the thread, topic is a bit blurry

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

32 Replies - 2722 Views - Last Post: 06 August 2008 - 04:31 PM Rate Topic: -----

#1 FrozenSnake  Icon User is offline

  • En man från Sverige!

Reputation: 122
  • View blog
  • Posts: 995
  • Joined: 30-July 08

Only use OpenGL?

Posted 05 August 2008 - 07:29 AM

I have a few questions about OpenGL.

Many people say I should learn SDL, but I now wonder if it is possible to
create the graphics in games with "plain" OpenGL. Without libraries like SDL.

Everyone I ask do not say anything about this only that I should learn how
to use SDL but I prefer not to. I want to learn how to use OpenGL without
third-party libraries. So if anyone have knowledge of OpenGL please answer
my question.

Instead of creating two threads I ask another question here
To create a multilayer tile engine does "plain" 2D works then? Or should I use
3D in a "2D-way"?

My developing machine can't handle all 3D at the moment due to that my
graphic card is damaged. Some 3D it can handle some it don't render correctly.
So I prefer to know before I embark on my journey to learn to use a API.

All "leet" coders be nice to this newbie ;)

Is This A Good Question/Topic? 0
  • +

Replies To: Only use OpenGL?

#2 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: Only use OpenGL?

Posted 05 August 2008 - 07:46 AM

Hey

Depending on what you want to do in the way of making games i would suggest you learn as much as you can, and learn what speeds up the development process, SDL can be a real asset as it is a library created for programs such as games, whereas OpenGL is just for graphics. Even if you learned a lot about OpenGL your still going to at some point have to wrap that all up into something usable and interesting.

For example I recently created a game using OpenGL for graphics but I still had to understand all the fundamentals of collision detection and create something seperate to OpenGL to keep track of this. OpenGL as the name suggests is still a graphics library it is just a lot more low level than purpose built engines such as DarkGDK and Irrlicht. Using SDL for your window creation and other things such as event handling is a hell of a lot easier than writing your own way of doing these things, trust me.

So OpenGL will get your lovely 3D graphics on screen (albeit with the help of GLUT or SDL) but you wont be able to actually make them do anything without understanding a lot of other things.

Read gabehabes tutorials on creating a small game in SDL ,then once you understand how SDL works it shouldnt be all that difficult for you to learn some OpenGL and use this knowledge in SDL programs.

sorry if that was hard to understand, just ask if theres something your not sure on :)
good luck
Was This Post Helpful? 0
  • +
  • -

#3 FrozenSnake  Icon User is offline

  • En man från Sverige!

Reputation: 122
  • View blog
  • Posts: 995
  • Joined: 30-July 08

Re: Only use OpenGL?

Posted 05 August 2008 - 08:04 AM

Hi thanks for the reply.
I read at the SDL page and it say "Simple DirectMedia Layer is a cross-
platform multimedia library designed to provide low level access to audio,
keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video
framebuffer."

But the main functions I want to have is Keyboard, mouse and use 2D
graphics with support for multiply layers. GLUT have support for keyboard
functions and OGL to draw tiles and sprites.

So if we don't talk about the graphics but things like creating a window.
I have winmain and it's possible to create and draw a window with OGL.

So it should be possible to use only OGL and C++? Or am I wrong?
Was This Post Helpful? 0
  • +
  • -

#4 bobjob  Icon User is offline

  • D.I.C Head

Reputation: 23
  • View blog
  • Posts: 163
  • Joined: 29-March 08

Re: Only use OpenGL?

Posted 05 August 2008 - 09:37 AM

I would recommend, first fixing your graphical problems, if your video card/computer has rendering problems, it will be a head ache developing anything.

But once you have your video card working. Think about were you would like to go for game devolopment in the future. OpenGL is extremely easy to start off with in C++ (Im proof, if i can get the hang of it anyone can). maybe spend some time in the basics of DirectX aswell. There are pro's and con's to both, but either way there both great.

If you dont really consider yourself making 3d games in the future, why not just stick to SDL. the only problem with openGL is finding a way to handle sound, and such. but thats not really a problem (IMO) as i prefer to learn each aspect of devolopment seperately.

But either way, fix your computer first. Indulge a lil, you only live once. whats a new video card gonna hurt? Plus once you invest money into your projects it helps to modivate to continue.
Was This Post Helpful? 0
  • +
  • -

#5 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: Only use OpenGL?

Posted 05 August 2008 - 10:16 AM

Well yes it is entirely possible to create something using just OpenGL and C++ except you will need some sound libraries eventually and i would recommend using GLUT for your window creation and keyboard functions.

I just wonder do you really want to make this design choice?

if you decide against using SDL and want to use winmain for your window creation, you have already decided that your game is windows only. Do you think SDL is cheating somehow? :blink:

If your learning C++ then SDL is relatively easy to learn, cross platform and can be used to develop commercial products without a charge, its win, win, win and the help available for it is excellent.

If this is the way you want to code your game then don't let anyone stop you, but think your options through don't limit yourself from the start :^:

and listen to bobjob and get your hardware fixed :P
Was This Post Helpful? 0
  • +
  • -

#6 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Only use OpenGL?

Posted 05 August 2008 - 10:38 AM

OpenGL does not handle window management or user input. That means for example, in Linux with X11 you have to use GLX to create/manage windows.

Edit: Sorry, just realized that you seem to already understand this. :)

What you're probably more interested in is GLUT, which is a crossplatform extension to OpenGL which handles all of the above.

OpenGL and GLUT pretty much take care of user input and graphics.

For sound I recommend OpenAL.

You'll have to write your own code for things like collision detection (unless you want to bring in more outside dependencies).

If you're just a beginner, all of this might be a little overwhelming. You may want to stick with SDL, or possibly even something a little higher level.

Edit: While I'm not saying you HAVE to write crossplatform code, I highly recommend trying to. It's not that hard, and you won't be kicking yourself in the butt later when you decide you want to port it. :)

This post has been edited by Tom9729: 05 August 2008 - 10:39 AM

Was This Post Helpful? 0
  • +
  • -

#7 FrozenSnake  Icon User is offline

  • En man från Sverige!

Reputation: 122
  • View blog
  • Posts: 995
  • Joined: 30-July 08

Re: Only use OpenGL?

Posted 05 August 2008 - 10:46 AM

No no to create a window is possible with GLUT too, so winmain is not my
only choice. I guess I don't need a NASA windows handler to get a game
up and running =P

#include <GL/gl.h> //include the gl header file
#include <GL/glut.h> //include the glut header file

void display (void) {
	glClearColor (0.0,0.0,0.0,1.0); 
	glClear (GL_COLOR_BUFFER_BIT);
	glLoadIdentity();
	gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
	glFlush();
}

int main (int argc, char **argv) {
	glutInit (&argc, argv);
	glutInitDisplayMode (GLUT_SINGLE); 
	glutInitWindowSize (500, 500);
	glutInitWindowPosition (100, 100);
	glutCreateWindow ("A basic OpenGL Window");
	glutDisplayFunc (display);
	glutMainLoop ();
	return 0;
}


The reason I do not want to learn SDL is that I do not think professional
companies uses SDL. Either they have something else or something they
self has developed (if they use OGL).

So I prefer to learn how to cope with OGL without third-party libraries.
It has nothing to do with cheating.

Feel free to tell me if I am wrong about SDL in the professional business.
I am learning this due to that I will go study at the University. So I want
to have a bit more flesh on the bones ("Lite mer kött på benen") A
expression here. So I don't wanna waste time learning stuff that will be
obsolete at the university. I hope you see my point =P

Oh by the way, at the moment I will not use sound or network support yet.
And for this project I planning now will not use sound.

This post has been edited by FrozenSnake: 05 August 2008 - 11:08 AM

Was This Post Helpful? 0
  • +
  • -

#8 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Only use OpenGL?

Posted 05 August 2008 - 11:03 AM

View PostFrozenSnake, on 5 Aug, 2008 - 01:46 PM, said:

The reason I do not want to learn SDL is that I do not think professional
companies uses SDL. Either they have something else or something they
self has developed (if they use OGL).

So I prefer to learn how to cope with OGL without third-party libraries.
It has nothing to do with cheating.

Feel free to tell me if I am wrong about SDL in the professional business.
I am learning this due to that I will go study at the University. So I want
to have a bit more flesh on the bones ("Lite mer kött på benen") A
expression here. So I don't wanna waste time learning stuff that will be
obsolete at the university. I hope you see my point =P

http://en.wikipedia....games_using_SDL :)

Not all of those are commercial games, but most of them are.

Use the best tool for the job, not the tool that happens to be the most popular. :^:
Was This Post Helpful? 0
  • +
  • -

#9 FrozenSnake  Icon User is offline

  • En man från Sverige!

Reputation: 122
  • View blog
  • Posts: 995
  • Joined: 30-July 08

Re: Only use OpenGL?

Posted 05 August 2008 - 11:33 AM

Tom9729:
Guess I can take a look at least. Then I ask you this,
If we just look at the "what I can see" stuff In a game
(not collision detection etc)
Do I need SDL for that? Whats the pro's and con's
not for a new programmer but for a professional.

bobjob:
I have no interest at the moment in learn how to develop 3D
so I do not see why I need to have a functional 3D card. I don't
understand how ppl can't understand that <.< nothing personal
but I always hear about "why don't you wanna do 3D?" I wanna
develop a 2D not because it's "easier". But I want to do just that.
A 2D game not 3D.
Was This Post Helpful? 0
  • +
  • -

#10 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Only use OpenGL?

Posted 05 August 2008 - 11:54 AM

View PostFrozenSnake, on 5 Aug, 2008 - 02:33 PM, said:

Tom9729:
Guess I can take a look at least. Then I ask you this,
If we just look at the "what I can see" stuff In a game
(not collision detection etc)
Do I need SDL for that? Whats the pro's and con's
not for a new programmer but for a professional.

You don't "need" SDL for anything. It just helps simplify the development process.

The only reason I wouldn't go with something like SDL would be if I was trying to avoid dependencies on other libraries, or if it was a learning experience.

Basically if you go with plain OpenGL, you're going to be writing a lot of your own functions to do things like load textures and render the scene.

In OpenGL, "drawing" is done by rendering what are called primitives. In a 3d application, you would probably want to make the models (called "meshes") in a specialized program like 3d Studio Max or Maya, and then load them into your program. Even a complex mesh can be broken down into primitives (ie. triangles/squares).

OpenGL is for 3d graphics. You can do 2d graphics in it by simply ignoring the depth dimension. You would probably want to disable lighting too, or write your own lighting system (OpenGL has one built in). You could probably render "sprites" as textures on quads, maybe with some kind of alpha blending.

As "a professional" I would probably go with something like SDL, because (presumably) I would already know how much of the lower level stuff works, and would want to save time by not having to re-code all of it.

Edit: Just thought I'd add this, but SDL appears to have a system for 2d graphics built-in.

This post has been edited by Tom9729: 05 August 2008 - 11:55 AM

Was This Post Helpful? 0
  • +
  • -

#11 bobjob  Icon User is offline

  • D.I.C Head

Reputation: 23
  • View blog
  • Posts: 163
  • Joined: 29-March 08

Re: Only use OpenGL?

Posted 05 August 2008 - 03:51 PM

I didnt mean 3d was important, nun the less openGL is optimised for 3D. The reason you should get your card fixed, is because openGL renders 2D in a very similar way (if not the same way) as it would render 3D. so if you card has problems rendering openGL on a 3D applications, expect there to be problems with a 2D openGL game.

just a side question: Have you got the latest video card drivers?
Was This Post Helpful? 0
  • +
  • -

#12 FrozenSnake  Icon User is offline

  • En man från Sverige!

Reputation: 122
  • View blog
  • Posts: 995
  • Joined: 30-July 08

Re: Only use OpenGL?

Posted 06 August 2008 - 06:33 AM

Tom9729:
The reason I do not want to use other libraries is that I want to learn to work with OpenGL and maybe even create my own library one day. And not to be dependent on others. So basically its for the learning experience.

One thing I for sure want to do is to create my own 2D engine. Even if it is
a looooong time before I have the necessary skills and knowledge

Bobjob:
I have problem with some 3D games not all. EverQuest2, WoW, EVE Online is a few games I have problem with. Second Life is a game that
works perfect. I checked what they use and I saw that SL used OpenGL.
And my guess is that the others uses DirectX. Yes I have upgraded, downgraded and reinstalled (both drivers and OS).

The 2D type of game I want to do is either a "From the Top in a 45 degree angle" or sidescroller. The game I play now works perfekt on my
computer so the development should be without problem with the
graphics. At least if it renders correctly (not look like a mixed carrot x] )

This post has been edited by FrozenSnake: 06 August 2008 - 06:33 AM

Was This Post Helpful? 0
  • +
  • -

#13 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 998
  • View blog
  • Posts: 4,173
  • Joined: 14-February 08

Re: Only use OpenGL?

Posted 06 August 2008 - 06:38 AM

Slightly confused now FrozenSnake :s you seem to know the answers to your questions, is there anything we can actually help you with :blink:
Was This Post Helpful? 0
  • +
  • -

#14 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • Posts: 2,641
  • Joined: 30-December 07

Re: Only use OpenGL?

Posted 06 August 2008 - 06:41 AM

View PostFrozenSnake, on 6 Aug, 2008 - 09:33 AM, said:

The reason I do not want to use other libraries is that I want to learn to work with OpenGL and maybe even create my own library one day. And not to be dependent on others. So basically its for the learning experience.

One thing I for sure want to do is to create my own 2D engine. Even if it is
a looooong time before I have the necessary skills and knowledge

My personal advice would be to do a little work with higher level libraries (like Allegro, SDL, Java2D, Slick2D) before you try to pickup OpenGL. Some of the concepts are the same, and using a higher level library will help you pickup on them without having to deal with everything that OpenGL throws at you.

Just curious but how's your math background? OpenGL makes more sense if you have a little experience working with matrices.

Writing a (basic) game engine is easier than you think.
Was This Post Helpful? 0
  • +
  • -

#15 FrozenSnake  Icon User is offline

  • En man från Sverige!

Reputation: 122
  • View blog
  • Posts: 995
  • Joined: 30-July 08

Re: Only use OpenGL?

Posted 06 August 2008 - 07:07 AM

My mathematics is not the best. But I am going to study to math C or D.
(The minimum to go at the university here for game development is C)

I enjoy mathematics but my grades in it is below average because I didn't
was so much in school. But next year I will (hopefully) study at municipal adult education (Komvux). To get the grades I need.

I am going to buy this (now that ppl give a better answer on why I should begin with SDL) http://www.3dbuzz.co...hp?productid=30

Without saying "there is tons of tutorials on the internet" or "it cost
money!" can you take a look at it and tell me if it's worth the money.

View Poststayscrisp, on 6 Aug, 2008 - 06:38 AM, said:

Slightly confused now FrozenSnake :s you seem to know the answers to your questions, is there anything we can actually help you with :blink:


Be my ballfence X] I don't always know I know the answer XD

This post has been edited by FrozenSnake: 06 August 2008 - 07:14 AM

Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3