Skip to content

Commit

Permalink
add osmesa example
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley committed Jan 5, 2025
1 parent 8ef8784 commit 4aae95d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions examples/osmesa/osmesa.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#define RGFW_IMPLEMENTATION
#define RGFW_PRINT_ERRORS
#define RGFW_DEBUG
#define RGFW_OSMESA
#include "RGFW.h"
#include <stdio.h>

int main(void) {
RGFW_setClassName("RGFW Basic");
RGFW_window* win = RGFW_createWindow("RGFW Example Window", RGFW_RECT(500, 500, 500, 500), RGFW_allowDND | RGFW_center);
RGFW_window_makeCurrent(win);

while (RGFW_window_shouldClose(win) == RGFW_FALSE) {
RGFW_window_eventWait(win, RGFW_waitNext);
while (RGFW_window_checkEvent(win) != NULL);

RGFW_window_makeCurrent(win);

glClearColor(255, 255, 255, 255);

glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_TRIANGLES);
glColor3f(1, 0, 0); glVertex2f(-0.6, -0.75);
glColor3f(0, 1, 0); glVertex2f(0.6, -0.75);
glColor3f(0, 0, 1); glVertex2f(0, 0.75);
glEnd();

glFlush();
RGFW_window_swapBuffers(win);
}

RGFW_window_close(win);
}

0 comments on commit 4aae95d

Please sign in to comment.