SFML community forums

Help => General => Topic started by: Fierce_Dutch on December 05, 2010, 12:01:19 am

Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 05, 2010, 12:01:19 am
Well I have really been wanting to move onto 3D and I finally did. I downloaded GLUT and got it all set up. But compared to SFML, I have no clue how to anything except draw shapes.. I mean I want to load a 3D model and then just make it move or something other than drawing shapes. SO I guess I am just asking people who use OpenGL this, where did you learn about OpenGL and Glut and why is it so popular?

Also should I be using OpenGL ES?
Title: Where Did you learn OpenGL?
Post by: Groogy on December 05, 2010, 12:06:47 am
You can use OpenGL trough SFML and I highly recommend that before GLUT. I would recommend ANYTHING before GLUT.

Anyway here's a very popular site: http://nehe.gamedev.net/
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 05, 2010, 12:10:46 am
Quote from: "Groogy"
You can use OpenGL trough SFML and I highly recommend that before GLUT. I would recommend ANYTHING before GLUT.

Anyway here's a very popular site: http://nehe.gamedev.net/


Ok ya I think I will do that for now because GLUT looks terrible.. Any I also added another question to my first post if you would like to answer that.

Also the site looks great thanks! but isnt it mainly for GLUT?
Title: Where Did you learn OpenGL?
Post by: Groogy on December 05, 2010, 12:15:07 am
Quote from: "Fierce_Dutch"

Any I also added another question to my first post if you would like to answer that.

Unless you are about to write for smartphones or PS3 then no.
Quote from: "Fierce_Dutch"

Also the site looks great thanks! but isnt it mainly for GLUT?

No it's mainly based on WinAPI. He started a SDL version for not so long ago but I think it never went off. Anyway he highlights what is WinAPI specific and what is OpenGL specific. What you are interested in are the OpenGL specific stuff of course, to replicate the WinAPI parts will be easy since you'll use SFML for it. While he'll have like 25 lines of code to process events you'll have like... 4.
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 05, 2010, 12:28:05 am
Quote from: "Groogy"
Quote from: "Fierce_Dutch"

Any I also added another question to my first post if you would like to answer that.

Unless you are about to write for smartphones or PS3 then no.
Quote from: "Fierce_Dutch"

Also the site looks great thanks! but isnt it mainly for GLUT?

No it's mainly based on WinAPI. He started a SDL version for not so long ago but I think it never went off. Anyway he highlights what is WinAPI specific and what is OpenGL specific. What you are interested in are the OpenGL specific stuff of course, to replicate the WinAPI parts will be easy since you'll use SFML for it. While he'll have like 25 lines of code to process events you'll have like... 4.


Well what exactly is Open GL? I thought it was like sfml where it was really easy to use to make games. Also I was thinking about coding for Iphone and droid and blackberry later. And maybe even for my jailbroken ps3... SO then would I use OpenGL Es?
Title: Where Did you learn OpenGL?
Post by: Groogy on December 05, 2010, 12:36:48 am
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Quote from: "Fierce_Dutch"

Any I also added another question to my first post if you would like to answer that.

Unless you are about to write for smartphones or PS3 then no.
Quote from: "Fierce_Dutch"

Also the site looks great thanks! but isnt it mainly for GLUT?

No it's mainly based on WinAPI. He started a SDL version for not so long ago but I think it never went off. Anyway he highlights what is WinAPI specific and what is OpenGL specific. What you are interested in are the OpenGL specific stuff of course, to replicate the WinAPI parts will be easy since you'll use SFML for it. While he'll have like 25 lines of code to process events you'll have like... 4.


Well what exactly is Open GL? I thought it was like sfml where it was really easy to use to make games. Also I was thinking about coding for Iphone and droid and blackberry later. And maybe even for my jailbroken ps3... SO then would I use OpenGL Es?


OpenGL is more or less a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics. So more or less it's a set of functions that each graphic card driver has to implement. It is not a complete library to make games. It's only a library that gives you a standard interface to the graphic card. So you are only relying commands to the graphic cards using OpenGL.

Making games easy, aaah no no no. OpenGL is far from being easy. It's as hardcore and low-level as you can get.

Link: http://en.wikipedia.org/wiki/OpenGL
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 05, 2010, 01:50:22 am
Quote from: "Groogy"
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Quote from: "Fierce_Dutch"

