[C++] SFML & OpenGL Tutorial 01: Basics

preview_player
Показать описание
This is a quick video showing how to wrap SFML basics into a simple Game class that you can reuse in other projects.

Рекомендации по теме
Комментарии
Автор

Took notes:

int main()
{

return 0;
}

@0:00-3:00: Talks about SFML, OpenGL, GLU, DirectX
@3:00 :Starts talking about SFML
@5:00 : Linking to SFML within Visual Studio
@6:00 : Talking about the linker and DEBUG .dll files.
@7:00 : Running empty main function to test that we have
the correct linker settings.
@7:25 : If you use the statically linked version of SFML, you won't have
to use .DLL files all over the place.
@8:00 : Pasting release versions of .dll files.
Getting GLU dll file and copying and pasting it.
GLU32.dll is what you need.
@8:49 : Glu is used to: Load in all of the correct function extentions
for whatever platform you are on. Based on windows/linux/ect.
@9:32 : Configuring linker... So what has being done earlier?
I think earlier was the includes. Not the linker.

@10:44 : Let's write out first SFML application.
To just display a window. Much less code than the WIN32.
AND it is cross platform.

@12:51: Wrote below. And now about to run it.

#include <SFML/Window.hpp>
#include <SFML/System.hpp>

int main()
{
sf::Window window(sf::VideoMode(800, 600), "HelloWorld");

while(window.isOpen())
{
sf::Event e;
while(window.pollEvent(e))
{
if(e.type == sf::Event::Closed)
window.close();
}
}
}
}

@12:51: Wrote above. And now about to run it.

@13:03: Build errors!
@13:25: Screwed up the linker.
@13:44: ALWAYS MAKE SURE YOU ARE IN THE CORRECT CONFIGURATION.
@13:57: WINDOW! We have a window! It is re-sizeable.
You can make it non-resizeable if you want.
sf::Window window(sf::VideoMode(800, 600), "Hello", sf::Style::Close);
//That style of window will not let you resize it.
@15:05 : So that is the basics of making a window.

@15:17: OpenGL is basically already setup.

@15:30: #Include <SFML/OpenGL.hpp> //MAYBE??

@16:00: See if that works.
window.display(); //swaps the buffers (back and front buffers)


@17:00: Additions: OPENGL STUFF! It works fine! RED SCREEN!
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <SFML/OpenGL.hpp>
int main()
{
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
sf::Window window(sf::VideoMode(800, 600), "HelloWorld");

while(window.isOpen())
{
sf::Event e;
while(window.pollEvent(e))
{
if(e.type == sf::Event::Closed)
window.close();
}
}

//Draw using OpenGL
glClear(GL_COLOR_BUFFER_BIT);

//Swap buffers and display whatever you have drawn on buffer
//To the screen.
window.display();

}//window loop
}//main

JohnMarkIsaacMadison
Автор

I am so happy. I have been specifically looking for good OpenGL+SFML tutorials. Thanks!

Acrochronical
Автор

@3:53: ATTENTION CODE::BLOCKS USERS:

If you are using code::blocks on windows with the MinGW compiler, you want TDM(SJLJ)
NOT MinGW(DW2). Even though MinGW is in the title and you are using MinGW... Not the right choice.
I learned the hard way.

JohnMarkIsaacMadison
Автор

Can you give the link for the SDL2 template

kishan.kumar
Автор

You hit your enter key so fucking hard

Fezezen