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