Any I also added another question to my first post if you would like to answer that.

Unless you are about to write for smartphones or PS3 then no.
Quote from: "Fierce_Dutch"

Also the site looks great thanks! but isnt it mainly for GLUT?

No it's mainly based on WinAPI. He started a SDL version for not so long ago but I think it never went off. Anyway he highlights what is WinAPI specific and what is OpenGL specific. What you are interested in are the OpenGL specific stuff of course, to replicate the WinAPI parts will be easy since you'll use SFML for it. While he'll have like 25 lines of code to process events you'll have like... 4.


Well what exactly is Open GL? I thought it was like sfml where it was really easy to use to make games. Also I was thinking about coding for Iphone and droid and blackberry later. And maybe even for my jailbroken ps3... SO then would I use OpenGL Es?


OpenGL is more or less a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics. So more or less it's a set of functions that each graphic card driver has to implement. It is not a complete library to make games. It's only a library that gives you a standard interface to the graphic card. So you are only relying commands to the graphic cards using OpenGL.

Making games easy, aaah no no no. OpenGL is far from being easy. It's as hardcore and low-level as you can get.

Link: http://en.wikipedia.org/wiki/OpenGL


Ok then is there something like sfml or sdl or allegro but 3D? I really want to learn Open GL because of its power and I mean learning c++ was hard with now prior experience so do you think I am up to using Open GL?
Title: Where Did you learn OpenGL?
Post by: Groogy on December 05, 2010, 02:15:38 am
Quote from: "Fierce_Dutch"
Ok then is there something like sfml or sdl or allegro but 3D? I really want to learn Open GL because of its power and I mean learning c++ was hard with now prior experience so do you think I am up to using Open GL?


Sure why not? You won't be able to produce a good quality game from the get-go but you'll at least learn how everything works on the very low level. There will probably come someone telling you to not "Reinvent the wheel" but then I'll add "unless you learn something from it".

Sure you might just get a rotating cube with a texture on it with maybe some light source. But hey it's a start!

Start here:
http://www.sfml-dev.org/tutorials/1.6/window-opengl.php

Also from my look on SFML2 it looks to become even easier to create opengl apps trough custom Drawables, unless that is changed.

But if you want a Game engine in order to easily create a game then there exists some like CrystalSpace (http://www.crystalspace3d.org/main/Main_Page) and OGRE (http://www.ogre3d.org/). But I warn you, it's hell getting them setup. I tried them both and CrystalSpace have a very complicated API which takes time to learn and I never succeeded to compile OGRE.
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 05, 2010, 05:24:29 pm
Quote from: "Groogy"
Quote from: "Fierce_Dutch"
Ok then is there something like sfml or sdl or allegro but 3D? I really want to learn Open GL because of its power and I mean learning c++ was hard with now prior experience so do you think I am up to using Open GL?


Sure why not? You won't be able to produce a good quality game from the get-go but you'll at least learn how everything works on the very low level. There will probably come someone telling you to not "Reinvent the wheel" but then I'll add "unless you learn something from it".

Sure you might just get a rotating cube with a texture on it with maybe some light source. But hey it's a start!

Start here:
http://www.sfml-dev.org/tutorials/1.6/window-opengl.php

Also from my look on SFML2 it looks to become even easier to create opengl apps trough custom Drawables, unless that is changed.

But if you want a Game engine in order to easily create a game then there exists some like CrystalSpace (http://www.crystalspace3d.org/main/Main_Page) and OGRE (http://www.ogre3d.org/). But I warn you, it's hell getting them setup. I tried them both and CrystalSpace have a very complicated API which takes time to learn and I never succeeded to compile OGRE.


OK well thanks, and since I am doing this do you think it would be easy to switch to openGL es? Later I mean when i develop cross-platform
Title: Where Did you learn OpenGL?
Post by: Groogy on December 05, 2010, 06:19:32 pm
OpenGL is cross-platform, it is the basis for the OpenGL library. But OpenGL ES is specialised for smaller platforms where we have to spare as much memory as possible and so on.

I've never used OpenGL ES myself but if it follows the guidelines of normal OpenGL, then no it shouldn't be much of a difference.
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 05, 2010, 09:16:24 pm
Quote from: "Groogy"
OpenGL is cross-platform, it is the basis for the OpenGL library. But OpenGL ES is specialised for smaller platforms where we have to spare as much memory as possible and so on.

I've never used OpenGL ES myself but if it follows the guidelines of normal OpenGL, then no it shouldn't be much of a difference.


Ok, so I want to get a few things strait about OpenGL. Correct me if I am wrong on any of these things.
1. It is purely for graphics.
2. It doesn't control any system things like key presses.
3. It works directly with the graphics card.
4. I will have to pretty much create my own sfml if I just use it strait.
Title: Where Did you learn OpenGL?
Post by: Groogy on December 05, 2010, 09:20:46 pm
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
OpenGL is cross-platform, it is the basis for the OpenGL library. But OpenGL ES is specialised for smaller platforms where we have to spare as much memory as possible and so on.

I've never used OpenGL ES myself but if it follows the guidelines of normal OpenGL, then no it shouldn't be much of a difference.


Ok, so I want to get a few things strait about OpenGL. Correct me if I am wrong on any of these things.
1. It is purely for graphics.
2. It doesn't control any system things like key presses.
3. It works directly with the graphics card.
4. I will have to pretty much create my own sfml if I just use it strait.


Correct, but you don't need to create your own SFML since SFML already exists ;)
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 05, 2010, 10:43:15 pm
Quote from: "Groogy"
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
OpenGL is cross-platform, it is the basis for the OpenGL library. But OpenGL ES is specialised for smaller platforms where we have to spare as much memory as possible and so on.

I've never used OpenGL ES myself but if it follows the guidelines of normal OpenGL, then no it shouldn't be much of a difference.


Ok, so I want to get a few things strait about OpenGL. Correct me if I am wrong on any of these things.
1. It is purely for graphics.
2. It doesn't control any system things like key presses.
3. It works directly with the graphics card.
4. I will have to pretty much create my own sfml if I just use it strait.


Correct, but you don't need to create your own SFML since SFML already exists ;)


Unless I am the hardest of hardcore :)

Also can I do 3D with sfml? liek put 3D stuff in an sfml window?
Title: Where Did you learn OpenGL?
Post by: Groogy on December 05, 2010, 11:12:53 pm
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
OpenGL is cross-platform, it is the basis for the OpenGL library. But OpenGL ES is specialised for smaller platforms where we have to spare as much memory as possible and so on.

I've never used OpenGL ES myself but if it follows the guidelines of normal OpenGL, then no it shouldn't be much of a difference.


Ok, so I want to get a few things strait about OpenGL. Correct me if I am wrong on any of these things.
1. It is purely for graphics.
2. It doesn't control any system things like key presses.
3. It works directly with the graphics card.
4. I will have to pretty much create my own sfml if I just use it strait.


Correct, but you don't need to create your own SFML since SFML already exists ;)


Unless I am the hardest of hardcore :)

Also can I do 3D with sfml? liek put 3D stuff in an sfml window?


Yes, I gave you a link about it some posts ago.
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 06, 2010, 05:59:28 am
Quote from: "Groogy"
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
OpenGL is cross-platform, it is the basis for the OpenGL library. But OpenGL ES is specialised for smaller platforms where we have to spare as much memory as possible and so on.

I've never used OpenGL ES myself but if it follows the guidelines of normal OpenGL, then no it shouldn't be much of a difference.


Ok, so I want to get a few things strait about OpenGL. Correct me if I am wrong on any of these things.
1. It is purely for graphics.
2. It doesn't control any system things like key presses.
3. It works directly with the graphics card.
4. I will have to pretty much create my own sfml if I just use it strait.


Correct, but you don't need to create your own SFML since SFML already exists ;)


Unless I am the hardest of hardcore :)

Also can I do 3D with sfml? liek put 3D stuff in an sfml window?


Yes, I gave you a link about it some posts ago.


Ok, well I think I will just stick with GLUT for now, unless you think that I can take sfml just as far as I can take GLUT. Because when I go to college I know that they use OpenGL but idk what they use with it, probably win32 huh? (Cal Poly in US)  So, ya I am just using GLUT to create a few things now. And since glut is just the windowing system I wont really try to learn it just use it, i am just going to try and use OpenGL and learn it throughly.

