mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-26 20:28:49 -05:00
Cleanup
This commit is contained in:
parent
a280c97321
commit
c4a8930909
|
@ -310,12 +310,12 @@ int main(void)
|
||||||
|
|
||||||
scale = (float) fb_width / (float) wnd_width;
|
scale = (float) fb_width / (float) wnd_width;
|
||||||
vertices[0][0] = 0.f;
|
vertices[0][0] = 0.f;
|
||||||
vertices[0][1] = fb_height - cursor_y * scale;
|
vertices[0][1] = (float) (fb_height - cursor_y * scale);
|
||||||
vertices[1][0] = (float) fb_width;
|
vertices[1][0] = (float) fb_width;
|
||||||
vertices[1][1] = fb_height - cursor_y * scale;
|
vertices[1][1] = (float) (fb_height - cursor_y * scale);
|
||||||
vertices[2][0] = cursor_x * scale;
|
vertices[2][0] = (float) (cursor_x * scale);
|
||||||
vertices[2][1] = 0.f;
|
vertices[2][1] = 0.f;
|
||||||
vertices[3][0] = cursor_x * scale;
|
vertices[3][0] = (float) (cursor_x * scale);
|
||||||
vertices[3][1] = (float) fb_height;
|
vertices[3][1] = (float) fb_height;
|
||||||
|
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(GL_ARRAY_BUFFER,
|
||||||
|
@ -323,7 +323,7 @@ int main(void)
|
||||||
vertices,
|
vertices,
|
||||||
GL_STREAM_DRAW);
|
GL_STREAM_DRAW);
|
||||||
|
|
||||||
mat4x4_ortho(mvp, 0.f, fb_width, 0.f, fb_height, 0.f, 1.f);
|
mat4x4_ortho(mvp, 0.f, (float) fb_width, 0.f, (float) fb_height, 0.f, 1.f);
|
||||||
glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp);
|
glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp);
|
||||||
|
|
||||||
glDrawArrays(GL_LINES, 0, 4);
|
glDrawArrays(GL_LINES, 0, 4);
|
||||||
|
|
|
@ -44,10 +44,7 @@
|
||||||
|
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
|
|
||||||
static const struct
|
static const vec2 vertices[4] =
|
||||||
{
|
|
||||||
float x, y;
|
|
||||||
} vertices[4] =
|
|
||||||
{
|
{
|
||||||
{ -0.6f, -0.6f },
|
{ -0.6f, -0.6f },
|
||||||
{ 0.6f, -0.6f },
|
{ 0.6f, -0.6f },
|
||||||
|
|
|
@ -77,7 +77,7 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
GLFWwindow* windows[2];
|
GLFWwindow* windows[2];
|
||||||
GLuint texture, vertex_shader, fragment_shader, program, vertex_buffer;
|
GLuint texture, program, vertex_buffer;
|
||||||
GLint mvp_location, vpos_location, color_location, texture_location;
|
GLint mvp_location, vpos_location, color_location, texture_location;
|
||||||
|
|
||||||
srand((unsigned int) time(NULL));
|
srand((unsigned int) time(NULL));
|
||||||
|
|
|
@ -142,14 +142,13 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int ch, width, height;
|
int ch, width, height;
|
||||||
float position;
|
|
||||||
unsigned long frame_count = 0;
|
unsigned long frame_count = 0;
|
||||||
double last_time, current_time;
|
double last_time, current_time;
|
||||||
int fullscreen = GLFW_FALSE;
|
int fullscreen = GLFW_FALSE;
|
||||||
GLFWmonitor* monitor = NULL;
|
GLFWmonitor* monitor = NULL;
|
||||||
GLFWwindow* window;
|
GLFWwindow* window;
|
||||||
GLuint vertex_buffer, vertex_shader, fragment_shader, program;
|
GLuint vertex_buffer, vertex_shader, fragment_shader, program;
|
||||||
GLint mvp_location, vpos_location, vcol_location;
|
GLint mvp_location, vpos_location;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "fh")) != -1)
|
while ((ch = getopt(argc, argv, "fh")) != -1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user