[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: hello_triangle.jpg (35 KB, 1276x952)
35 KB
35 KB JPG
I fucking did it.
>>
>>108228411
OpenGL 1.0?
>>
>>108228411
vulkan?
>>
>>108228411
waow
>>
File: opengl_crimes.jpg (48 KB, 424x289)
48 KB
48 KB JPG
>>108228411
>>
>>108228430
>>108228433
I ended up using GLFW.
>>
>>108228411
directx?
>>
>>108228460
GLFW is not a graphics api, anon. Did you use OpenGL or Vulkan?
>>
File: IMG_3130.png (846 KB, 1184x864)
846 KB
846 KB PNG
We did it reddit now we can make super mario 64
>>
the west is saved, a future of happyness and fulfillment awaits for the whole world
>>
>>108228474
GLEW (so OpenGL)
>>
Here's the code if anyone wants to try it:

#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>

int main() {
glfwSetErrorCallback([](int error, const char* description) {
std::cerr << "GLFW Error (" << error << "): " << description << std::endl;
});

// 1. Initialize GLFW
if (!glfwInit()) {
std::cerr << "Failed to initialize GLFW" << std::endl;
return -1;
}

// 2. Create a windowed mode window and its OpenGL context
GLFWwindow* window = glfwCreateWindow(640, 480, "Hello Triangle", NULL, NULL);
if (!window) {
std::cerr << "Failed to create window" << std::endl;
glfwTerminate();
return -1;
}

glfwMakeContextCurrent(window);

// 3. Initialize GLEW (must be done after making context current)
if (glewInit() != GLEW_OK) {
std::cerr << "Failed to initialize GLEW" << std::endl;
return -1;
}

// 4. Loop until the user closes the window
while (!glfwWindowShouldClose(window)) {
// Render here
glClear(GL_COLOR_BUFFER_BIT);

// Draw a simple triangle using "Legacy" style for immediate testing
// Note: Modern OpenGL uses Shaders and Buffers (VBOs)
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.0f, 0.0f); glVertex2f(-0.5f, -0.5f);
glColor3f(0.0f, 1.0f, 0.0f); glVertex2f(0.5f, -0.5f);
glColor3f(0.0f, 0.0f, 1.0f); glVertex2f(0.0f, 0.5f);
glEnd();

// Swap front and back buffers
glfwSwapBuffers(window);

// Poll for and process events
glfwPollEvents();
}

glfwTerminate();
std::cout << "Progam terminated" << std::endl;
return 0;
}
>>
File: 1572815351596.jpg (268 KB, 816x816)
268 KB
268 KB JPG
>>108228557
mind = blown
>>
>>108228411
᠏ ᠏᠏ ᠏▲
᠏▲᠏ ᠏▲
>>
>>108228508
can you stop being a retarded nigger choking on terminolgy? i don't give a shit what loader you used. the graphics api is OpenGL, that's the only thing that's interesting, nigger.
>>
>>108228411
nice. time to make your dream game.
>>
Can I get a quick rundown?
>>
Based, good job bro
>>
File: vulkan-experience.jpg (15 KB, 496x400)
15 KB
15 KB JPG
>>108228411
>>108228508
If it was Vulkan, it'd be impressive. But this is not. Delete your shitty thread, OP.
>>
>>108228411
Based engineGOD!
>>
>>108228557
>useless comments
vibe coded?
>>
File: screenshot.png (109 KB, 1920x1080)
109 KB
109 KB PNG
>>108228557
PATHETIC
>>
So what exactly did you do?
>>
File: cat-looks-inside-cat.png (79 KB, 498x337)
79 KB
79 KB PNG
>>108228557
>"I fucking did it."
>look inside
>chatgpt did it
>>
>>108228557
Code is the easy part. Linking dylib shittery filters me every time.
>>
>>108229154
Stop using IDE's and compile your projects manually, from the command line, calling gcc/etc directly. Only once you have that working and you understand what's going on, should you automate it.
>>
>>108228411
>I fucking did it.
you tronned out?
>>
>>108228557
that's literally how gemini comments the code
>>
Now try it with GLU/GLUT.
>>
>>108228557
>//1. initialize GLFW
>glfwInit()
Jesus Christ man
>>
>glBegin
congrats on learning a deprecated API that will get you nowhere fast, use OpenGL 4.6 / Vulkan / D3D12 / Metal or an abstraction over these (SDL3 GPU, bgfx). You're wasting your time otherwise.
>>
>>108229264
Modern OpenGL is probably the easiest to start with and from there pivot to Vulkan/D3D/Metal.
>>
>>108228411
Now do something more than copy pasting from learnopengl.com
>>
>>108229190
>Stop using IDE's and compile your projects manually, from the command line, calling gcc/etc directly.