Also my parents are trying to figure out what to give me for Christmas, so any suggestions that will also help me learn opengl. Like a class or something?
Title: Where Did you learn OpenGL?
Post by: Groogy on December 06, 2010, 07:05:46 am
Beginning OpenGL Game Programming is a great book they could get you.
And I still recommend that you use SFML instead of GLUT. In order to use OpenGL with SFML all you need to do is... Create a sf::Window and then call OpenGL functions and then tell your window "Display", if I remember correctly. Also you can use sf::Image as textures for anything you draw in OpenGL.

For example sf::Sprite and sf::Shape and so on uses OpenGL in the background to display something in a RenderWindow.
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 06, 2010, 04:58:53 pm
Quote from: "Groogy"
Beginning OpenGL Game Programming is a great book they could get you.
And I still recommend that you use SFML instead of GLUT. In order to use OpenGL with SFML all you need to do is... Create a sf::Window and then call OpenGL functions and then tell your window "Display", if I remember correctly. Also you can use sf::Image as textures for anything you draw in OpenGL.

For example sf::Sprite and sf::Shape and so on uses OpenGL in the background to display something in a RenderWindow.


Alright I think I will use sfml but I cant seem to get the downloaded project to work from the tutorial... I am using sfml 2..
Title: Where Did you learn OpenGL?
Post by: Groogy on December 06, 2010, 06:16:13 pm
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Beginning OpenGL Game Programming is a great book they could get you.
And I still recommend that you use SFML instead of GLUT. In order to use OpenGL with SFML all you need to do is... Create a sf::Window and then call OpenGL functions and then tell your window "Display", if I remember correctly. Also you can use sf::Image as textures for anything you draw in OpenGL.

For example sf::Sprite and sf::Shape and so on uses OpenGL in the background to display something in a RenderWindow.


Alright I think I will use sfml but I cant seem to get the downloaded project to work from the tutorial... I am using sfml 2..


SFML2 is a bit different from the tutorial in SFML1.6

I got an example here:
Code: [Select]
class Something : public sf::Drawable
{
protected:
void Render( sf::RenderTarget& target, sf::Renderer& renderer ) const
{
sf::Shape shape = sf::Shape::Circle( 0, 0, 100, sf::Color::Blue );
target.Draw( shape );
renderer.Begin( sf::Renderer::QuadList );
renderer.AddVertex( 0, 0 );
renderer.AddVertex( 0, 100);
renderer.AddVertex( 100, 100 );
renderer.AddVertex( 100, 0 );
renderer.AddVertex( 200, 200 );
renderer.AddVertex( 200, 300);
renderer.AddVertex( 300, 300 );
renderer.AddVertex( 300, 200 );
renderer.End();
}
};

int main()
{
    sf::RenderWindow application( sf::VideoMode(800, 600), "SFML Cube" );
    Something something;
    something.SetPosition( 100, 100 );

    while( application.IsOpened() )
    {
    sf::Event event;
    while( application.GetEvent( event ) )
    {
    if( event.Type == sf::Event::Closed )
    {
    application.Close();
    }
    }

application.Clear();
sf::View view = application.GetView();
view.Move( -1, -1 );
application.SetView( view );
application.Draw( something );
    application.Display();

    something.Rotate( 0.5 );
    }
    return 0;
}
Title: Where Did you learn OpenGL?
Post by: AlexM on December 06, 2010, 06:18:04 pm
There are some good beginning openGL books out there.


http://www.amazon.com/Beginning-OpenGL-Game-Programming-Second/dp/159863528X/ref=dp_ob_title_bk
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 07, 2010, 03:21:09 am
Quote from: "Groogy"
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Beginning OpenGL Game Programming is a great book they could get you.
And I still recommend that you use SFML instead of GLUT. In order to use OpenGL with SFML all you need to do is... Create a sf::Window and then call OpenGL functions and then tell your window "Display", if I remember correctly. Also you can use sf::Image as textures for anything you draw in OpenGL.

For example sf::Sprite and sf::Shape and so on uses OpenGL in the background to display something in a RenderWindow.


Alright I think I will use sfml but I cant seem to get the downloaded project to work from the tutorial... I am using sfml 2..


SFML2 is a bit different from the tutorial in SFML1.6

