Merge: doc -> main
This commit is contained in:
12
Makefile
12
Makefile
@@ -8,13 +8,13 @@ OBJ = \
|
||||
src/shader.o \
|
||||
src/input.o \
|
||||
src/mesh.o \
|
||||
src/alan.o \
|
||||
src/main.o
|
||||
|
||||
CFLAGS = \
|
||||
-I./ext/cglm/include \
|
||||
-I./ext/glfw/include \
|
||||
-Wall -Wno-unused-function -std=c99 \
|
||||
-D_XOPEN_SOURCE
|
||||
|
||||
help:
|
||||
@echo "Para compilar el proyecto a tu sistema operativo"
|
||||
@@ -30,19 +30,19 @@ help:
|
||||
|
||||
# WINDOWS
|
||||
windows: $(OBJ) glfw.dll
|
||||
$(CC) -L. -lGL -lglfw -o $(BIN).exe $(OBJ)
|
||||
$(CC) $(CFLAGS) $(OBJ) -o $(BIN) -L. -lglfw -lopengl32 -lglew32
|
||||
|
||||
glfw.dll:
|
||||
$(CC) -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o $@
|
||||
$(CC) -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o $@ -lgdi32
|
||||
|
||||
# LINUX
|
||||
linux-x11: $(OBJ)
|
||||
$(MAKE) BKN=_GLFW_X11 libglfw.so
|
||||
$(CC) -L. -lGL -lglfw -o $(BIN) $(OBJ)
|
||||
$(CC) -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw
|
||||
|
||||
linux-wayland: $(OBJ)
|
||||
$(MAKE) BKN=_GLFW_WAYLAND libglfw.so
|
||||
$(CC) -L. -lGL -lglfw -o $(BIN) $(OBJ)
|
||||
$(CC) -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw
|
||||
|
||||
run-linux:
|
||||
LD_LIBRARY_PATH=. ./$(BIN)
|
||||
@@ -50,7 +50,7 @@ run-linux:
|
||||
# COCOA
|
||||
cocoa: $(OBJ)
|
||||
$(MAKE) BKN=_GLFW_COCOA libglfw.so
|
||||
$(CC) -framework OpenGL -L. lglfw -o $(BIN) $(OBJ)
|
||||
$(CC) -framework OpenGL -o $(BIN) $(OBJ) -L. -lGLEW -lGL -lglfw
|
||||
|
||||
libglfw.so:
|
||||
$(CC) -fPIC -shared -D$(BKN) -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o $@
|
||||
|
||||
38
README.md
38
README.md
@@ -6,7 +6,7 @@ manigraph es un graficador interactiva de variedades que lee archivos binarios,
|
||||
una variedad multidimensional y grafica esta variedad en una proyección tridimensional.
|
||||
|
||||
# Dependencias
|
||||
Para poder compilar el proyecto hace falta los siguientes pro.
|
||||
Para poder compilar el proyecto hace falta lo siguiente.
|
||||
## Programas
|
||||
- `cc`: Cualquier compilador de C.
|
||||
- `git`: Gestor de dependencias. (Opcional)
|
||||
@@ -14,6 +14,7 @@ Para poder compilar el proyecto hace falta los siguientes pro.
|
||||
|
||||
## Librerías
|
||||
- `openGL`: A cross-platform API for rendering 2D and 3D graphics. (no incluida)
|
||||
- `glew`: The OpenGL Extension Wrangler Library (no incluida)
|
||||
- `glfw`: A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input.
|
||||
- `cglm`: Highly Optimized 2D / 3D Graphics Math (glm) for C.
|
||||
### Linux
|
||||
@@ -21,28 +22,18 @@ Para compilar `glfw` en linux hacen falta las siguientes librerías según el ca
|
||||
- `x11`: libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel
|
||||
- `wayland`: libwayland-dev libxkbcommon-dev wayland-protocols
|
||||
|
||||
# Codigo fuente
|
||||
Para adquirir el código fuente de manigraph se puede usar git o descargar manualmente los
|
||||
archivos zip.
|
||||
|
||||
## git via https
|
||||
Usando git se necesitan ejecutar los siguientes comándos en la terminal.
|
||||
# Descargas
|
||||
- [git](https://git-scm.com/downloads/win)
|
||||
- [MinGW](https://github.com/niXman/mingw-builds-binaries/releases)
|
||||
- [glew](https://glew.sourceforge.net/)
|
||||
|
||||
# Clonar el código fuente
|
||||
```
|
||||
git clone https://gitea.adles.top/software/manigraph.git
|
||||
cd manigraph
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
## zip files
|
||||
Alternativamente se puede descargar el código fuente en formato zip usando las siguientes
|
||||
direcciones y acomodando manualmente las carpetas de `glfw` y `cglm` en `ext/`.
|
||||
|
||||
- [manigraph](https://gitea.adles.top/software/manigraph/archive/main.zip)
|
||||
- [glfw](https://github.com/glfw/glfw/archive/refs/heads/master.zip)
|
||||
- [cglm](https://github.com/recp/cglm/archive/refs/heads/master.zip)
|
||||
|
||||
|
||||
# Compilación
|
||||
Para compilar manualmente el proyecto se puede usar `make` o ejecutar los comandos manualmente
|
||||
en el código fuente de `manigraph`.
|
||||
@@ -66,7 +57,7 @@ explicando el tema: [Compiling GLFW](https://www.glfw.org/docs/3.3/compile.html)
|
||||
|
||||
#### Windows
|
||||
```
|
||||
cc -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o glfw.dll
|
||||
cc -fPIC -shared -D_GLFW_WIN32 -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o glfw.dll -lgdi32
|
||||
```
|
||||
|
||||
#### Linux
|
||||
@@ -83,24 +74,19 @@ cc -fPIC -shared -D_GLFW_COCOA -D_GLFW_BUILD_DLL ./ext/glfw/src/*.c -o libglfw.s
|
||||
### Manigraph
|
||||
#### Windows
|
||||
```
|
||||
cc -L. -lglfw -lGL -I ext/cglm/include/ -I ext/glfw/include/ src/*.c -o manigraph.exe
|
||||
cc -I ext/cglm/include/ -I ext/glfw/include/ src/*.c -o manigraph -L. -lglfw -lopengl32 -lglew32
|
||||
```
|
||||
#### Linux
|
||||
```
|
||||
cc -L. -lglfw -lGL -I ext/cglm/include/ -I ext/glfw/include/ src/*.c -o manigraph
|
||||
cc -I ext/cglm/include/ -I ext/glfw/include/ src/*.c -o manigraph -L. -lglfw -lGL -lGLEW
|
||||
```
|
||||
#### Mac
|
||||
```
|
||||
cc -L. -lglfw -framework GL -I ext/cglm/include/ -I ext/glfw/include/ src/*.c -o manigraph
|
||||
cc -framework GL -I ext/cglm/include/ -I ext/glfw/include/ src/*.c -o manigraph -L. -lglfw -lGLEW
|
||||
```
|
||||
|
||||
# Ejecutar
|
||||
En linux se puede ejecutar el programa sin instalar la llibreria de glfw usando:
|
||||
## make
|
||||
```
|
||||
make run-linux
|
||||
```
|
||||
## manual
|
||||
En linux se puede ejecutar el programa sin instalar la libreria de glfw usando:
|
||||
```
|
||||
LD_LIBRARY_PATH=. ./manigraph
|
||||
```
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include "main.h"
|
||||
#include <GL/gl.h>
|
||||
|
||||
void set_clean_color_context( unsigned char r, unsigned char g, unsigned char b )
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "main.h"
|
||||
#define inline
|
||||
#include <cglm/quat.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define ANGLE ((float)0x02/0xff*2*GLM_PI)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "data/cube.h"
|
||||
#include "data/axis.h"
|
||||
#include "data/shaders.h"
|
||||
#include <GL/glew.h>
|
||||
//#include <stdlib.h>
|
||||
|
||||
#define WIDTH 512
|
||||
#define HEIGHT 512
|
||||
@@ -31,6 +31,8 @@ int main( void )
|
||||
use_window( window );
|
||||
set_clean_color_context( 0x2E, 0x07, 0x3F );
|
||||
|
||||
glewInit();
|
||||
|
||||
if( !( shader = create_shader() ) )
|
||||
goto error_shader;
|
||||
|
||||
@@ -57,13 +59,14 @@ int main( void )
|
||||
load_rot_matrix( shader, q );
|
||||
|
||||
clean_context();
|
||||
|
||||
#ifndef DEBUG
|
||||
load_mdl_matrix( shader, 0, 0 );
|
||||
draw_mesh( m_axis );
|
||||
load_mdl_matrix( shader, 1, 1 );
|
||||
draw_mesh( m_axis );
|
||||
load_mdl_matrix( shader, 2, 2 );
|
||||
draw_mesh( m_axis );
|
||||
#endif
|
||||
load_mdl_matrix( shader, 0, 3 );
|
||||
draw_mesh( m_cube );
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "main.h"
|
||||
#define inline
|
||||
#include <cglm/mat4.h>
|
||||
#include <cglm/cam.h>
|
||||
#include <cglm/quat.h>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include <stdlib.h>
|
||||
#include "main.h"
|
||||
#include <GL/glew.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct obj
|
||||
{
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/gl.h>
|
||||
#include "main.h"
|
||||
#include <GL/glew.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#define NULL ((void*)0)
|
||||
|
||||
void destroy_shader( unsigned int shader )
|
||||
{
|
||||
return glDeleteProgram( shader );
|
||||
@@ -38,7 +35,7 @@ unsigned char gload_program( unsigned int program, const char * src,
|
||||
return 0;
|
||||
|
||||
shader = glCreateShader(type[i]);
|
||||
glShaderSource( shader, 1, (const GLchar **)&src, NULL);
|
||||
glShaderSource( shader, 1, (const GLchar **)&src, ((void*)0 ));
|
||||
glCompileShader(shader);
|
||||
glGetShaderiv( shader, GL_COMPILE_STATUS, &status );
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "main.h"
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glew.h>
|
||||
|
||||
#define TYPE GL_TEXTURE_2D_ARRAY
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "main.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
void __window_callback( GLFWwindow * window, int w, int h )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user