ok i have a OpenGL question.
Now as far as i know functions like glBegin, glEnd, glVertex3f, and glColor3f are not part of OpenGL 4.0. Now if i try to use them with window Context 4.0 they work. Shouldn't function like this give me some kind of error or something because they are not a part of OpenGL 4.0, so why are they working?
Isn't window Context 4.0 means that I'm using OpenGL 4.0 function ?
And how do i differentiate between OpenGL old function and OpenGL new functions ?
#include <SFML\Graphics.hpp>
#include <SFML\Window.hpp>
#include <SFML\OpenGL.hpp>
#include <iostream>
int main()
{
sf::Window Window(sf::VideoMode(800, 600, 32), "Game", sf::Style::Close, sf::ContextSettings(24, 8, 16, 4, 0));
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 0.f);
// Enable Z-buffer read and write
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
// Setup a perspective projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 1.f, 500.f);
std::cout<<Window.GetSettings().MajorVersion;
std::cout<<Window.GetSettings().MinorVersion;
while(Window.IsOpen())
{
sf::Event Event;
while (Window.PollEvent(Event))
{
if (Event.Type == sf::Event::Closed)
Window.Close();
if (Event.Type == sf::Event::Resized)
glViewport(0, 0, Event.Size.Width, Event.Size.Height);
}
Window.SetActive();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.f, 0.f, -200.f);
glBegin(GL_QUADS);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, -50.f);
glVertex3f( 50.f, -50.f, -50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f( 50.f, 50.f, 50.f);
glVertex3f( 50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(50.f, -50.f, -50.f);
glVertex3f(50.f, 50.f, -50.f);
glVertex3f(50.f, 50.f, 50.f);
glVertex3f(50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f( 50.f, -50.f, -50.f);
glVertex3f( 50.f, -50.f, 50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, 50.f);
glEnd();
Window.Display();
}
return 0;
}