I got an example here:
Code: [Select]
class Something : public sf::Drawable
{
protected:
void Render( sf::RenderTarget& target, sf::Renderer& renderer ) const
{
sf::Shape shape = sf::Shape::Circle( 0, 0, 100, sf::Color::Blue );
target.Draw( shape );
renderer.Begin( sf::Renderer::QuadList );
renderer.AddVertex( 0, 0 );
renderer.AddVertex( 0, 100);
renderer.AddVertex( 100, 100 );
renderer.AddVertex( 100, 0 );
renderer.AddVertex( 200, 200 );
renderer.AddVertex( 200, 300);
renderer.AddVertex( 300, 300 );
renderer.AddVertex( 300, 200 );
renderer.End();
}
};

int main()
{
    sf::RenderWindow application( sf::VideoMode(800, 600), "SFML Cube" );
    Something something;
    something.SetPosition( 100, 100 );

    while( application.IsOpened() )
    {
    sf::Event event;
    while( application.GetEvent( event ) )
    {
    if( event.Type == sf::Event::Closed )
    {
    application.Close();
    }
    }

application.Clear();
sf::View view = application.GetView();
view.Move( -1, -1 );
application.SetView( view );
application.Draw( something );
    application.Display();

    something.Rotate( 0.5 );
    }
    return 0;
}


I think I will just stick with glut because this looks nothing like open gl. Also I think GLUT is crossplatform... What windowing system is crosspaltform because then I will use that...
Title: Where Did you learn OpenGL?
Post by: OniLinkPlus on December 07, 2010, 03:34:42 am
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Beginning OpenGL Game Programming is a great book they could get you.
And I still recommend that you use SFML instead of GLUT. In order to use OpenGL with SFML all you need to do is... Create a sf::Window and then call OpenGL functions and then tell your window "Display", if I remember correctly. Also you can use sf::Image as textures for anything you draw in OpenGL.

For example sf::Sprite and sf::Shape and so on uses OpenGL in the background to display something in a RenderWindow.


Alright I think I will use sfml but I cant seem to get the downloaded project to work from the tutorial... I am using sfml 2..


SFML2 is a bit different from the tutorial in SFML1.6

I got an example here:
Code: [Select]
class Something : public sf::Drawable
{
protected:
void Render( sf::RenderTarget& target, sf::Renderer& renderer ) const
{
sf::Shape shape = sf::Shape::Circle( 0, 0, 100, sf::Color::Blue );
target.Draw( shape );
renderer.Begin( sf::Renderer::QuadList );
renderer.AddVertex( 0, 0 );
renderer.AddVertex( 0, 100);
renderer.AddVertex( 100, 100 );
renderer.AddVertex( 100, 0 );
renderer.AddVertex( 200, 200 );
renderer.AddVertex( 200, 300);
renderer.AddVertex( 300, 300 );
renderer.AddVertex( 300, 200 );
renderer.End();
}
};

int main()
{
    sf::RenderWindow application( sf::VideoMode(800, 600), "SFML Cube" );
    Something something;
    something.SetPosition( 100, 100 );

    while( application.IsOpened() )
    {
    sf::Event event;
    while( application.GetEvent( event ) )
    {
    if( event.Type == sf::Event::Closed )
    {
    application.Close();
    }
    }

application.Clear();
sf::View view = application.GetView();
view.Move( -1, -1 );
application.SetView( view );
application.Draw( something );
    application.Display();

    something.Rotate( 0.5 );
    }
    return 0;
}


I think I will just stick with glut because this looks nothing like open gl. Also I think GLUT is crossplatform... What windowing system is crosspaltform because then I will use that...
You can use the SFML Window Library and do all of the OpenGL yourself.
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 07, 2010, 05:47:33 am
Quote from: "OniLink10"
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Beginning OpenGL Game Programming is a great book they could get you.
And I still recommend that you use SFML instead of GLUT. In order to use OpenGL with SFML all you need to do is... Create a sf::Window and then call OpenGL functions and then tell your window "Display", if I remember correctly. Also you can use sf::Image as textures for anything you draw in OpenGL.

For example sf::Sprite and sf::Shape and so on uses OpenGL in the background to display something in a RenderWindow.


Alright I think I will use sfml but I cant seem to get the downloaded project to work from the tutorial... I am using sfml 2..


SFML2 is a bit different from the tutorial in SFML1.6

