<commit_before>#include "cursor.h"

#include "types/shapes.h"
#include "types/rectangle.h"
#include "app.h"

#define STRINGIFY(A) #A

Cursor::Cursor(): m_vbo(NULL) {

}

Cursor::~Cursor(){
	delete m_vbo;
}

void Cursor::init(){
	m_vbo = cross(glm::vec3(0.,0.,0.1), 10.).getVbo(); 

	std::string vert =
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n";

	std::string frag = vert;

	vert += STRINGIFY(

uniform mat4 u_modelViewProjectionMatrix;

uniform vec2 u_mouse;
uniform vec2 u_resolution;

attribute vec4 a_position;
attribute vec4 a_color;

varying vec4 v_color;
varying vec4 v_position;

void main(void) {
	v_position = vec4(u_mouse.x,u_mouse.y,0.0,0.0) + a_position;
	v_color = a_color;
	gl_Position = u_modelViewProjectionMatrix * v_position;
}

);

	frag += STRINGIFY(

uniform vec2 u_mouse;
void main(void) {
    gl_FragColor = vec4(1.0);
}
);

	frag = m_vbo->getVertexLayout()->getDefaultFragShader();

	m_shader.load(frag,vert);
}

void Cursor::draw(){

	glPolygonOffset(-1.0f, -1.0f);      // Shift depth values
    glEnable(GL_POLYGON_OFFSET_LINE);

	glLineWidth(2.0f);
	// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

	// // Draw lines antialiased
    glEnable(GL_LINE_SMOOTH);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	m_shader.use();
	m_shader.setUniform("u_mouse", getMouseX(), getMouseY());
	m_shader.setUniform("u_resolution", getWindowWidth(), getWindowHeight());
	m_shader.setUniform("u_modelViewProjectionMatrix", getOrthoMatrix());
	m_vbo->draw(&m_shader);

	// glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	glDisable(GL_POLYGON_OFFSET_LINE);
    glLineWidth(1.0f);
    glDisable(GL_BLEND);
    glDisable(GL_LINE_SMOOTH);
}<commit_msg>fixing rpi<commit_after>#include "cursor.h"

#include "types/shapes.h"
#include "types/rectangle.h"
#include "app.h"

#define STRINGIFY(A) #A

Cursor::Cursor(): m_vbo(NULL) {

}

Cursor::~Cursor(){
	delete m_vbo;
}

void Cursor::init(){
	m_vbo = cross(glm::vec3(0.,0.,0.1), 10.).getVbo(); 

	std::string vert =
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n";

	std::string frag = vert;

	vert += STRINGIFY(

uniform mat4 u_modelViewProjectionMatrix;

uniform vec2 u_mouse;
uniform vec2 u_resolution;

attribute vec4 a_position;
attribute vec4 a_color;

varying vec4 v_color;
varying vec4 v_position;

void main(void) {
	v_position = vec4(u_mouse.x,u_mouse.y,0.0,0.0) + a_position;
	v_color = a_color;
	gl_Position = u_modelViewProjectionMatrix * v_position;
}

);

	frag += STRINGIFY(

uniform vec2 u_mouse;
void main(void) {
    gl_FragColor = vec4(1.0);
}
);

	frag = m_vbo->getVertexLayout()->getDefaultFragShader();

	m_shader.load(frag,vert);
}

void Cursor::draw(){

#ifndef PLATFORM_RPI
	glPolygonOffset(-1.0f, -1.0f);      // Shift depth values
    glEnable(GL_POLYGON_OFFSET_LINE);

	glLineWidth(2.0f);
	// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

	// // Draw lines antialiased
    glEnable(GL_LINE_SMOOTH);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 #endif

	m_shader.use();
	m_shader.setUniform("u_mouse", getMouseX(), getMouseY());
	m_shader.setUniform("u_resolution", getWindowWidth(), getWindowHeight());
	m_shader.setUniform("u_modelViewProjectionMatrix", getOrthoMatrix());
	m_vbo->draw(&m_shader);

#ifndef PLATFORM_RPI
	// glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	glDisable(GL_POLYGON_OFFSET_LINE);
    glLineWidth(1.0f);
    glDisable(GL_BLEND);
    glDisable(GL_LINE_SMOOTH);
#endif
}
{'fraction_non_alphanumeric': 0.14797687861271677, 'fraction_numerical': 0.017919075144508672, 'mean_word_length': 5.397412199630314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4965438', 'n_tokens_mistral': 1460, 'n_tokens_neox': 1428, 'n_words': 229}