[ home / overboard ] [ soy / qa / raid / r ] [ ss / craft ] [ int / pol ] [ a / an / asp / biz / mtv / r9k / tech / v / sude / x ] [ q / news / chive / rules / pass / bans / status ] [ wiki / booru / irc ]

A banner for soyjak.party

/tech/ - Soyence and Technology

Download more RAM for your Mac here
Catalog
Email
Subject
Comment
File
Password (For file deletion.)

File: ClipboardImage.png 📥︎ (10.63 KB, 960x480) ImgOps

 â„–24663[Quote]

Soylib is the most keyed gamedev framework and recently it updated to having 0 dependency libs.

What is soylib? Soylib(raylib) is a game framework where all the stuff just werks. It is not bloated, easy to set up, and easy to get going.

Make game with soylib or something like that.

 â„–24664[Quote]

>>24663 (OP)
even doe using raw opengl is easier

 â„–24665[Quote]

>>24664
raw 'gl requires gazillion lines of code to set up a window. Also soylib provides lots of multimedia features like playing sounds and whatnot

 â„–24666[Quote]

>>24665
bro never watched a tutorial
```
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>

// Callback function for error handling
void error_callback(int error, const char* description) {
stdcerr << "Error: " << description << stdendl;
}

// Function to display the scene
void display() {
glClear(GL_COLOR_BUFFER_BIT); // Clear the color buffer
glBegin(GL_TRIANGLES); // Draw a triangle
glColor3f(1.0f, 0.0f, 0.0f); // Red
glVertex2f(0.0f, 1.0f); // Top vertex
glColor3f(0.0f, 1.0f, 0.0f); // Green
glVertex2f(-1.0f, -1.0f); // Bottom left vertex
glColor3f(0.0f, 0.0f, 1.0f); // Blue
glVertex2f(1.0f, -1.0f); // Bottom right vertex
glEnd();
}

int main() {
glfwSetErrorCallback(error_callback); // Set error callback

if (!glfwInit()) return -1; // Initialize GLFW

GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL with GLFW", nullptr, nullptr); // Create window
if (!window) {
glfwTerminate(); // Terminate if window creation failed
return -1;
}

glfwMakeContextCurrent(window); // Make the window's context current
if (glewInit() != GLEW_OK) {
error_callback(0, "glewInit");
}

stdcout << glGetString(GL_VERSION) << stdendl;

float positions[] {
-0.5f, -0.5f,
0.0f, 0.5f,
0.5f, -0.5f,
};

unsigned int buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), positions, GL_STATIC_DRAW);

glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), 0);


while (!glfwWindowShouldClose(window)) {
// display(); // Render the scene

glClear(GL_COLOR_BUFFER_BIT);

glDrawArrays(GL_TRIANGLES, 0, 3); // without index buffer
// glDrawElements(GL_TRIANGLES, 3, ) // with index buffer

glfwSwapBuffers(window); // Swap front and back buffers
glfwPollEvents(); // Poll for and process events
}

glfwDestroyWindow(window); // Destroy window
glfwTerminate(); // Terminate GLFW
return 0;
}
```

 â„–24668[Quote]

>>24666
>it's not a gazillion of lines bro!!
>proceeds to write a gazillion lines to draw a triangle

 â„–24671[Quote]

>>24668
its just boilerplate. copy paste and forget



[Return][Catalog][Go to top][Post a Reply]
Delete Post [ ]
[ home / overboard ] [ soy / qa / raid / r ] [ ss / craft ] [ int / pol ] [ a / an / asp / biz / mtv / r9k / tech / v / sude / x ] [ q / news / chive / rules / pass / bans / status ] [ wiki / booru / irc ]