I got an example here:
Code: [Select]
class Something : public sf::Drawable
{
protected:
void Render( sf::RenderTarget& target, sf::Renderer& renderer ) const
{
sf::Shape shape = sf::Shape::Circle( 0, 0, 100, sf::Color::Blue );
target.Draw( shape );
renderer.Begin( sf::Renderer::QuadList );
renderer.AddVertex( 0, 0 );
renderer.AddVertex( 0, 100);
renderer.AddVertex( 100, 100 );
renderer.AddVertex( 100, 0 );
renderer.AddVertex( 200, 200 );
renderer.AddVertex( 200, 300);
renderer.AddVertex( 300, 300 );
renderer.AddVertex( 300, 200 );
renderer.End();
}
};

int main()
{
    sf::RenderWindow application( sf::VideoMode(800, 600), "SFML Cube" );
    Something something;
    something.SetPosition( 100, 100 );

    while( application.IsOpened() )
    {
    sf::Event event;
    while( application.GetEvent( event ) )
    {
    if( event.Type == sf::Event::Closed )
    {
    application.Close();
    }
    }

application.Clear();
sf::View view = application.GetView();
view.Move( -1, -1 );
application.SetView( view );
application.Draw( something );
    application.Display();

    something.Rotate( 0.5 );
    }
    return 0;
}


I think I will just stick with glut because this looks nothing like open gl. Also I think GLUT is crossplatform... What windowing system is crosspaltform because then I will use that...
You can use the SFML Window Library and do all of the OpenGL yourself.


Do you have an example for that? Because the 1.6 one isnt working but I will search around.
Title: Where Did you learn OpenGL?
Post by: OniLinkPlus on December 07, 2010, 05:50:29 am
Quote from: "Fierce_Dutch"
Quote from: "OniLink10"
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Quote from: "Fierce_Dutch"
Quote from: "Groogy"
Beginning OpenGL Game Programming is a great book they could get you.
And I still recommend that you use SFML instead of GLUT. In order to use OpenGL with SFML all you need to do is... Create a sf::Window and then call OpenGL functions and then tell your window "Display", if I remember correctly. Also you can use sf::Image as textures for anything you draw in OpenGL.

For example sf::Sprite and sf::Shape and so on uses OpenGL in the background to display something in a RenderWindow.


Alright I think I will use sfml but I cant seem to get the downloaded project to work from the tutorial... I am using sfml 2..


SFML2 is a bit different from the tutorial in SFML1.6

I got an example here:
Code: [Select]
class Something : public sf::Drawable
{
protected:
void Render( sf::RenderTarget& target, sf::Renderer& renderer ) const
{
sf::Shape shape = sf::Shape::Circle( 0, 0, 100, sf::Color::Blue );
target.Draw( shape );
renderer.Begin( sf::Renderer::QuadList );
renderer.AddVertex( 0, 0 );
renderer.AddVertex( 0, 100);
renderer.AddVertex( 100, 100 );
renderer.AddVertex( 100, 0 );
renderer.AddVertex( 200, 200 );
renderer.AddVertex( 200, 300);
renderer.AddVertex( 300, 300 );
renderer.AddVertex( 300, 200 );
renderer.End();
}
};

int main()
{
    sf::RenderWindow application( sf::VideoMode(800, 600), "SFML Cube" );
    Something something;
    something.SetPosition( 100, 100 );

    while( application.IsOpened() )
    {
    sf::Event event;
    while( application.GetEvent( event ) )
    {
    if( event.Type == sf::Event::Closed )
    {
    application.Close();
    }
    }

application.Clear();
sf::View view = application.GetView();
view.Move( -1, -1 );
application.SetView( view );
application.Draw( something );
    application.Display();

    something.Rotate( 0.5 );
    }
    return 0;
}


I think I will just stick with glut because this looks nothing like open gl. Also I think GLUT is crossplatform... What windowing system is crosspaltform because then I will use that...
You can use the SFML Window Library and do all of the OpenGL yourself.


Do you have an example for that? Because the 1.6 one isnt working but I will search around.
I would recommend looking at the docs for SFML2 and the examples that come in SFML2's svn repo.
Title: Where Did you learn OpenGL?
Post by: Laurent on December 07, 2010, 07:55:37 am
Hey guys, you don't need to quote 2 kilometers of posts every time you reply, these posts are just above ;)
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 08, 2010, 02:59:32 am
Quote from: "Laurent"
Hey guys, you don't need to quote 2 kilometers of posts every time you reply, these posts are just above ;)


