Lostybtw
Posted on July 27, 2021
OpenGL, the thing that it is. Its used to make games down to the basic levels of programming. It uses older languages mostly c++ for its code.
Why Learn OpenGL instead of a game engine?
It is basic : Not easy but Basic, that means it gives you an understanding of the deep processes that go into rendering your favourite video games.
Its well known & cross platform : Sure you can go use your win32 Api or DirectX, but OpenGL is the cross platform well known easier alternative.
A game engine spoils you : Why I am glad I didn't use a game engine by DaFluffyPotato goes well over my point, A game engine does all those rendering processes for you. You don't get to learn a lot.
More Code : Game Engines like Unity are pure GUI stuff.
see this :-
Now this is OpenGL c++ :-
#include <glew.h>
#include <GLFW/glfw3.h>
#include <iostream>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(1920, 1080, "OpenGL", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
if (glewInit() != GLEW_OK)
std::cout << "Error!" << std::endl;
std::cout << glGetString(GL_VERSION) << std::endl;
unsigned int buffer;
float positions[6] = {
-0.5f, -0.5f,
0.0f, 0.5f,
0.5f, -0.5f
};
glGenBuffers(1,&buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float) a=);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
I think you get the point now .
:)
PS.Comment pls(If I got anything wrong or just casually)
Posted on July 27, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.