<commit_before>// SDL2 backend for mukaGL
// Double buffered using SDL_Renderer

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include <SDL.h>

#include "matrix.h"
#include "vector.h"

#include "gl_sdl2.h"

struct gl_sdl2 sdl = {
	.x = 0,
	.y = 0,
	.w = 300,
	.h = 300,
};

static void (*display_func)(void);
static void (*idle_func)(void);
static void (*keyboard_func)(unsigned char key, int x, int y);
static void (*reshape_func)(int width, int height);

void gl_color(float r, float g, float b, float a)
{
	Uint32 ri = (Uint32)(r * 255);
	Uint32 gi = (Uint32)(g * 255);
	Uint32 bi = (Uint32)(b * 255);
	Uint32 ai = (Uint32)(a * 255);

	sdl.color = (ai << 24) | (bi << 16) | (gi << 8) | ri;
}

void gl_clear_color(float r, float g, float b, float a)
{
	Uint32 ri = (Uint32)(r * 255);
	Uint32 gi = (Uint32)(g * 255);
	Uint32 bi = (Uint32)(b * 255);
	Uint32 ai = (Uint32)(a * 255);

	sdl.clear_color = (ai << 24) | (bi << 16) | (gi << 8) | ri;<commit_msg>gl_sdl2: Fix texture format<commit_after>// SDL2 backend for mukaGL
// Double buffered using SDL_Renderer

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include <SDL.h>

#include "matrix.h"
#include "vector.h"

#include "gl_sdl2.h"

struct gl_sdl2 sdl = {
	.x = 0,
	.y = 0,
	.w = 300,
	.h = 300,
};

static void (*display_func)(void);
static void (*idle_func)(void);
static void (*keyboard_func)(unsigned char key, int x, int y);
static void (*reshape_func)(int width, int height);

void gl_color(float r, float g, float b, float a)
{
	Uint32 ri = (Uint32)(r * 255);
	Uint32 gi = (Uint32)(g * 255);
	Uint32 bi = (Uint32)(b * 255);
	Uint32 ai = (Uint32)(a * 255);

	sdl.color = (ai << 24) | (ri << 16) | (gi << 8) | bi;
}

void gl_clear_color(float r, float g, float b, float a)
{
	Uint32 ri = (Uint32)(r * 255);
	Uint32 gi = (Uint32)(g * 255);
	Uint32 bi = (Uint32)(b * 255);
	Uint32 ai = (Uint32)(a * 255);

	sdl.clear_color = (ai << 24) | (ri << 16) | (gi << 8) | bi;
{'fraction_non_alphanumeric': 0.18781985670419651, 'fraction_numerical': 0.07932446264073695, 'mean_word_length': 3.7916666666666665, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3450738', 'n_tokens_mistral': 943, 'n_tokens_neox': 802, 'n_words': 244}