Ok sorry lol, also I still can't get OpenGL to work with SFML.....
Title: Where Did you learn OpenGL?
Post by: Terrydil on December 08, 2010, 05:17:44 am
Quote from: "Fierce_Dutch"
I still can't get OpenGL to work with SFML.....


At the simplest level, all you have to do is create an SFML window like you normally would and then make OpenGL calls and call Display() on the SFML window to display it.

Just make sure you are linking to and including the OpenGL library since you will be calling it directly.

Here is an simple example (based on the SFML 1.6 Xcode template) that uses SFML to create a window, clears the screen w/ OpenGL (makes it red), and then displays it by calling Display() on the SFML window.  Note that instead of using sf::RenderWindow.Clear() like you normally would I'm using 2 calls directly to OpenGL to do the same thing.  glClearColor sets the color you want and glClear actually calls it.

Code: [Select]
#include <SFML/Graphics.hpp>
#include <OpenGL/OpenGL.h>

int main()
{
    // Create main window
    sf::RenderWindow App(sf::VideoMode(640, 480), "SFML Test w/ OpenGL calls");

glClearColor(255, 0, 0, 255);

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear screen
        //App.Clear();

       glClear(GL_COLOR_BUFFER_BIT);

       

        // Finally, display the rendered frame on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


I simply commented out App.Clear() but left it in there so you could see that I am literally just replacing the SFML drawing calls with OpenGL ones.

If you can get that far you can start plugging in stuff from various OpenGL tutorials and do more interesting things than simply making the screen different colors. :)
Title: Where Did you learn OpenGL?
Post by: Fierce_Dutch on December 08, 2010, 06:05:10 am
Quote from: "Terrydil"
Quote from: "Fierce_Dutch"
I still can't get OpenGL to work with SFML.....


At the simplest level, all you have to do is create an SFML window like you normally would and then make OpenGL calls and call Display() on the SFML window to display it.

Just make sure you are linking to and including the OpenGL library since you will be calling it directly.

Here is an simple example (based on the SFML 1.6 Xcode template) that uses SFML to create a window, clears the screen w/ OpenGL (makes it red), and then displays it by calling Display() on the SFML window.  Note that instead of using sf::RenderWindow.Clear() like you normally would I'm using 2 calls directly to OpenGL to do the same thing.  glClearColor sets the color you want and glClear actually calls it.

Code: [Select]
#include <SFML/Graphics.hpp>
#include <OpenGL/OpenGL.h>

int main()
{
    // Create main window
    sf::RenderWindow App(sf::VideoMode(640, 480), "SFML Test w/ OpenGL calls");

glClearColor(255, 0, 0, 255);

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear screen
        //App.Clear();

       glClear(GL_COLOR_BUFFER_BIT);

       

        // Finally, display the rendered frame on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


I simply commented out App.Clear() but left it in there so you could see that I am literally just replacing the SFML drawing calls with OpenGL ones.

If you can get that far you can start plugging in stuff from various OpenGL tutorials and do more interesting things than simply making the screen different colors. :)


Thanks! How would I draw a shape? Make a Draw() function and then put my shape and it's vertices in that function and then just call it? Also I just tried this code and got this, btw I changed the include don't worry about that..

Code: [Select]
1>main.obj : error LNK2001: unresolved external symbol __imp__glClear@4
1>main.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
1>main.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (??1RenderWindow@sf@@UAE@XZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::ContextSettings const &)" (??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUContextSettings@1@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: bool __thiscall sf::Window::GetEvent(class sf::Event &)" (?GetEvent@Window@sf@@QAE_NAAVEvent@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: bool __thiscall sf::Window::IsOpened(void)const " (?IsOpened@Window@sf@@QBE_NXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: void __thiscall sf::Window::Close(void)" (?Close@Window@sf@@QAEXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z)



BTW I did link OpenGL32 and I checked for ti in my VC directory which is where Visual studio looks for stuff.
Title: Where Did you learn OpenGL?
Post by: Zweistein on December 08, 2010, 09:03:28 am
I learned it complete at nehes tutorials. Back in the old days it was the only Ressource i got.

Later i bought a book. but didn t read too much :) And 2 years ago i bought an advanced book, but never read it :) But i have s.th. to look, when i need to know s.th.