This is what I do for everything. And also probably why I can't get any graphics shit to work ever.
>>
>>108228508
>>108228557
>glew
thats old news, glad is better
>>
>>108228411
did what?
>>
>>108229258
its chatgpt code obviously
>>
>glfw
You did not program that.
Win32/Xlib or bust.
>>
>>108229264
Don't listen to this guy, OP
>>
>>108229154
Are you using windows? then I can understand why its painful. On linux its very easy, just install glew/glfw and then do:
gcc main.c -o triangle $(pkg-config --cflags --libs glew glfw)

and it will compile main.c to triangle and link with glew and glfw.
You can list installed packages and their names (as seen by pkg-config) with
pkg-config --list-all
or search for an installed package:
pkg-config --list-all | grep glfw
>>
File: 1767909968401307s.jpg (8 KB, 250x168)
8 KB
8 KB JPG
>>108228557
>glfwCreateWindow
If only I knew what this did
>>
>>108228411
That's awesome and very based im proud of you but umm actually you forgot the gamma correction so fuck you it sucks and you deserve corporal punishment
>>
>>108228411

▲▲
>>
>>108228411
Create a captcha solver next
>>
>>108228557
>glBegin
Shit thread everyone. Move along. Certified stinky.
>>
>>108229258
For me it's GFWL
>>
>>108228557
>fixed pipeline
You're an asshole, but you don't need me telling you that
>>
>>108232024
>>108232124
how hard/easy it is to make game that supports at once dx12, opengl, vulkan?

without trippling up the rendering code
>>
>>108232316
>how hard/easy it is to make game that supports at once dx12, opengl, vulkan?
Very hard and generally impractical and unnecessary for a solo dev / small studio. Also, if you have to ask this question you probably don't have tons of experience and should probably just start with OpenGL.
>without trippling up the rendering code
lol
>>
>>108232316
Just look at the mess that PCSX2 is?
>>
>>108232316
there are abstraction layers for that (bgfx, wgpu-native, etc)
>>
>>108228411
gl hello triangle is a 10 min task, anon
i do have a series of fond memories of this little 3-sided rgb guy. finally getting one running on my custom gpu arch emulator translating to gl & glsl was quite a trip
>>
>>108228411
How to learn wgpu? I wanna create something like osu.
>>108229264
OpenGL 3.3 is all you need. Just werkz.
>>
>>108232024
G-Games for Windows Live?
>>
>>108233397
>OpenGL 3.3
Just admit you don't know what a mode switch is.
>>
>>108228411
Call me when you get it done in Vulkan.
>>
File: 1762027005620965.gif (801 KB, 250x195)
801 KB
801 KB GIF
>>108229076
its been years since I saw this one. good times.
>>
>>108232316
you can use spir-v to at least share shader code between the api's
>>
>>108228557
>write code like it's 2004
>>
>>108229076
only way to proof you didn't just vibecode it
>>
>>108228411
Mantle?
>>
>>108232316
not hard at all using interface pattern but it's a lot of work so unless you absolutely need to you're better of implementing the lowest common denominator for your target platforms.
>>
>>108228992
i dunno, i'm not seeing any emojis
>>
>>108229332
It's not even that. learnopengl.com teaches people how to use modern OpenGL, this tranny is using OpenGL 1.0.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.