progress
This commit is contained in:
parent
0d3340713c
commit
27b04eb7d4
3 changed files with 33 additions and 3 deletions
2
Makefile
2
Makefile
|
|
@ -1,5 +1,5 @@
|
||||||
all:
|
all:
|
||||||
$(CC) -o glonkers main.c $(pkg-config --cflags --libs sdl3)
|
$(CC) -o glonkers main.c $(pkg-config --cflags --libs sdl3 opengl)
|
||||||
|
|
||||||
run: all
|
run: all
|
||||||
./glonkers
|
./glonkers
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,11 @@
|
||||||
src = ./.;
|
src = ./.;
|
||||||
naitiveBuildInputs = with pkgs; [
|
naitiveBuildInputs = with pkgs; [
|
||||||
gcc
|
gcc
|
||||||
pkg-config
|
|
||||||
];
|
];
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
|
pkg-config
|
||||||
sdl3
|
sdl3
|
||||||
|
libGL
|
||||||
];
|
];
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
|
|
||||||
31
main.c
31
main.c
|
|
@ -1,5 +1,34 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
printf("hi");
|
printf("Good Morning 🍵\n");
|
||||||
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
|
SDL_Window* window = SDL_CreateWindow("SDL3 OpenGL Cube",
|
||||||
|
800, 600, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
|
||||||
|
if (!window) {
|
||||||
|
printf("CreateWindow Error: %s\n", SDL_GetError());
|
||||||
|
SDL_Quit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_GLContext glContext = SDL_GL_CreateContext(window);
|
||||||
|
if (!glContext) {
|
||||||
|
printf("GL Context Error: %s\n", SDL_GetError());
|
||||||
|
SDL_DestroyWindow(window);
|
||||||
|
SDL_Quit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
SDL_Event e;
|
||||||
|
int running = 1;
|
||||||
|
while (SDL_PollEvent(&e)) {
|
||||||
|
if (e.type == SDL_EVENT_QUIT) running = false;
|
||||||
|
// Rendorrrr
|
||||||
|
glViewport(0, 0, 800, 600);
|
||||||
|
glClearColor(0.1f, 0.1f, 0.1f, 1.0f); // Dark gray background
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue