├── Example01_VG
├── .cproject
├── .gitignore
├── .project
├── .settings
│ ├── language.settings.xml
│ ├── org.eclipse.cdt.codan.core.prefs
│ └── org.eclipse.cdt.managedbuilder.core.prefs
└── src
│ └── main.c
├── Example02_VG
├── .cproject
├── .gitignore
├── .project
├── .settings
│ ├── language.settings.xml
│ ├── org.eclipse.cdt.codan.core.prefs
│ └── org.eclipse.cdt.managedbuilder.core.prefs
└── src
│ └── main.c
├── Example03_VG
├── .cproject
├── .gitignore
├── .project
├── .settings
│ ├── language.settings.xml
│ ├── org.eclipse.cdt.codan.core.prefs
│ └── org.eclipse.cdt.managedbuilder.core.prefs
└── src
│ ├── main.c
│ ├── tiger.c
│ └── tiger.h
├── Example04_VG
├── .cproject
├── .gitignore
├── .project
├── .settings
│ ├── language.settings.xml
│ ├── org.eclipse.cdt.codan.core.prefs
│ └── org.eclipse.cdt.managedbuilder.core.prefs
└── src
│ └── main.c
├── Example05_VG
├── .cproject
├── .gitignore
├── .project
├── .settings
│ ├── language.settings.xml
│ ├── org.eclipse.cdt.codan.core.prefs
│ └── org.eclipse.cdt.managedbuilder.core.prefs
└── src
│ ├── FreeMono.h
│ └── main.c
├── External
├── .project
├── x64
│ ├── Darwin
│ │ └── GCC
│ │ │ ├── include
│ │ │ ├── GL
│ │ │ │ ├── glew.h
│ │ │ │ ├── glxew.h
│ │ │ │ └── wglew.h
│ │ │ └── GLFW
│ │ │ │ ├── glfw3.h
│ │ │ │ └── glfw3native.h
│ │ │ └── lib
│ │ │ ├── libGLEW.a
│ │ │ └── libglfw3.a
│ └── Linux
│ │ └── GCC
│ │ ├── include
│ │ ├── GL
│ │ │ ├── glew.h
│ │ │ ├── glxew.h
│ │ │ └── wglew.h
│ │ └── GLFW
│ │ │ ├── glfw3.h
│ │ │ └── glfw3native.h
│ │ └── lib
│ │ ├── libGLEW.a
│ │ └── libglfw3.a
└── x86
│ ├── Linux
│ └── GCC
│ │ ├── include
│ │ ├── GL
│ │ │ ├── glew.h
│ │ │ ├── glxew.h
│ │ │ └── wglew.h
│ │ └── GLFW
│ │ │ ├── glfw3.h
│ │ │ └── glfw3native.h
│ │ └── lib
│ │ ├── libGLEW.a
│ │ └── libglfw3.a
│ └── Windows
│ ├── MSVC
│ ├── include
│ │ ├── GL
│ │ │ ├── glew.h
│ │ │ ├── glxew.h
│ │ │ └── wglew.h
│ │ └── GLFW
│ │ │ ├── glfw3.h
│ │ │ └── glfw3native.h
│ └── lib
│ │ ├── glew32s.lib
│ │ └── glfw3.lib
│ └── MinGW
│ ├── include
│ ├── GL
│ │ ├── glew.h
│ │ ├── glxew.h
│ │ └── wglew.h
│ └── GLFW
│ │ ├── glfw3.h
│ │ └── glfw3native.h
│ └── lib
│ ├── libglew32.a
│ └── libglfw3.a
├── GLUS
├── .cproject
├── .gitignore
├── .project
├── .settings
│ ├── language.settings.xml
│ ├── org.eclipse.cdt.codan.core.prefs
│ └── org.eclipse.cdt.managedbuilder.core.prefs
├── Android
│ └── jni
│ │ ├── Android.mk
│ │ └── Application.mk
├── CMakeLists.txt
├── COPYING.LESSER
├── README.txt
├── docs
│ └── Doxyfile
└── src
│ ├── GL
│ └── glus.h
│ ├── GLES2
│ └── glus2.h
│ ├── GLES3
│ ├── glus3.h
│ └── glus31.h
│ ├── GLUS
│ ├── glus_axisalignedbox.h
│ ├── glus_clib.h
│ ├── glus_complex.h
│ ├── glus_define.h
│ ├── glus_define_color.h
│ ├── glus_define_color_channel.h
│ ├── glus_define_color_channel_es.h
│ ├── glus_define_color_channel_vg.h
│ ├── glus_define_color_vg.h
│ ├── glus_define_shader.h
│ ├── glus_define_shader_es.h
│ ├── glus_define_shader_es31.h
│ ├── glus_define_uint.h
│ ├── glus_define_ushort.h
│ ├── glus_egl.h
│ ├── glus_extension.h
│ ├── glus_file.h
│ ├── glus_file_binary.h
│ ├── glus_file_text.h
│ ├── glus_fourier.h
│ ├── glus_function.h
│ ├── glus_glfw_es.h
│ ├── glus_image.h
│ ├── glus_image_hdr.h
│ ├── glus_image_pkm.h
│ ├── glus_image_tga.h
│ ├── glus_intersect.h
│ ├── glus_line.h
│ ├── glus_line_wavefront.h
│ ├── glus_log.h
│ ├── glus_math.h
│ ├── glus_matrix.h
│ ├── glus_matrix_planar.h
│ ├── glus_matrix_viewprojection.h
│ ├── glus_memory.h
│ ├── glus_orientedbox.h
│ ├── glus_padding.h
│ ├── glus_perlin.h
│ ├── glus_plane.h
│ ├── glus_point.h
│ ├── glus_profile.h
│ ├── glus_program.h
│ ├── glus_program_es.h
│ ├── glus_program_es31.h
│ ├── glus_programpipeline.h
│ ├── glus_programpipeline_es31.h
│ ├── glus_quaternion.h
│ ├── glus_random.h
│ ├── glus_raytrace.h
│ ├── glus_screenshot.h
│ ├── glus_shape.h
│ ├── glus_shape_adjacency.h
│ ├── glus_shape_texgen.h
│ ├── glus_shape_wavefront.h
│ ├── glus_sphere.h
│ ├── glus_time.h
│ ├── glus_typedef.h
│ ├── glus_vector.h
│ ├── glus_version.h
│ ├── glus_wavefront.h
│ └── glus_window.h
│ ├── VG
│ └── glus.h
│ ├── glus_axisalignedbox.c
│ ├── glus_complex.c
│ ├── glus_egl_es.c
│ ├── glus_extension.c
│ ├── glus_extension_vg.c
│ ├── glus_file.c
│ ├── glus_file_binary.c
│ ├── glus_file_text.c
│ ├── glus_fourier.c
│ ├── glus_image.c
│ ├── glus_image_hdr.c
│ ├── glus_image_pkm.c
│ ├── glus_image_tga.c
│ ├── glus_intersect.c
│ ├── glus_line.c
│ ├── glus_line_wavefront.c
│ ├── glus_log.c
│ ├── glus_log_vg.c
│ ├── glus_math.c
│ ├── glus_matrix.c
│ ├── glus_matrix_planar.c
│ ├── glus_matrix_viewprojection.c
│ ├── glus_memory.c
│ ├── glus_memory_nodm.c
│ ├── glus_orientedbox.c
│ ├── glus_os_android_es.c
│ ├── glus_os_linux_es.c
│ ├── glus_os_linux_imx6_es.c
│ ├── glus_os_linux_raspberrypi_es.c
│ ├── glus_os_windows_es.c
│ ├── glus_padding.c
│ ├── glus_perlin.c
│ ├── glus_plane.c
│ ├── glus_point.c
│ ├── glus_profile.c
│ ├── glus_program.c
│ ├── glus_program_es.c
│ ├── glus_program_es31.c
│ ├── glus_programpipeline.c
│ ├── glus_programpipeline_es31.c
│ ├── glus_quaternion.c
│ ├── glus_random.c
│ ├── glus_raytrace.c
│ ├── glus_screenshot.c
│ ├── glus_screenshot_vg.c
│ ├── glus_shape.c
│ ├── glus_shape_adjacency.c
│ ├── glus_shape_texgen.c
│ ├── glus_shape_wavefront.c
│ ├── glus_sphere.c
│ ├── glus_time.c
│ ├── glus_time_es.c
│ ├── glus_vector.c
│ ├── glus_version.c
│ ├── glus_wavefront.c
│ ├── glus_window_egl_es.c
│ ├── glus_window_glfw.c
│ └── glus_window_recording.c
├── README.md
└── VG_Binaries
├── .project
├── COPYING.LESSER
├── CourierNew.tga
├── README.txt
└── libOpenVG.dll
/Example01_VG/.gitignore:
--------------------------------------------------------------------------------
1 | /ARMv7_Vivante_Linux_VG11_GCC_Release/
2 |
--------------------------------------------------------------------------------
/Example01_VG/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Example01_VG
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/Example01/DebugMac}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Example01_VG/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Example01_VG/.settings/org.eclipse.cdt.managedbuilder.core.prefs:
--------------------------------------------------------------------------------
1 | #Wed Jan 11 19:59:32 CET 2012
2 | eclipse.preferences.version=1
3 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/CPATH/delimiter=;
4 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/CPATH/operation=remove
5 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/C_INCLUDE_PATH/delimiter=;
6 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/C_INCLUDE_PATH/operation=remove
7 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/append=true
8 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/appendContributed=true
9 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/CPATH/delimiter=;
10 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/CPATH/operation=remove
11 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/C_INCLUDE_PATH/delimiter=;
12 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/C_INCLUDE_PATH/operation=remove
13 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/append=true
14 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/appendContributed=true
15 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/LIBRARY_PATH/delimiter=;
16 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/LIBRARY_PATH/operation=remove
17 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/append=true
18 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/appendContributed=true
19 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/LIBRARY_PATH/delimiter=;
20 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/LIBRARY_PATH/operation=remove
21 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/append=true
22 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/appendContributed=true
23 |
--------------------------------------------------------------------------------
/Example01_VG/src/main.c:
--------------------------------------------------------------------------------
1 | /**
2 | * OpenVG 1.1 - Example 01
3 | *
4 | * @author Norbert Nopper norbert@nopper.tv
5 | *
6 | * Homepage: http://nopper.tv
7 | *
8 | * Copyright Norbert Nopper
9 | */
10 |
11 | #include
12 |
13 | #include "VG/glus.h"
14 |
15 | static VGint g_width;
16 | static VGint g_height;
17 |
18 | /**
19 | * Function for initialization.
20 | */
21 | GLUSboolean init(GLUSvoid)
22 | {
23 | VGfloat clearColor[4] = {0.0f, 0.0f, 1.0f, 1.0f};
24 |
25 | // The background will just cleared with blue color.
26 | vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
27 |
28 | return GLUS_TRUE;
29 | }
30 |
31 | /**
32 | * Function is called before first update and every time when the window is resized.
33 | *
34 | * @param w width of the window
35 | * @param h height of the window
36 | */
37 | GLUSvoid reshape(GLUSint width, GLUSint height)
38 | {
39 | g_width = width;
40 | g_height = height;
41 | }
42 |
43 | /**
44 | * Function to render and display content. Swapping of the buffers is automatically done.
45 | *
46 | * @return true for continuing, false to exit the application
47 | */
48 | GLUSboolean update(GLUSfloat time)
49 | {
50 | // Now, the background is painted blue.
51 | vgClear(0, 0, g_width, g_height);
52 |
53 | return GLUS_TRUE;
54 | }
55 |
56 | /**
57 | * Function to clean up things.
58 | */
59 | GLUSvoid terminate(GLUSvoid)
60 | {
61 | }
62 |
63 | /**
64 | * Main entry point.
65 | */
66 | int main(int argc, char* argv[])
67 | {
68 | EGLint eglConfigAttributes[] = {
69 | EGL_RED_SIZE, 8,
70 | EGL_GREEN_SIZE, 8,
71 | EGL_BLUE_SIZE, 8,
72 | EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
73 | EGL_NONE
74 | };
75 |
76 | EGLint eglContextAttributes[] = {
77 | EGL_NONE
78 | };
79 |
80 | glusWindowSetInitFunc(init);
81 |
82 | glusWindowSetReshapeFunc(reshape);
83 |
84 | glusWindowSetUpdateFunc(update);
85 |
86 | glusWindowSetTerminateFunc(terminate);
87 |
88 | if (!glusWindowCreate("GLUS Example Window", 640, 480, GLUS_FALSE, GLUS_FALSE, eglConfigAttributes, eglContextAttributes, 0))
89 | {
90 | printf("Could not create window!\n");
91 | return -1;
92 | }
93 |
94 | glusWindowRun();
95 |
96 | return 0;
97 | }
98 |
--------------------------------------------------------------------------------
/Example02_VG/.gitignore:
--------------------------------------------------------------------------------
1 | /ARMv7_Vivante_Linux_VG11_GCC_Release/
2 |
--------------------------------------------------------------------------------
/Example02_VG/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Example02_VG
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/Example01/DebugMac}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Example02_VG/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Example02_VG/.settings/org.eclipse.cdt.managedbuilder.core.prefs:
--------------------------------------------------------------------------------
1 | #Wed Jan 11 19:59:32 CET 2012
2 | eclipse.preferences.version=1
3 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/CPATH/delimiter=;
4 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/CPATH/operation=remove
5 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/C_INCLUDE_PATH/delimiter=;
6 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/C_INCLUDE_PATH/operation=remove
7 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/append=true
8 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/appendContributed=true
9 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/CPATH/delimiter=;
10 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/CPATH/operation=remove
11 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/C_INCLUDE_PATH/delimiter=;
12 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/C_INCLUDE_PATH/operation=remove
13 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/append=true
14 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/appendContributed=true
15 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/LIBRARY_PATH/delimiter=;
16 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/LIBRARY_PATH/operation=remove
17 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/append=true
18 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/appendContributed=true
19 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/LIBRARY_PATH/delimiter=;
20 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/LIBRARY_PATH/operation=remove
21 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/append=true
22 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/appendContributed=true
23 |
--------------------------------------------------------------------------------
/Example03_VG/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/Example03_VG/.gitignore
--------------------------------------------------------------------------------
/Example03_VG/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Example03_VG
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/Example01/DebugMac}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Example03_VG/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Example03_VG/.settings/org.eclipse.cdt.managedbuilder.core.prefs:
--------------------------------------------------------------------------------
1 | #Wed Jan 11 19:59:32 CET 2012
2 | eclipse.preferences.version=1
3 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/CPATH/delimiter=;
4 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/CPATH/operation=remove
5 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/C_INCLUDE_PATH/delimiter=;
6 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/C_INCLUDE_PATH/operation=remove
7 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/append=true
8 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/appendContributed=true
9 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/CPATH/delimiter=;
10 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/CPATH/operation=remove
11 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/C_INCLUDE_PATH/delimiter=;
12 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/C_INCLUDE_PATH/operation=remove
13 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/append=true
14 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/appendContributed=true
15 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/LIBRARY_PATH/delimiter=;
16 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/LIBRARY_PATH/operation=remove
17 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/append=true
18 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/appendContributed=true
19 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/LIBRARY_PATH/delimiter=;
20 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/LIBRARY_PATH/operation=remove
21 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/append=true
22 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/appendContributed=true
23 |
--------------------------------------------------------------------------------
/Example03_VG/src/tiger.h:
--------------------------------------------------------------------------------
1 | #ifndef __TIGER_H
2 | #define __TIGER_H
3 |
4 | /*------------------------------------------------------------------------
5 | *
6 | * OpenVG 1.0.1 Reference Implementation sample code
7 | * -------------------------------------------------
8 | *
9 | * Copyright (c) 2007 The Khronos Group Inc.
10 | *
11 | * Permission is hereby granted, free of charge, to any person obtaining a
12 | * copy of this software and /or associated documentation files
13 | * (the "Materials "), to deal in the Materials without restriction,
14 | * including without limitation the rights to use, copy, modify, merge,
15 | * publish, distribute, sublicense, and/or sell copies of the Materials,
16 | * and to permit persons to whom the Materials are furnished to do so,
17 | * subject to the following conditions:
18 | *
19 | * The above copyright notice and this permission notice shall be included
20 | * in all copies or substantial portions of the Materials.
21 | *
22 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
28 | * THE USE OR OTHER DEALINGS IN THE MATERIALS.
29 | *
30 | *//**
31 | * \file
32 | * \brief Header for including the Tiger image data.
33 | * \note
34 | *//*-------------------------------------------------------------------*/
35 |
36 | extern const int tigerCommandCount;
37 | extern const char tigerCommands[];
38 | extern const float tigerMinX;
39 | extern const float tigerMaxX;
40 | extern const float tigerMinY;
41 | extern const float tigerMaxY;
42 | extern const int tigerPointCount;
43 | extern const float tigerPoints[];
44 |
45 | #endif /* __TIGER_H */
46 |
--------------------------------------------------------------------------------
/Example04_VG/.gitignore:
--------------------------------------------------------------------------------
1 | /ARMv7_Vivante_Linux_VG11_GCC_Release/
2 |
--------------------------------------------------------------------------------
/Example04_VG/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Example04_VG
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/Example01/DebugMac}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Example04_VG/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Example04_VG/.settings/org.eclipse.cdt.managedbuilder.core.prefs:
--------------------------------------------------------------------------------
1 | #Wed Jan 11 19:59:32 CET 2012
2 | eclipse.preferences.version=1
3 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/CPATH/delimiter=;
4 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/CPATH/operation=remove
5 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/C_INCLUDE_PATH/delimiter=;
6 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/C_INCLUDE_PATH/operation=remove
7 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/append=true
8 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/appendContributed=true
9 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/CPATH/delimiter=;
10 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/CPATH/operation=remove
11 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/C_INCLUDE_PATH/delimiter=;
12 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/C_INCLUDE_PATH/operation=remove
13 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/append=true
14 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/appendContributed=true
15 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/LIBRARY_PATH/delimiter=;
16 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/LIBRARY_PATH/operation=remove
17 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/append=true
18 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/appendContributed=true
19 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/LIBRARY_PATH/delimiter=;
20 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/LIBRARY_PATH/operation=remove
21 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/append=true
22 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/appendContributed=true
23 |
--------------------------------------------------------------------------------
/Example05_VG/.gitignore:
--------------------------------------------------------------------------------
1 | /ARMv7_Vivante_Linux_VG11_GCC_Release/
2 |
--------------------------------------------------------------------------------
/Example05_VG/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Example05_VG
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/Example01/DebugMac}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Example05_VG/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Example05_VG/.settings/org.eclipse.cdt.managedbuilder.core.prefs:
--------------------------------------------------------------------------------
1 | #Wed Jan 11 19:59:32 CET 2012
2 | eclipse.preferences.version=1
3 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/CPATH/delimiter=;
4 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/CPATH/operation=remove
5 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/C_INCLUDE_PATH/delimiter=;
6 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/C_INCLUDE_PATH/operation=remove
7 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/append=true
8 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/appendContributed=true
9 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/CPATH/delimiter=;
10 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/CPATH/operation=remove
11 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/C_INCLUDE_PATH/delimiter=;
12 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/C_INCLUDE_PATH/operation=remove
13 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/append=true
14 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/appendContributed=true
15 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/LIBRARY_PATH/delimiter=;
16 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/LIBRARY_PATH/operation=remove
17 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/append=true
18 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.894771756/appendContributed=true
19 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/LIBRARY_PATH/delimiter=;
20 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/LIBRARY_PATH/operation=remove
21 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/append=true
22 | environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.289745933/appendContributed=true
23 |
--------------------------------------------------------------------------------
/External/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | External
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/External/x64/Darwin/GCC/lib/libGLEW.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/External/x64/Darwin/GCC/lib/libGLEW.a
--------------------------------------------------------------------------------
/External/x64/Darwin/GCC/lib/libglfw3.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/External/x64/Darwin/GCC/lib/libglfw3.a
--------------------------------------------------------------------------------
/External/x64/Linux/GCC/lib/libGLEW.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/External/x64/Linux/GCC/lib/libGLEW.a
--------------------------------------------------------------------------------
/External/x64/Linux/GCC/lib/libglfw3.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/External/x64/Linux/GCC/lib/libglfw3.a
--------------------------------------------------------------------------------
/External/x86/Linux/GCC/lib/libGLEW.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/External/x86/Linux/GCC/lib/libGLEW.a
--------------------------------------------------------------------------------
/External/x86/Linux/GCC/lib/libglfw3.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/External/x86/Linux/GCC/lib/libglfw3.a
--------------------------------------------------------------------------------
/External/x86/Windows/MSVC/lib/glew32s.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/External/x86/Windows/MSVC/lib/glew32s.lib
--------------------------------------------------------------------------------
/External/x86/Windows/MSVC/lib/glfw3.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/External/x86/Windows/MSVC/lib/glfw3.lib
--------------------------------------------------------------------------------
/External/x86/Windows/MinGW/lib/libglew32.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/External/x86/Windows/MinGW/lib/libglew32.a
--------------------------------------------------------------------------------
/External/x86/Windows/MinGW/lib/libglfw3.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/External/x86/Windows/MinGW/lib/libglfw3.a
--------------------------------------------------------------------------------
/GLUS/.gitignore:
--------------------------------------------------------------------------------
1 | /ARMv7_Vivante_Linux_GLES3_GCC_Release
2 | /ARMv7_Vivante_Linux_VG11_GCC_Release
3 | /x86_PowerVR_Windows_GLES3_MinGW_Debug/
4 | /x86__Windows__MinGW_Debug/
5 | /x86_Khronos_Windows_VG11_MinGW_Debug/
6 | /x86_PowerVR_Windows_GLES2_MinGW_Debug/
7 | /x86_PowerVR_Windows_GLES31_MinGW_Debug/
8 | /ARMv7_Vivante_Linux_GLES2_GCC_Release/
9 |
--------------------------------------------------------------------------------
/GLUS/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | GLUS
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/GLUS/DebugMac}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/GLUS/.settings/org.eclipse.cdt.managedbuilder.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019.837986836.1846977762.1644329299/CPATH/delimiter=\:
3 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019.837986836.1846977762.1644329299/CPATH/operation=remove
4 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019.837986836.1846977762.1644329299/C_INCLUDE_PATH/delimiter=\:
5 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019.837986836.1846977762.1644329299/C_INCLUDE_PATH/operation=remove
6 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019.837986836.1846977762.1644329299/append=true
7 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019.837986836.1846977762.1644329299/appendContributed=true
8 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019/CPATH/delimiter=;
9 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019/CPATH/operation=remove
10 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019/C_INCLUDE_PATH/delimiter=;
11 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019/C_INCLUDE_PATH/operation=remove
12 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019/append=true
13 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.debug.1519633019/appendContributed=true
14 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.release.1071540673/CPATH/delimiter=;
15 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.release.1071540673/CPATH/operation=remove
16 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.release.1071540673/C_INCLUDE_PATH/delimiter=;
17 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.release.1071540673/C_INCLUDE_PATH/operation=remove
18 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.release.1071540673/append=true
19 | environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.lib.release.1071540673/appendContributed=true
20 |
--------------------------------------------------------------------------------
/GLUS/Android/jni/Android.mk:
--------------------------------------------------------------------------------
1 | # Comment out the version used.
2 |
3 | GLES_VERSION := 20
4 | #GLES_VERSION := 30
5 | #GLES_VERSION := 31
6 |
7 | LOCAL_PATH := $(call my-dir)
8 |
9 | #
10 | # GLUS.
11 | #
12 |
13 | include $(CLEAR_VARS)
14 |
15 | LOCAL_MODULE := GLUS
16 |
17 | # All files.
18 |
19 | PROJECT_FILES := $(wildcard $(LOCAL_PATH)/../../src/*.c)
20 |
21 | # Remove specific files.
22 |
23 | GL_FILES := $(LOCAL_PATH)/../../src/glus_window_glfw.c
24 | GL_FILES += $(LOCAL_PATH)/../../src/glus_programpipeline.c
25 | GL_FILES += $(LOCAL_PATH)/../../src/glus_program.c
26 | GL_FILES += $(LOCAL_PATH)/../../src/glus_shape_adjacency.c
27 |
28 | NOT_USED_FILES := $(LOCAL_PATH)/../../src/glus_memory_nodm.c
29 |
30 | OS_FILES := $(wildcard $(LOCAL_PATH)/../../src/glus_os_*.c)
31 |
32 | VG_FILES := $(wildcard $(LOCAL_PATH)/../../src/*_vg.c)
33 |
34 | ES_FILES := $(wildcard $(LOCAL_PATH)/../../src/*_es.c)
35 |
36 | ES2_FILES := $(wildcard $(LOCAL_PATH)/../../src/*_es2.c)
37 |
38 | ES31_FILES := $(wildcard $(LOCAL_PATH)/../../src/*_es31.c)
39 |
40 | PROJECT_FILES := $(filter-out $(GL_FILES), $(PROJECT_FILES))
41 | PROJECT_FILES := $(filter-out $(OS_FILES), $(PROJECT_FILES))
42 | PROJECT_FILES := $(filter-out $(NOT_USED_FILES), $(PROJECT_FILES))
43 | PROJECT_FILES := $(filter-out $(VG_FILES), $(PROJECT_FILES))
44 | ifeq ($(GLES_VERSION),20)
45 | PROJECT_FILES := $(filter-out $(ES31_FILES), $(PROJECT_FILES))
46 |
47 | LOCAL_CFLAGS := -DGLUS_ES2=1
48 | endif
49 | ifeq ($(GLES_VERSION),30)
50 | PROJECT_FILES := $(filter-out $(ES2_FILES), $(PROJECT_FILES))
51 | PROJECT_FILES := $(filter-out $(ES31_FILES), $(PROJECT_FILES))
52 |
53 | LOCAL_CFLAGS := -DGLUS_ES3=1
54 | endif
55 | ifeq ($(GLES_VERSION),31)
56 | PROJECT_FILES := $(filter-out $(ES2_FILES), $(PROJECT_FILES))
57 |
58 | LOCAL_CFLAGS := -DGLUS_ES31=1
59 | endif
60 |
61 | # Change base path in general.
62 |
63 | LOCAL_CFLAGS += -DGLUS_BASE_DIRECTORY=\"/sdcard/Download/Binaries/\"
64 |
65 | # Add specfic files.
66 |
67 | PROJECT_FILES += $(LOCAL_PATH)/../../src/glus_os_android_es.c
68 |
69 | # Generate the final list.
70 |
71 | PROJECT_FILES := $(PROJECT_FILES:$(LOCAL_PATH)/%=%)
72 |
73 | #
74 |
75 | LOCAL_SRC_FILES := $(PROJECT_FILES)
76 |
77 | LOCAL_STATIC_LIBRARIES := android_native_app_glue
78 |
79 | include $(BUILD_STATIC_LIBRARY)
80 |
81 | $(call import-module,android/native_app_glue)
82 |
--------------------------------------------------------------------------------
/GLUS/Android/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_PLATFORM := android-19
2 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_axisalignedbox.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_AXIS_ALIGNED_BOX_H_
19 | #define GLUS_AXIS_ALIGNED_BOX_H_
20 |
21 | /**
22 | * Copies an axis aligned box.
23 | *
24 | * @param resultCenter Destination center.
25 | * @param resultHalfExtend Destination half extend.
26 | * @param center Source center.
27 | * @param halfExtend Source half extend.
28 | */
29 | GLUSAPI GLUSvoid GLUSAPIENTRY glusAxisAlignedBoxCopyf(GLUSfloat resultCenter[4], GLUSfloat resultHalfExtend[3], const GLUSfloat center[4], const GLUSfloat halfExtend[3]);
30 |
31 | /**
32 | * Calculates the signed distance from an axis aligned box to a point. If the value is negative, the point is inside the box.
33 | *
34 | * @param center The center of the box.
35 | * @param halfExtend The length from the center point to the planes of the box.
36 | * @param point The used point.
37 | *
38 | * @return The signed distance.
39 | */
40 | GLUSAPI GLUSfloat GLUSAPIENTRY glusAxisAlignedBoxDistancePoint4f(const GLUSfloat center[4], const GLUSfloat halfExtend[3], const GLUSfloat point[4]);
41 |
42 | #endif /* GLUS_AXIS_ALIGNED_BOX_H_ */
43 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_clib.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_CLIB_H_
19 | #define GLUS_CLIB_H_
20 |
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | #endif /* GLUS_CLIB_H_ */
30 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_define.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_DEFINE_H_
19 | #define GLUS_DEFINE_H_
20 |
21 | #define GLUS_NO_ERROR 0
22 | #define GLUS_OK 0
23 | #define GLUS_TRUE 1
24 | #define GLUS_FALSE 0
25 |
26 | #define GLUS_POINTS 0x0000
27 |
28 | #define GLUS_LINES 0x0001
29 | #define GLUS_LINE_LOOP 0x0002
30 | #define GLUS_LINE_STRIP 0x0003
31 | #define GLUS_LINES_ADJACENCY 0x000A
32 | #define GLUS_LINE_STRIP_ADJACENCY 0x000B
33 |
34 | #define GLUS_TRIANGLES 0x0004
35 | #define GLUS_TRIANGLE_STRIP 0x0005
36 | #define GLUS_TRIANGLE_FAN 0x0006
37 | #define GLUS_TRIANGLES_ADJACENCY 0x000C
38 | #define GLUS_TRIANGLE_STRIP_ADJACENCY 0x000D
39 |
40 | #define GLUS_UNPACK_ALIGNMENT 0x0CF5
41 | #define GLUS_PACK_ALIGNMENT 0x0D05
42 |
43 | #define GLUS_BYTE 0x1400
44 | #define GLUS_UNSIGNED_BYTE 0x1401
45 | #define GLUS_SHORT 0x1402
46 | #define GLUS_UNSIGNED_SHORT 0x1403
47 | #define GLUS_INT 0x1404
48 | #define GLUS_UNSIGNED_INT 0x1405
49 | #define GLUS_FLOAT 0x1406
50 | #define GLUS_DOUBLE 0x140A
51 |
52 | #define GLUS_VERSION 0x1F02
53 | #define GLUS_EXTENSIONS 0x1F03
54 |
55 | #define GLUS_COMPILE_STATUS 0x8B81
56 | #define GLUS_LINK_STATUS 0x8B82
57 | #define GLUS_VALIDATE_STATUS 0x8B83
58 | #define GLUS_INFO_LOG_LENGTH 0x8B84
59 |
60 | #define GLUS_FRAMEBUFFER 0x8D40
61 |
62 | #define GLUS_COMPRESSED_R11_EAC 0x9270
63 | #define GLUS_COMPRESSED_SIGNED_R11_EAC 0x9271
64 | #define GLUS_COMPRESSED_RG11_EAC 0x9272
65 | #define GLUS_COMPRESSED_SIGNED_RG11_EAC 0x9273
66 | #define GLUS_COMPRESSED_RGB8_ETC2 0x9274
67 | #define GLUS_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
68 | #define GLUS_COMPRESSED_RGBA8_ETC2_EAC 0x9278
69 |
70 | #define GLUS_PI 3.1415926535897932384626433832795f
71 |
72 | #define GLUS_LOG_NOTHING 0
73 | #define GLUS_LOG_ERROR 1
74 | #define GLUS_LOG_WARNING 2
75 | #define GLUS_LOG_INFO 3
76 | #define GLUS_LOG_DEBUG 4
77 | #define GLUS_LOG_SEVERE 5
78 |
79 | #define GLUS_VERTICES_FACTOR 4
80 | #define GLUS_VERTICES_DIVISOR 4
81 |
82 | #define GLUS_MAX_STRING 256
83 |
84 | #define GLUS_MAX_FILENAME 2048
85 |
86 | #ifndef GLUS_BASE_DIRECTORY
87 | #define GLUS_BASE_DIRECTORY ""
88 | #endif
89 |
90 | #endif /* GLUS_DEFINE_H_ */
91 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_define_color.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_DEFINE_COLOR_H_
19 | #define GLUS_DEFINE_COLOR_H_
20 |
21 | #define GLUS_RED 0x00001903
22 | #define GLUS_ALPHA 0x00001906
23 | #define GLUS_RGB 0x00001907
24 | #define GLUS_RGBA 0x00001908
25 | #define GLUS_LUMINANCE 0x00001909
26 |
27 | #endif /* GLUS_DEFINE_COLOR_H_ */
28 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_define_color_channel.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_DEFINE_COLOR_CHANNEL_H_
19 | #define GLUS_DEFINE_COLOR_CHANNEL_H_
20 |
21 | #define GLUS_SINGLE_CHANNEL GLUS_RED
22 |
23 | #endif /* GLUS_DEFINE_COLOR_CHANNEL_H_ */
24 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_define_color_channel_es.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_DEFINE_COLOR_CHANNEL_ES_H_
19 | #define GLUS_DEFINE_COLOR_CHANNEL_ES_H_
20 |
21 | #define GLUS_SINGLE_CHANNEL GLUS_ALPHA
22 |
23 | #endif /* GLUS_DEFINE_COLOR_CHANNEL_ES_H_ */
24 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_define_color_channel_vg.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_DEFINE_COLOR_CHANNEL_VG_H_
19 | #define GLUS_DEFINE_COLOR_CHANNEL_VG_H_
20 |
21 | #define GLUS_SINGLE_CHANNEL GLUS_ALPHA
22 |
23 | #endif /* GLUS_DEFINE_COLOR_CHANNEL_VG_H_ */
24 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_define_color_vg.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_DEFINE_COLOR_H_
19 | #define GLUS_DEFINE_COLOR_H_
20 |
21 | #define GLUS_RED 0x00001903
22 | #define GLUS_ALPHA VG_A_8
23 | #define GLUS_RGB 0x00001907
24 | #define GLUS_RGBA VG_sABGR_8888
25 | #define GLUS_LUMINANCE VG_sL_8
26 |
27 | #endif /* GLUS_DEFINE_COLOR_H_ */
28 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_define_shader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_DEFINE_SHADER_ES_H_
19 | #define GLUS_DEFINE_SHADER_ES_H_
20 |
21 | #define GLUS_VERTEX_SHADER 0x00008B31
22 | #define GLUS_FRAGMENT_SHADER 0x00008B30
23 | #define GLUS_TESS_EVALUATION_SHADER 0x00008E87
24 | #define GLUS_TESS_CONTROL_SHADER 0x00008E88
25 | #define GLUS_GEOMETRY_SHADER 0x00008DD9
26 | #define GLUS_COMPUTE_SHADER 0x000091B9
27 |
28 | #define GLUS_VERTEX_SHADER_BIT 0x00000001
29 | #define GLUS_FRAGMENT_SHADER_BIT 0x00000002
30 | #define GLUS_GEOMETRY_SHADER_BIT 0x00000004
31 | #define GLUS_TESS_CONTROL_SHADER_BIT 0x00000008
32 | #define GLUS_TESS_EVALUATION_SHADER_BIT 0x00000010
33 | #define GLUS_COMPUTE_SHADER_BIT 0x00000020
34 | #define GLUS_ALL_SHADER_BITS 0xFFFFFFFF
35 |
36 | #endif /* GLUS_DEFINE_SHADER_ES_H_ */
37 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_define_shader_es.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_DEFINE_SHADER_H_
19 | #define GLUS_DEFINE_SHADER_H_
20 |
21 | #define GLUS_VERTEX_SHADER 0x00008B31
22 | #define GLUS_FRAGMENT_SHADER 0x00008B30
23 |
24 | #endif /* GLUS_DEFINE_SHADER_H_ */
25 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_define_shader_es31.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_DEFINE_SHADER_ES31_H_
19 | #define GLUS_DEFINE_SHADER_ES31_H_
20 |
21 | #define GLUS_VERTEX_SHADER 0x00008B31
22 | #define GLUS_FRAGMENT_SHADER 0x00008B30
23 | #define GLUS_COMPUTE_SHADER 0x000091B9
24 |
25 | #define GLUS_VERTEX_SHADER_BIT 0x00000001
26 | #define GLUS_FRAGMENT_SHADER_BIT 0x00000002
27 | #define GLUS_COMPUTE_SHADER_BIT 0x00000020
28 | #define GLUS_ALL_SHADER_BITS 0xFFFFFFFF
29 |
30 | #endif /* GLUS_DEFINE_SHADER_ES31_H_ */
31 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_define_uint.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_DEFINE_UINT_H_
19 | #define GLUS_DEFINE_UINT_H_
20 |
21 | #define GLUS_MAX_VERTICES 1048576
22 | #define GLUS_MAX_INDICES (GLUS_MAX_VERTICES*GLUS_VERTICES_FACTOR)
23 |
24 | #define GLUSindex GLUSuint
25 |
26 | #endif /* GLUS_DEFINE_UINT_H_ */
27 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_define_ushort.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_DEFINE_USHORT_H_
19 | #define GLUS_DEFINE_USHORT_H_
20 |
21 | #define GLUS_MAX_VERTICES 65536
22 | #define GLUS_MAX_INDICES (GLUS_MAX_VERTICES*GLUS_VERTICES_FACTOR)
23 |
24 | #define GLUSindex GLUSushort
25 |
26 | #endif /* GLUS_DEFINE_USHORT_H_ */
27 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_egl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_EGL_H_
19 | #define GLUS_EGL_H_
20 |
21 | /**
22 | * Creates the context and all needed EGL elements.
23 | *
24 | * @param eglNativeDisplayType Native display type.
25 | * @param eglDisplay EGL display.
26 | * @param eglConfig EGL configuration.
27 | * @param eglContext EGL context.
28 | * @param configAttribList EGL configuration attribute list.
29 | * @param contextAttribList EGL context attribute list.
30 | *
31 | * @return EGL_TRUE, when creation of context succeeded.
32 | */
33 | GLUSAPI EGLBoolean GLUSAPIENTRY glusEGLCreateContext(EGLNativeDisplayType eglNativeDisplayType, EGLDisplay* eglDisplay, EGLConfig* eglConfig, EGLContext *eglContext, const EGLint configAttribList[], const EGLint contextAttribList[]);
34 |
35 | /**
36 | * Creates a window surface and sets it as current.
37 | *
38 | * @param eglNativeWindowType Native window type.
39 | * @param eglDisplay EGL display.
40 | * @param eglConfig EGL configuration.
41 | * @param eglContext EGL context.
42 | * @param eglSurface EGL surface.
43 | *
44 | * @return EGL_TRUE, when creation of window and setting of context succeeded.
45 | */
46 | GLUSAPI EGLBoolean GLUSAPIENTRY glusEGLCreateWindowSurfaceMakeCurrent(EGLNativeWindowType eglNativeWindowType, EGLDisplay* eglDisplay, EGLConfig* eglConfig, EGLContext* eglContext, EGLSurface* eglSurface, const EGLint* surfaceAttribList);
47 |
48 | /**
49 | * Returns the created default EGL display.
50 | *
51 | * @return the EGL display.
52 | */
53 | GLUSAPI EGLDisplay GLUSAPIENTRY glusEGLGetDefaultDisplay(GLUSvoid);
54 |
55 | /**
56 | * Returns the created default EGL surface.
57 | *
58 | * @return the EGL surface.
59 | */
60 | GLUSAPI EGLSurface GLUSAPIENTRY glusEGLGetDefaultSurface(GLUSvoid);
61 |
62 | /**
63 | * Returns the created default EGL context.
64 | *
65 | * @return the EGL context.
66 | */
67 | GLUSAPI EGLContext GLUSAPIENTRY glusEGLGetDefaultContext(GLUSvoid);
68 |
69 | /**
70 | * Terminates EGL an frees all resources.
71 | *
72 | * @param eglDisplay EGL display.
73 | * @param eglContext EGL context.
74 | * @param eglSurface EGL surface.
75 | */
76 | GLUSAPI GLUSvoid GLUSAPIENTRY glusEGLTerminate(EGLDisplay* eglDisplay, EGLContext* eglContext, EGLSurface* eglSurface);
77 |
78 | #endif /* GLUS_EGL_H_ */
79 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_extension.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_EXTENSION_H_
19 | #define GLUS_EXTENSION_H_
20 |
21 | /**
22 | * Checks, if an OpenGL extension is supported.
23 | *
24 | * @param extension The name of the extension.
25 | *
26 | * @return GLUS_TRUE, if the given extension is supported.
27 | */
28 | GLUSAPI GLUSboolean GLUSAPIENTRY glusExtensionIsSupported(const GLUSchar* extension);
29 |
30 | /**
31 | * Gathers the function pointer of an extension.
32 | *
33 | * @param procname The name of the function.
34 | *
35 | * @return The function pointer.
36 | */
37 | GLUSAPI void* GLUSAPIENTRY glusExtensionGetFuncAddress(const GLUSchar* procname);
38 |
39 | #endif /* GLUS_EXTENSION_H_ */
40 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_file.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_FILE_H_
19 | #define GLUS_FILE_H_
20 |
21 | /**
22 | * Structure used for text file loading.
23 | */
24 | typedef struct _GLUStextfile
25 | {
26 | /**
27 | * Contains the data of the text file.
28 | */
29 | GLUSchar* text;
30 |
31 | /**
32 | * The length of the text file without the null terminator.
33 | */
34 | GLUSint length;
35 |
36 | } GLUStextfile;
37 |
38 | /**
39 | * Structure used for binary file loading.
40 | */
41 | typedef struct _GLUSbinaryfile
42 | {
43 | /**
44 | * The binary data of the file.
45 | */
46 | GLUSubyte* binary;
47 |
48 | /**
49 | * The length of the binary data.
50 | */
51 | GLUSint length;
52 |
53 | } GLUSbinaryfile;
54 |
55 | /**
56 | * Opens the file whose name is specified in the parameter filename and
57 | * associates it with a stream that can be identified in future operations by the FILE pointer returned.
58 | *
59 | * @param filename C string containing the name of the file to be opened.
60 | * @param mode C string containing a file access mode
61 | *
62 | * @return If the file is successfully opened, the function returns a pointer to a FILE object that can be used to identify the stream on future operations.
63 | * Otherwise, a null pointer is returned.
64 | */
65 | GLUSAPI FILE* GLUSAPIENTRY glusFileOpen(const char * filename, const char * mode);
66 |
67 |
68 | /**
69 | * Closes the file associated with the stream and disassociates it.
70 | *
71 | * @param stream Pointer to a FILE object that specifies the stream to be closed.
72 | *
73 | * @return If the stream is successfully closed, a zero value is returned.
74 | * On failure, EOF is returned.
75 | */
76 | GLUSAPI int GLUSAPIENTRY glusFileClose(FILE* stream);
77 |
78 | #endif /* GLUS_FILE_H_ */
79 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_file_binary.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_FILE_BINARY_H_
19 | #define GLUS_FILE_BINARY_H_
20 |
21 | /**
22 | * Loads a binary file.
23 | *
24 | * @param filename The name of the file to load.
25 | * @param binaryfile The structure to fill the binary data.
26 | *
27 | * @return GLUS_TRUE, if loading succeeded.
28 | */
29 | GLUSAPI GLUSboolean GLUSAPIENTRY glusFileLoadBinary(const GLUSchar* filename, GLUSbinaryfile* binaryfile);
30 |
31 | /**
32 | * Saves a binary file.
33 | *
34 | * @param filename The name of the file to save.
35 | * @param binaryfile The structure with the binary data.
36 | *
37 | * @return GLUS_TRUE, if saving succeeded.
38 | */
39 | GLUSAPI GLUSboolean GLUSAPIENTRY glusFileSaveBinary(const GLUSchar* filename, const GLUSbinaryfile* binaryfile);
40 |
41 | /**
42 | * Destroys the content of a binary structure. Has to be called for freeing the resources.
43 | *
44 | * @param binaryfile The binary file structure.
45 | */
46 | GLUSAPI GLUSvoid GLUSAPIENTRY glusFileDestroyBinary(GLUSbinaryfile* binaryfile);
47 |
48 | #endif /* GLUS_FILE_BINARY_H_ */
49 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_file_text.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_FILE_TEXT_H_
19 | #define GLUS_FILE_TEXT_H_
20 |
21 | /**
22 | * Loads a text file.
23 | *
24 | * @param filename The name of the file to load.
25 | * @param textfile The structure to fill the text data.
26 | *
27 | * @return GLUS_TRUE, if loading succeeded.
28 | */
29 | GLUSAPI GLUSboolean GLUSAPIENTRY glusFileLoadText(const GLUSchar* filename, GLUStextfile* textfile);
30 |
31 | /**
32 | * Saves a text file.
33 | *
34 | * @param filename The name of the file to save.
35 | * @param textfile The structure with the text data.
36 | *
37 | * @return GLUS_TRUE, if saving succeeded.
38 | */
39 | GLUSAPI GLUSboolean GLUSAPIENTRY glusFileSaveText(const GLUSchar* filename, const GLUStextfile* textfile);
40 |
41 | /**
42 | * Destroys the content of a text structure. Has to be called for freeing the resources.
43 | *
44 | * @param textfile The text file structure.
45 | */
46 | GLUSAPI GLUSvoid GLUSAPIENTRY glusFileDestroyText(GLUStextfile* textfile);
47 |
48 | #endif /* GLUS_FILE_TEXT_H_ */
49 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_function.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_FUNCTION_H_
19 | #define GLUS_FUNCTION_H_
20 |
21 | #ifdef _MSC_VER
22 | #define GLUSINLINE static __forceinline
23 | #else
24 | #define GLUSINLINE static inline
25 | #endif
26 |
27 | #ifndef GLUSAPIENTRY
28 | #ifdef GLAPIENTRY
29 | #define GLUSAPIENTRY GLAPIENTRY
30 | #else
31 | #define GLUSAPIENTRY
32 | #endif
33 | #endif
34 | #ifndef GLUSAPIENTRYP
35 | #define GLUSAPIENTRYP GLUSAPIENTRY *
36 | #endif
37 | #ifndef GLUSAPI
38 | #define GLUSAPI extern
39 | #endif
40 |
41 | #endif /* GLUS_FUNCTION_H_ */
42 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_image.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_IMAGE_H_
19 | #define GLUS_IMAGE_H_
20 |
21 | /**
22 | * Structure used for Targa Image File loading.
23 | */
24 | typedef struct _GLUStgaimage
25 | {
26 | /**
27 | * Width of the TGA image.
28 | */
29 | GLUSushort width;
30 |
31 | /**
32 | * Height of the TGA image.
33 | */
34 | GLUSushort height;
35 |
36 | /**
37 | * Depth of the image.
38 | */
39 | GLUSushort depth;
40 |
41 | /**
42 | * Pixel data.
43 | */
44 | GLUSubyte* data;
45 |
46 | /**
47 | * Format of the TGA image. Can be:
48 | *
49 | * GLUS_RGB
50 | * GLUS_RGBA
51 | * GLUS_LUMINANCE
52 | *
53 | * Last entry can also be interpreted as GLUS_ALPHA.
54 | */
55 | GLUSenum format;
56 |
57 | } GLUStgaimage;
58 |
59 | /**
60 | * Structure used for HDR Image File loading.
61 | */
62 | typedef struct _GLUShdrimage
63 | {
64 | /**
65 | * Width of the HDR image.
66 | */
67 | GLUSushort width;
68 |
69 | /**
70 | * Height of the HDR image.
71 | */
72 | GLUSushort height;
73 |
74 | /**
75 | * Depth of the image.
76 | */
77 | GLUSushort depth;
78 |
79 | /**
80 | * Pixel data.
81 | */
82 | GLUSfloat* data;
83 |
84 | /**
85 | * Format of the HDR image.
86 | */
87 | GLUSenum format;
88 |
89 | } GLUShdrimage;
90 |
91 | /**
92 | * Structure used for PKM Image File loading.
93 | */
94 | typedef struct _GLUSpkmimage
95 | {
96 | /**
97 | * Width of the PKM image.
98 | */
99 | GLUSushort width;
100 |
101 | /**
102 | * Height of the PKM image.
103 | */
104 | GLUSushort height;
105 |
106 | /**
107 | * Depth of the image.
108 | */
109 | GLUSushort depth;
110 |
111 | /**
112 | * Pixel data.
113 | */
114 | GLUSubyte* data;
115 |
116 | /**
117 | * The image size in bytes.
118 | */
119 | GLUSint imageSize;
120 |
121 | /**
122 | * Internal format of the PKM image.
123 | */
124 | GLUSenum internalformat;
125 |
126 | } GLUSpkmimage;
127 |
128 | #endif /* GLUS_IMAGE_H_ */
129 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_image_hdr.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_IMAGE_HDR_H_
19 | #define GLUS_IMAGE_HDR_H_
20 |
21 | /**
22 | * Creates a HDR image.
23 | *
24 | * @param hdrimage The structure to fill the HDR data.
25 | * @param width Width of the image.
26 | * @param height Height of the image.
27 | * @param depth Depth of the image.
28 | * @param format Format of the image.
29 | *
30 | * @return GLUS_TRUE, if creating succeeded.
31 | */
32 | GLUSAPI GLUSboolean GLUSAPIENTRY glusImageCreateHdr(GLUShdrimage* hdrimage, GLUSint width, GLUSint height, GLUSint depth, GLUSenum format);
33 |
34 | /**
35 | * Loads a HDR file.
36 | *
37 | * @param filename The name of the file to load.
38 | * @param hdrimage The structure to fill the HDR data.
39 | *
40 | * @return GLUS_TRUE, if loading succeeded.
41 | */
42 | GLUSAPI GLUSboolean GLUSAPIENTRY glusImageLoadHdr(const GLUSchar* filename, GLUShdrimage* hdrimage);
43 |
44 | /**
45 | * Saves a HDR file.
46 | *
47 | * @param filename The name of the file to save.
48 | * @param hdrimage The structure with the HDR data.
49 | *
50 | * @return GLUS_TRUE, if saving succeeded.
51 | */
52 | GLUSAPI GLUSboolean GLUSAPIENTRY glusImageSaveHdr(const GLUSchar* filename, const GLUShdrimage* hdrimage);
53 |
54 | /**
55 | * Destroys the content of a HDR structure. Has to be called for freeing the resources.
56 | *
57 | * @param hdrimage The HDR file structure.
58 | */
59 | GLUSAPI GLUSvoid GLUSAPIENTRY glusImageDestroyHdr(GLUShdrimage* hdrimage);
60 |
61 | /**
62 | * Samples a RGB color value from a HDR 2D image.
63 | * Sampling uses a bilinear filter.
64 | *
65 | * @param rgb The resulting, sampled RGB color value.
66 | * @param hdrimage The HDR image structure, containing the 2D texel data.
67 | * @param st Texture coordinate, where to sample the 2D texture.
68 | *
69 | * @return GLUS_TRUE, if sampling succeeded.
70 | */
71 | GLUSAPI GLUSboolean GLUSAPIENTRY glusImageSampleHdr2D(GLUSfloat rgb[3], const GLUShdrimage* hdrimage, const GLUSfloat st[2]);
72 |
73 | #endif /* GLUS_IMAGE_HDR_H_ */
74 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_image_pkm.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_IMAGE_PKM_H_
19 | #define GLUS_IMAGE_PKM_H_
20 |
21 | /**
22 | * Loads a PKM image.
23 | *
24 | * @param filename The name of the file to load.
25 | * @param pkmimage The structure to fill the PKM data.
26 | *
27 | * @return GLUS_TRUE, if loading succeeded.
28 | */
29 | GLUSAPI GLUSboolean GLUSAPIENTRY glusImageLoadPkm(const GLUSchar* filename, GLUSpkmimage* pkmimage);
30 |
31 | /**
32 | * Destroys the content of a PKM structure. Has to be called for freeing the resources.
33 | *
34 | * @param pkmimage The PKM file structure.
35 | */
36 | GLUSAPI GLUSvoid GLUSAPIENTRY glusImageDestroyPkm(GLUSpkmimage* pkmimage);
37 |
38 | #endif /* GLUS_IMAGE_PKM_H_ */
39 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_intersect.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_INTERSECT_H_
19 | #define GLUS_INTERSECT_H_
20 |
21 | /**
22 | * Intersecting ray against sphere.
23 | *
24 | * @param tNear t of near intersection point if number intersections greater than zero.
25 | * @param tFar t of far intersection point if number intersections greater than zero.
26 | * @param insideSphere Set to GLUS_TRUE, if ray starts inside sphere.
27 | * @param rayStart Point, where the ray starts.
28 | * @param rayDirection Ray direction vector. Has to be normalized.
29 | * @param sphereCenter Center of the sphere given as a point.
30 | * @param radius Radius of the sphere.
31 | *
32 | * @return Number of intersection points.
33 | */
34 | GLUSAPI GLUSint GLUSAPIENTRY glusIntersectRaySpheref(GLUSfloat* tNear, GLUSfloat* tFar, GLUSboolean* insideSphere, const GLUSfloat rayStart[4], const GLUSfloat rayDirection[3], const GLUSfloat sphereCenter[4], const GLUSfloat radius);
35 |
36 | #endif /* GLUS_INTERSECT_H_ */
37 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_line_wavefront.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_LINE_WAVEFRONT_H_
19 | #define GLUS_LINE_WAVEFRONT_H_
20 |
21 | /**
22 | * Loads a wavefront object file containing only line information.
23 | *
24 | * @param filename The name of the wavefront file including extension.
25 | * @param line The data is stored into this structure.
26 | *
27 | * @return GLUS_TRUE, if loading succeeded.
28 | */
29 | GLUSAPI GLUSboolean GLUSAPIENTRY glusLineLoadWavefront(const GLUSchar* filename, GLUSline* line);
30 |
31 | #endif /* GLUS_SHAPE_WAVEFRONT_H_ */
32 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_log.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_LOG_H_
19 | #define GLUS_LOG_H_
20 |
21 | /**
22 | * Sets the current log level.
23 | *
24 | * @param verbosity The new log level.
25 | */
26 | GLUSAPI GLUSvoid GLUSAPIENTRY glusLogSetLevel(const GLUSuint verbosity);
27 |
28 | /**
29 | * Gets the current log level.
30 | *
31 | * @return The current log level.
32 | */
33 | GLUSAPI GLUSuint GLUSAPIENTRY glusLogGetLevel();
34 |
35 | /**
36 | * Prints out the given information to the log console.
37 | *
38 | * @param verbosity The used log level.
39 | * @param format String to log plus format information.
40 | * @param ... Parameter list for the format string.
41 | */
42 | GLUSAPI GLUSvoid GLUSAPIENTRY glusLogPrint(GLUSuint verbosity, const char* format, ...);
43 |
44 | /**
45 | * Executes glGetError() and prints out the error code plus the given information to the log console.
46 | *
47 | * @param verbosity The used log level.
48 | * @param format String to log plus format information.
49 | * @param ... Parameter list for the format string.
50 | */
51 | GLUSAPI GLUSvoid GLUSAPIENTRY glusLogPrintError(GLUSuint verbosity, const char* format, ...);
52 |
53 | #endif /* GLUS_LOG_H_ */
54 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_math.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_MATH_H_
19 | #define GLUS_MATH_H_
20 |
21 | /**
22 | * Calculates the maximum of two values.
23 | *
24 | * @param value0 The first value.
25 | * @param value1 The second value.
26 | *
27 | * @return The maximum of the two values.
28 | */
29 | GLUSAPI GLUSfloat GLUSAPIENTRY glusMathMaxf(const GLUSfloat value0, const GLUSfloat value1);
30 |
31 | /**
32 | * Calculates the minimum of two values.
33 | *
34 | * @param value0 The first value.
35 | * @param value1 The second value.
36 | *
37 | * @return The minimum of the two values.
38 | */
39 | GLUSAPI GLUSfloat GLUSAPIENTRY glusMathMinf(const GLUSfloat value0, const GLUSfloat value1);
40 |
41 | /**
42 | * Converts radians to degrees.
43 | *
44 | * @param radians The angle in radians.
45 | *
46 | * @return The angle in degrees.
47 | */
48 | GLUSAPI GLUSfloat GLUSAPIENTRY glusMathRadToDegf(const GLUSfloat radians);
49 |
50 | /**
51 | * Converts degrees to radians.
52 | *
53 | * @param degrees The angle in degrees.
54 | *
55 | * @return The angle in radians.
56 | */
57 | GLUSAPI GLUSfloat GLUSAPIENTRY glusMathDegToRadf(const GLUSfloat degrees);
58 |
59 | /**
60 | * Linear interpolation of two values. If t = 0, value0 is returned. If t = 1, value1 is returned.
61 | *
62 | * @param value0 First value.
63 | * @param value1 Second value.
64 | * @param t The fraction.
65 | *
66 | * @return The interpolated value.
67 | */
68 | GLUSAPI GLUSfloat GLUSAPIENTRY glusMathMixf(const GLUSfloat value0, const GLUSfloat value1, const GLUSfloat t);
69 |
70 | /**
71 | * Clamps a given value between a minimum and maximum value. If the value is between min and max, the value is returned.
72 | *
73 | * @param value The value to be clamped.
74 | * @param min The minimum border. If the value is lower than min, min is returned.
75 | * @param max The maximum border. If the value is greater than max, max is returned.
76 | *
77 | * @return The clamped value.
78 | */
79 | GLUSAPI GLUSfloat GLUSAPIENTRY glusMathClampf(const GLUSfloat value, const GLUSfloat min, const GLUSfloat max);
80 |
81 | /**
82 | * Calculates the length of a vector or the distance of a point to the origin by providing the x, y and z coordinates.
83 | *
84 | * @param x The x coordinate.
85 | * @param y The y coordinate.
86 | * @param z The z coordinate.
87 | *
88 | * @return The calculated length.
89 | */
90 | GLUSAPI GLUSfloat GLUSAPIENTRY glusMathLengthf(const GLUSfloat x, const GLUSfloat y, const GLUSfloat z);
91 |
92 | #endif /* GLUS_MATH_H_ */
93 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_matrix_planar.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_MATRIX_PLANAR_H_
19 | #define GLUS_MATRIX_PLANAR_H_
20 |
21 | /**
22 | * Creates the projection matrix to simulate a planar shadow coming from a point / spot light.
23 | *
24 | * @param matrix The matrix, which is set to the projection matrix.
25 | * @param shadowPlane The shadow receiver plane.
26 | * @param lightPoint The origin of the light.
27 | */
28 | GLUSAPI GLUSvoid GLUSAPIENTRY glusMatrix4x4PlanarShadowPointLightf(GLUSfloat matrix[16], const GLUSfloat shadowPlane[4], const GLUSfloat lightPoint[4]);
29 |
30 | /**
31 | * Creates the projection matrix to simulate a planar shadow coming from a directional light.
32 | *
33 | * @param matrix The matrix, which is set to the projection matrix.
34 | * @param shadowPlane The shadow receiver plane.
35 | * @param lightDirection The direction of the light, pointing towards the light source.
36 | */
37 | GLUSAPI GLUSvoid GLUSAPIENTRY glusMatrix4x4PlanarShadowDirectionalLightf(GLUSfloat matrix[16], const GLUSfloat shadowPlane[4], const GLUSfloat lightDirection[3]);
38 |
39 | /**
40 | * Creates the projection matrix to simulate a planar reflection.
41 | *
42 | * @param matrix The matrix, which is set to the projection matrix.
43 | * @param reflectionPlane The reflecting plane.
44 | */
45 | GLUSAPI GLUSvoid GLUSAPIENTRY glusMatrix4x4PlanarReflectionf(GLUSfloat matrix[16], const GLUSfloat reflectionPlane[4]);
46 |
47 | #endif /* GLUS_MATRIX_PLANAR_H_ */
48 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_matrix_viewprojection.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_MATRIX_VIEWPROJECTION_H_
19 | #define GLUS_MATRIX_VIEWPROJECTION_H_
20 |
21 | /**
22 | * Creates a matrix with orthogonal projection.
23 | * @see http://en.wikipedia.org/wiki/Orthographic_projection_%28geometry%29
24 | *
25 | * @param result The resulting matrix.
26 | * @param left Left corner.
27 | * @param right Right corner.
28 | * @param bottom Bottom corner.
29 | * @param top Top corner.
30 | * @param nearVal Near corner.
31 | * @param farVal Far corner.
32 | *
33 | * @return GLUS_TRUE, if creation was successful.
34 | */
35 | GLUSAPI GLUSboolean GLUSAPIENTRY glusMatrix4x4Orthof(GLUSfloat result[16], const GLUSfloat left, const GLUSfloat right, const GLUSfloat bottom, const GLUSfloat top, const GLUSfloat nearVal, const GLUSfloat farVal);
36 |
37 | /**
38 | * Creates a matrix with perspective projection.
39 | *
40 | * @param result The resulting matrix.
41 | * @param left Left corner.
42 | * @param right Right corner.
43 | * @param bottom Bottom corner.
44 | * @param top Top corner.
45 | * @param nearVal Near corner.
46 | * @param farVal Far corner.
47 | *
48 | * @return GLUS_TRUE, if creation was successful.
49 | */
50 | GLUSAPI GLUSboolean GLUSAPIENTRY glusMatrix4x4Frustumf(GLUSfloat result[16], const GLUSfloat left, const GLUSfloat right, const GLUSfloat bottom, const GLUSfloat top, const GLUSfloat nearVal, const GLUSfloat farVal);
51 |
52 | /**
53 | * Creates a matrix with perspective projection.
54 | *
55 | * @param result The resulting matrix.
56 | * @param fovy Field of view.
57 | * @param aspect Aspect ratio.
58 | * @param zNear Near plane.
59 | * @param zFar Far plane.
60 | *
61 | * @return GLUS_TRUE, if creation was successful.
62 | */
63 | GLUSAPI GLUSboolean GLUSAPIENTRY glusMatrix4x4Perspectivef(GLUSfloat result[16], const GLUSfloat fovy, const GLUSfloat aspect, const GLUSfloat zNear, const GLUSfloat zFar);
64 |
65 | /**
66 | * Creates a view / camera matrix.
67 | *
68 | * @param result The resulting matrix.
69 | * @param eyeX Eye / camera X position.
70 | * @param eyeY Eye / camera Y position.
71 | * @param eyeZ Eye / camera Z position.
72 | * @param centerX X Position, where the view / camera points to.
73 | * @param centerY Y Position, where the view / camera points to.
74 | * @param centerZ Z Position, where the view / camera points to.
75 | * @param upX Eye / camera X component from up vector.
76 | * @param upY Eye / camera Y component from up vector.
77 | * @param upZ Eye / camera Z component from up vector.
78 | */
79 | GLUSAPI GLUSvoid GLUSAPIENTRY glusMatrix4x4LookAtf(GLUSfloat result[16], const GLUSfloat eyeX, const GLUSfloat eyeY, const GLUSfloat eyeZ, const GLUSfloat centerX, const GLUSfloat centerY, const GLUSfloat centerZ, const GLUSfloat upX, const GLUSfloat upY, const GLUSfloat upZ);
80 |
81 | #endif /* GLUS_MATRIX_VIEWPROJECTION_H_ */
82 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_memory.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_MEMORY_H_
19 | #define GLUS_MEMORY_H_
20 |
21 | /**
22 | * Allocate memory block.
23 | *
24 | * @param size Size of the memory block in bytes.
25 | *
26 | * @return Returns on success the pointer to allocated memory. Otherwise null is returned.
27 | */
28 | GLUSAPI void* GLUSAPIENTRY glusMemoryMalloc(size_t size);
29 |
30 | /**
31 | * Deallocate memory block.
32 | *
33 | * @param pointer Pointer to a memory block previously allocated with glusMalloc.
34 | */
35 | GLUSAPI void GLUSAPIENTRY glusMemoryFree(void* pointer);
36 |
37 | #endif /* GLUS_MEMORY_H_ */
38 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_orientedbox.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_ORIENTED_BOX_H_
19 | #define GLUS_ORIENTED_BOX_H_
20 |
21 | /**
22 | * Copies an oriented box.
23 | *
24 | * @param resultCenter Destination center.
25 | * @param resultHalfExtend Destination half extend.
26 | * @param resultOrientation Destination orientation.
27 | * @param center Source center.
28 | * @param halfExtend Source half extend.
29 | * @param orientation Source orientation.
30 | */
31 | GLUSvoid GLUSAPIENTRY glusOrientedBoxCopyf(GLUSfloat resultCenter[4], GLUSfloat resultHalfExtend[3], GLUSfloat resultOrientation[3], const GLUSfloat center[4], const GLUSfloat halfExtend[3], const GLUSfloat orientation[3]);
32 |
33 | /**
34 | * Calculates the signed distance from an oriented box to a point. If the value is negative, the point is inside the box.
35 | *
36 | * @param center The center of the box.
37 | * @param halfExtend The length from the center point to the planes of the box.
38 | * @param orientation The orientation of the box.
39 | * @param point The used point.
40 | *
41 | * @return The signed distance.
42 | */
43 | GLUSfloat GLUSAPIENTRY glusOrientedBoxDistancePoint4f(const GLUSfloat center[4], const GLUSfloat halfExtend[3], const GLUSfloat orientation[3], const GLUSfloat point[4]);
44 |
45 | #endif /* GLUS_ORIENTED_BOX_H_ */
46 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_padding.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_PADDING_H_
19 | #define GLUS_PADDING_H_
20 |
21 | /**
22 | * Converts the padding of an array of vectors.
23 | *
24 | * @param target Target array.
25 | * @param source Source array.
26 | * @param channels Number of channels. Values equal greater 1 are allowed.
27 | * @param padding Number of padding elements. Values equal greater 0 are allowed.
28 | * @param numberElements Number of elements in the array.
29 | *
30 | * @return GLUS_TRUE, if succeeded.
31 | */
32 | GLUSAPI GLUSboolean GLUSAPIENTRY glusPaddingConvertf(GLUSfloat* target, const GLUSfloat* source, const GLUSint channels, const GLUSint padding, const GLUSint numberElements);
33 |
34 | #endif /* GLUS_PADDING_H_ */
35 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_perlin.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_PERLIN_H_
19 | #define GLUS_PERLIN_H_
20 |
21 | /**
22 | * Creates a 1D perlin noise texture. See OpenGL Programming Guide 4.3, p.460ff
23 | *
24 | * @param image The perlin noise texture will be stored into this image.
25 | * @param width Width of the texture.
26 | * @param seed Random seed number.
27 | * @param frequency Frequency of the noise.
28 | * @param amplitude Amplitude of the noise.
29 | * @param persistence Persistence of the noise.
30 | * @param octaves Octaves of the noise.
31 | *
32 | * @return GLUS_TRUE, if creation succeeded.
33 | */
34 | GLUSAPI GLUSboolean GLUSAPIENTRY glusPerlinCreateNoise1D(GLUStgaimage* image, const GLUSint width, const GLUSint seed, const GLUSfloat frequency, const GLUSfloat amplitude, const GLUSfloat persistence, const GLUSint octaves);
35 |
36 | /**
37 | * Creates a 2D perlin noise texture. See OpenGL Programming Guide 4.3, p.460ff
38 | *
39 | * @param image The perlin noise texture will be stored into this image.
40 | * @param width Width of the texture.
41 | * @param height Height of the texture
42 | * @param seed Random seed number.
43 | * @param frequency Frequency of the noise.
44 | * @param amplitude Amplitude of the noise.
45 | * @param persistence Persistence of the noise.
46 | * @param octaves Octaves of the noise.
47 | *
48 | * @return GLUS_TRUE, if creation succeeded.
49 | */
50 | GLUSAPI GLUSboolean GLUSAPIENTRY glusPerlinCreateNoise2D(GLUStgaimage* image, const GLUSint width, const GLUSint height, const GLUSint seed, const GLUSfloat frequency, const GLUSfloat amplitude, const GLUSfloat persistence, const GLUSint octaves);
51 |
52 | /**
53 | * Creates a 3D perlin noise texture. See OpenGL Programming Guide 4.3, p.460ff
54 | *
55 | * @param image The perlin noise texture will be stored into this image.
56 | * @param width Width of the texture.
57 | * @param height Height of the texture
58 | * @param depth Depth of the texture
59 | * @param seed Random seed number.
60 | * @param frequency Frequency of the noise.
61 | * @param amplitude Amplitude of the noise.
62 | * @param persistence Persistence of the noise.
63 | * @param octaves Octaves of the noise.
64 | *
65 | * @return GLUS_TRUE, if creation succeeded.
66 | */
67 | GLUSAPI GLUSboolean GLUSAPIENTRY glusPerlinCreateNoise3D(GLUStgaimage* image, const GLUSint width, const GLUSint height, const GLUSint depth, const GLUSint seed, const GLUSfloat frequency, const GLUSfloat amplitude, const GLUSfloat persistence, const GLUSint octaves);
68 |
69 | #endif /* GLUS_PERLIN_H_ */
70 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_plane.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_PLANE_H_
19 | #define GLUS_PLANE_H_
20 |
21 | /**
22 | * Copies a plane.
23 | *
24 | * @param result Destination plane.
25 | * @param plane Source plane.
26 | */
27 | GLUSAPI GLUSvoid GLUSAPIENTRY glusPlaneCopyf(GLUSfloat result[4], const GLUSfloat plane[4]);
28 |
29 | /**
30 | * Creates a plane. The formula is Ax + By + Cz + D = 0, where A,B,C and D are stored in the resulting array.
31 | * @see Mathematics For 3D Game Programming & Computer Graphics, Second Edition, Page105
32 | *
33 | * @param result The calculated plane.
34 | * @param point Any point on the plane.
35 | * @param normal The normal vector of the plane. The vector will be normalized during calculation.
36 | */
37 | GLUSAPI GLUSvoid GLUSAPIENTRY glusPlaneCreatef(GLUSfloat result[4], const GLUSfloat point[4], const GLUSfloat normal[3]);
38 |
39 | /**
40 | * Calculates the signed distance from a plane to a point. If the value is positive, the point is on the side the normal is directing to.
41 | *
42 | * @param plane The used plane.
43 | * @param point The used point.
44 | *
45 | * @return The signed distance.
46 | */
47 | GLUSAPI GLUSfloat GLUSAPIENTRY glusPlaneDistancePoint4f(const GLUSfloat plane[4], const GLUSfloat point[4]);
48 |
49 | /**
50 | * Calculates a point on the given plane, located around the origin.
51 | *
52 | * @param point The resulting point.
53 | * @param plane The used plane.
54 | */
55 | GLUSAPI GLUSvoid GLUSAPIENTRY glusPlaneGetPoint4f(GLUSfloat point[4], const GLUSfloat plane[4]);
56 |
57 | #endif /* GLUS_PLANE_H_ */
58 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_profile.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_PROFILE_H_
19 | #define GLUS_PROFILE_H_
20 |
21 | /**
22 | * Reset FPS profiling.
23 | */
24 | GLUSAPI GLUSvoid GLUSAPIENTRY glusProfileResetFPSf();
25 |
26 | /**
27 | * Update FPS profiling and log FPS.
28 | *
29 | * @param time Passed time per frame.
30 | * @param frames Stores passed frames. If this is a null pointer, the output is logged.
31 | *
32 | * @return GLUS_TRUE, if one second passed.
33 | */
34 | GLUSAPI GLUSboolean GLUSAPIENTRY glusProfileUpdateFPSf(GLUSfloat time, GLUSuint* frames);
35 |
36 | #endif /* GLUS_PROFILE_H_ */
37 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_program_es.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_SHADERPROGRAM_ES_H_
19 | #define GLUS_SHADERPROGRAM_ES_H_
20 |
21 | /**
22 | * Structure for shader program handling.
23 | */
24 | typedef struct _GLUSprogram
25 | {
26 | /**
27 | * The created program.
28 | */
29 | GLUSuint program;
30 |
31 | /**
32 | * Vertex shader.
33 | */
34 | GLUSuint vertex;
35 |
36 | /**
37 | * Fragment shader.
38 | */
39 | GLUSuint fragment;
40 |
41 | } GLUSprogram;
42 |
43 | /**
44 | * Creates a program by compiling the giving sources. Linking has to be done in a separate step.
45 | *
46 | * @param shaderProgram This structure holds the necessary information of the program and the different shaders.
47 | * @param vertexSource Vertex shader source code.
48 | * @param fragmentSource Fragment shader source code.
49 | *
50 | * @return GLUS_TRUE, if compiling and creation of program succeeded.
51 | */
52 | GLUSAPI GLUSboolean GLUSAPIENTRY glusProgramCreateFromSource(GLUSprogram* shaderProgram, const GLUSchar** vertexSource, const GLUSchar** fragmentSource);
53 |
54 | /**
55 | * Links a formerly created program.
56 | *
57 | * @param shaderProgram This structure holds the necessary information of the program and the different shaders.
58 | *
59 | * @return GLUS_TRUE, if linking of program succeeded.
60 | */
61 | GLUSAPI GLUSboolean GLUSAPIENTRY glusProgramLink(GLUSprogram* shaderProgram);
62 |
63 | /**
64 | * Builds a program by compiling and linking the giving sources.
65 | *
66 | * @param shaderProgram This structure holds the necessary information of the program and the different shaders.
67 | * @param vertexSource Vertex shader source code.
68 | * @param fragmentSource Fragment shader source code.
69 | *
70 | * @return GLUS_TRUE, if compiling and linking of program succeeded.
71 | */
72 | GLUSAPI GLUSboolean GLUSAPIENTRY glusProgramBuildFromSource(GLUSprogram* shaderProgram, const GLUSchar** vertexSource, const GLUSchar** fragmentSource);
73 |
74 | /**
75 | * Destroys a program by freeing all resources.
76 | *
77 | * @param shaderprogram This structure holds the necessary information of the program and the different shaders.
78 | */
79 | GLUSAPI GLUSvoid GLUSAPIENTRY glusProgramDestroy(GLUSprogram* shaderprogram);
80 |
81 | #endif /* GLUS_SHADERPROGRAM_ES_H_ */
82 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_programpipeline.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_PROGRAMPIPELINE_H_
19 | #define GLUS_PROGRAMPIPELINE_H_
20 |
21 | /**
22 | * Structure for program pipeline handling.
23 | */
24 | typedef struct _GLUSprogrampipeline
25 | {
26 | /**
27 | * The created pipeline.
28 | */
29 | GLUSuint pipeline;
30 |
31 | /**
32 | * Compute shader program.
33 | */
34 | GLUSuint computeProgram;
35 |
36 | /**
37 | * Vertex shader program.
38 | */
39 | GLUSuint vertexProgram;
40 |
41 | /**
42 | * Tessellation control shader program.
43 | */
44 | GLUSuint controlProgram;
45 |
46 | /**
47 | * Tessellation evaluation shader program.
48 | */
49 | GLUSuint evaluationProgram;
50 |
51 | /**
52 | * Geometry shader program.
53 | */
54 | GLUSuint geometryProgram;
55 |
56 | /**
57 | * Fragment shader program.
58 | */
59 | GLUSuint fragmentProgram;
60 |
61 | } GLUSprogrampipeline;
62 |
63 | /**
64 | * Builds a program pipeline.
65 | *
66 | * @param programPipeline This structure holds the necessary information of the program pipeline and the different shader programs.
67 | * @param vertexProgram Vertex shader program.
68 | * @param controlProgram Tessellation control shader program.
69 | * @param evaluationProgram Tessellation evaluation shader program.
70 | * @param geometryProgram Geometry shader program.
71 | * @param fragmentProgram Fragment shader program.
72 | *
73 | * @return GLUS_TRUE, if building of program pipeline succeeded.
74 | */
75 | GLUSAPI GLUSboolean GLUSAPIENTRY glusProgramPipelineBuild(GLUSprogrampipeline* programPipeline, GLUSuint vertexProgram, GLUSuint controlProgram, GLUSuint evaluationProgram, GLUSuint geometryProgram, GLUSuint fragmentProgram);
76 |
77 | /**
78 | * Builds a compute shader program pipeline.
79 | *
80 | * @param programPipeline This structure holds the necessary information of the program pipeline and the different shader programs.
81 | * @param computeProgram Compute shader program.
82 | *
83 | * @return GLUS_TRUE, if building of program pipeline succeeded.
84 | */
85 | GLUSAPI GLUSboolean GLUSAPIENTRY glusProgramPipelineBuildCompute(GLUSprogrampipeline* programPipeline, GLUSuint computeProgram);
86 |
87 | /**
88 | * Destroys a program pipeline by freeing the pipeline. The programs are not freed.
89 | *
90 | * @param programPipeline This structure holds the necessary information of the program pipeline and the different shader programs.
91 | */
92 | GLUSAPI GLUSvoid GLUSAPIENTRY glusProgramPipelineDestroy(GLUSprogrampipeline* programPipeline);
93 |
94 | #endif /* GLUS_PROGRAMPIPELINE_H_ */
95 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_programpipeline_es31.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_PROGRAMPIPELINE_ES31_H_
19 | #define GLUS_PROGRAMPIPELINE_ES31_H_
20 |
21 | /**
22 | * Structure for program pipeline handling.
23 | */
24 | typedef struct _GLUSprogrampipeline
25 | {
26 | /**
27 | * The created pipeline.
28 | */
29 | GLUSuint pipeline;
30 |
31 | /**
32 | * Compute shader program.
33 | */
34 | GLUSuint computeProgram;
35 |
36 | /**
37 | * Vertex shader program.
38 | */
39 | GLUSuint vertexProgram;
40 |
41 | /**
42 | * Fragment shader program.
43 | */
44 | GLUSuint fragmentProgram;
45 |
46 | } GLUSprogrampipeline;
47 |
48 | /**
49 | * Builds a program pipeline.
50 | *
51 | * @param programPipeline This structure holds the necessary information of the program pipeline and the different shader programs.
52 | * @param vertexProgram Vertex shader program.
53 | * @param fragmentProgram Fragment shader program.
54 | *
55 | * @return GLUS_TRUE, if building of program pipeline succeeded.
56 | */
57 | GLUSAPI GLUSboolean GLUSAPIENTRY glusProgramPipelineBuild(GLUSprogrampipeline* programPipeline, GLUSuint vertexProgram, GLUSuint fragmentProgram);
58 |
59 | /**
60 | * Builds a compute shader program pipeline.
61 | *
62 | * @param programPipeline This structure holds the necessary information of the program pipeline and the different shader programs.
63 | * @param computeProgram Compute shader program.
64 | *
65 | * @return GLUS_TRUE, if building of program pipeline succeeded.
66 | */
67 | GLUSAPI GLUSboolean GLUSAPIENTRY glusProgramPipelineBuildCompute(GLUSprogrampipeline* programPipeline, GLUSuint computeProgram);
68 |
69 | /**
70 | * Destroys a program pipeline by freeing the pipeline. The programs are not freed.
71 | *
72 | * @param programPipeline This structure holds the necessary information of the program pipeline and the different shader programs.
73 | */
74 | GLUSAPI GLUSvoid GLUSAPIENTRY glusProgramPipelineDestroy(GLUSprogrampipeline* programPipeline);
75 |
76 | #endif /* GLUS_PROGRAMPIPELINE_ES31_H_ */
77 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_random.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_RANDOM_H_
19 | #define GLUS_RANDOM_H_
20 |
21 | /**
22 | * Initializes the random generator.
23 | *
24 | * @param seed Number for initializing the pseudo-random number generator.
25 | */
26 | GLUSAPI GLUSvoid GLUSAPIENTRY glusRandomSetSeed(const GLUSuint seed);
27 |
28 | /**
29 | * Returns a uniform distributed random floating point value in the given range.
30 | *
31 | * @param start Smallest possible generated value (inclusive).
32 | * @param end Largest possible generated value (inclusive).
33 | *
34 | * @return The random value.
35 | */
36 | GLUSAPI GLUSfloat GLUSAPIENTRY glusRandomUniformf(const GLUSfloat start, const GLUSfloat end);
37 |
38 | /**
39 | * Returns a normal distributed random floating point value.
40 | *
41 | * @param mean Mean.
42 | * @param standardDeviation Standard deviation.
43 | *
44 | * @return The random value.
45 | */
46 | GLUSAPI GLUSfloat GLUSAPIENTRY glusRandomNormalf(const GLUSfloat mean, const GLUSfloat standardDeviation);
47 |
48 | /**
49 | * Samples two floating point values from a Hammersley point set.
50 | *
51 | * @param result The resulting random values.
52 | * @param sample The sample to take. Has to be in the range 0 <= sample < 2^m.
53 | * @param m Order m, which allows 2^m samples. Has to be in the range 0 < m <= 32.
54 | *
55 | * @return GLUS_TRUE, if sampling was successful.
56 | **/
57 | GLUSAPI GLUSboolean GLUSAPIENTRY glusRandomHammersleyf(GLUSfloat result[2], const GLUSuint sample, const GLUSubyte m);
58 |
59 | #endif /* GLUS_RANDOM_H_ */
60 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_raytrace.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_RAYTRACE_H_
19 | #define GLUS_RAYTRACE_H_
20 |
21 | /**
22 | * Creates normals in a buffer for ray traced perspective projection. Directions are pointing to -Z direction.
23 | *
24 | * @param directionBuffer The resulting direction buffer.
25 | * @param padding Amount of padding bytes.
26 | * @param fovy Field of view.
27 | * @param width Width of the buffer.
28 | * @param height Height of the buffer.
29 | *
30 | * @return GLUS_TRUE, if creation was successful.
31 | */
32 | GLUSAPI GLUSboolean GLUSAPIENTRY glusRaytracePerspectivef(GLUSfloat* directionBuffer, const GLUSubyte padding, const GLUSfloat fovy, const GLUSint width, const GLUSint height);
33 |
34 | /**
35 | * Creates the positions and directions in buffers needed for ray tracing.
36 | *
37 | * @param positionBuffer The resulting position buffer. Positions are in homogeneous coordinates.
38 | * @param directionBuffer The resulting direction buffer.
39 | * @param originDirectionBuffer The direction buffer, pointing to -Z direction.
40 | * @param padding Amount of padding bytes.
41 | * @param width The width of the buffers.
42 | * @param height The height of the buffers.
43 | * @param eyeX Eye / camera X position.
44 | * @param eyeY Eye / camera Y position.
45 | * @param eyeZ Eye / camera Z position.
46 | * @param centerX X Position, where the view / camera points to.
47 | * @param centerY Y Position, where the view / camera points to.
48 | * @param centerZ Z Position, where the view / camera points to.
49 | * @param upX Eye / camera X component from up vector.
50 | * @param upY Eye / camera Y component from up vector.
51 | * @param upZ Eye / camera Z component from up vector.
52 | */
53 | GLUSAPI GLUSvoid GLUSAPIENTRY glusRaytraceLookAtf(GLUSfloat* positionBuffer, GLUSfloat* directionBuffer, const GLUSfloat* originDirectionBuffer, const GLUSubyte padding, const GLUSint width, const GLUSint height, const GLUSfloat eyeX, const GLUSfloat eyeY, const GLUSfloat eyeZ, const GLUSfloat centerX, const GLUSfloat centerY, const GLUSfloat centerZ, const GLUSfloat upX, const GLUSfloat upY, const GLUSfloat upZ);
54 |
55 | #endif /* GLUS_RAYTRACE_H_ */
56 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_screenshot.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_SCREENSHOT_H_
19 | #define GLUS_SCREENSHOT_H_
20 |
21 | /**
22 | * Creates a screenshot of the current back buffer and uses the given image and its dimension.
23 | *
24 | * @param x The lower left x coordinate from the screenshot rectangle.
25 | * @param y The lower left y coordinate from the screenshot rectangle.
26 | * @param screenshot The image structure to store the pixel data.
27 | */
28 | GLUSAPI GLUSboolean GLUSAPIENTRY glusScreenshotUseTga(GLUSint x, GLUSint y, const GLUStgaimage* screenshot);
29 |
30 | /**
31 | * Creates a screenshot of the current back buffer and creates the image automatically.
32 | *
33 | * @param x The lower left x coordinate from the screenshot rectangle.
34 | * @param y The lower left y coordinate from the screenshot rectangle.
35 | * @param width The width of the screenshot rectangle.
36 | * @param height The height of the screenshot rectangle.
37 | * @param screenshot The image structure to store the pixel data.
38 | */
39 | GLUSAPI GLUSboolean GLUSAPIENTRY glusScreenshotCreateTga(GLUSint x, GLUSint y, GLUSsizei width, GLUSsizei height, GLUStgaimage* screenshot);
40 |
41 | #endif /* GLUS_SCREENSHOT_H_ */
42 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_shape_adjacency.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_SHAPE_ADJACENCY_H_
19 | #define GLUS_SHAPE_ADJACENCY_H_
20 |
21 | /**
22 | * Creates a shape with adjacent index data for a triangle. Can be used in the geometry shader.
23 | *
24 | * @param adjacencyShape The shape with additional adjacent index data.
25 | * @param sourceShape The source shape.
26 | *
27 | * @return GLUS_TRUE, if creation succeeded.
28 | */
29 | GLUSAPI GLUSboolean GLUSAPIENTRY glusShapeCreateAdjacencyIndicesf(GLUSshape* adjacencyShape, const GLUSshape* sourceShape);
30 |
31 | #endif /* GLUS_SHAPE_ADJACENCY_H_ */
32 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_shape_texgen.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_SHAPE_TEXGEN_H_
19 | #define GLUS_SHAPE_TEXGEN_H_
20 |
21 | /**
22 | * Creates the texture coordinates of a shape. Already existing texture coordinates are deleted.
23 | *
24 | * @param shape The shape, where the texture coordinates are created.
25 | * @param sSizeX Size of the s texture coordinate, considering x axis.
26 | * @param sSizeZ Size of the s texture coordinate, considering z axis.
27 | * @param tSizeY Size of the t texture coordinate, considering y axis.
28 | * @param tSizeZ Size of the t texture coordinate, considering z axis.
29 | * @param sOffset Offset in the s texture coordinate direction.
30 | * @param tOffset Offset in the t texture coordinate direction.
31 | *
32 | * @return GLUS_TURE. if creation succeeded.
33 | */
34 | GLUSAPI GLUSboolean GLUSAPIENTRY glusShapeTexGenByAxesf(GLUSshape* shape, const GLUSfloat sSizeX, const GLUSfloat sSizeZ, const GLUSfloat tSizeY, const GLUSfloat tSizeZ, const GLUSfloat sOffset, const GLUSfloat tOffset);
35 |
36 | /**
37 | * Creates the texture coordinates of a shape. Already existing texture coordinates are deleted.
38 | *
39 | * @param shape The shape, where the texture coordinates are created.
40 | * @param sPlane The plane for calculating the s coordinate.
41 | * @param tPlane The plane for calculating the t coordinate.
42 | * @param sSize The size in s direction.
43 | * @param tSize The size in t direction.
44 | * @param sOffset The offset in s direction.
45 | * @param tOffset The offset in t direction.
46 | *
47 | * @return GLUS_TURE. if creation succeeded.
48 | */
49 | GLUSAPI GLUSboolean GLUSAPIENTRY glusShapeTexGenByPlanesf(GLUSshape* shape, const GLUSfloat sPlane[4], const GLUSfloat tPlane[4], const float sSize, const float tSize, const float sOffset, const float tOffset);
50 |
51 | #endif /* GLUS_SHAPE_TEXGEN_H_ */
52 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_shape_wavefront.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_SHAPE_WAVEFRONT_H_
19 | #define GLUS_SHAPE_WAVEFRONT_H_
20 |
21 | /**
22 | * Loads a wavefront object file.
23 | *
24 | * @param filename The name of the wavefront file including extension.
25 | * @param shape The data is stored into this structure.
26 | *
27 | * @return GLUS_TRUE, if loading succeeded.
28 | */
29 | GLUSAPI GLUSboolean GLUSAPIENTRY glusShapeLoadWavefront(const GLUSchar* filename, GLUSshape* shape);
30 |
31 | #endif /* GLUS_SHAPE_WAVEFRONT_H_ */
32 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_sphere.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_SPHERE_H_
19 | #define GLUS_SPHERE_H_
20 |
21 | /**
22 | * Copies a sphere.
23 | *
24 | * @param resultCenter Destination center.
25 | * @param resultRadius Destination radius.
26 | * @param center Source center.
27 | * @param radius Source radius.
28 | */
29 | GLUSAPI GLUSvoid GLUSAPIENTRY glusSphereCopyf(GLUSfloat resultCenter[4], GLUSfloat resultRadius, const GLUSfloat center[4], const GLUSfloat radius);
30 |
31 | /**
32 | * Calculates the signed distance from a sphere to a point. If the value is negative, the point is inside the sphere.
33 | *
34 | * @param center The center of the sphere.
35 | * @param radius The radius of the sphere.
36 | * @param point The used point.
37 | *
38 | * @return The signed distance.
39 | */
40 | GLUSAPI GLUSfloat GLUSAPIENTRY glusSphereDistancePoint4f(const GLUSfloat center[4], const GLUSfloat radius, const GLUSfloat point[4]);
41 |
42 | #endif /* GLUS_SPHERE_H_ */
43 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_time.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_TIME_H_
19 | #define GLUS_TIME_H_
20 |
21 | /**
22 | * Return the current time stamp in seconds.
23 | *
24 | * Returning values after application start are implementation dependent,
25 | * but the difference of two calls produce the same result.
26 | *
27 | * @return The current time stamp in seconds.
28 | */
29 | GLUSAPI GLUSfloat GLUSAPIENTRY glusTimeGetTimestampf();
30 |
31 |
32 | #endif /* GLUS_TIME_H_ */
33 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_typedef.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_TYPEDEF_H_
19 | #define GLUS_TYPEDEF_H_
20 |
21 | typedef unsigned char GLUSboolean;
22 | typedef signed char GLUSbyte;
23 | typedef unsigned char GLUSubyte;
24 | typedef char GLUSchar;
25 | typedef short GLUSshort;
26 | typedef unsigned short GLUSushort;
27 | typedef int GLUSint;
28 | typedef unsigned int GLUSuint;
29 | typedef int GLUSfixed;
30 | typedef int64_t GLUSint64;
31 | typedef uint64_t GLUSuint64;
32 | typedef int GLUSsizei;
33 | typedef unsigned int GLUSenum;
34 | // GLUSintptr, GLUSsizeiptr and GLUSsync not implemented.
35 | typedef unsigned int GLUSbitfield;
36 | typedef unsigned short GLUShalf;
37 | typedef float GLUSfloat;
38 | typedef float GLUSclampf;
39 | typedef double GLUSdouble;
40 | typedef double GLUSclampd;
41 |
42 | typedef struct _GLUScomplex
43 | {
44 | GLUSfloat real;
45 | GLUSfloat imaginary;
46 | } GLUScomplex;
47 |
48 | #ifdef __cplusplus
49 | #define GLUSvoid void
50 | #else
51 | typedef void GLUSvoid;
52 | #endif
53 |
54 | #endif /* GLUS_TYPEDEF_H_ */
55 |
--------------------------------------------------------------------------------
/GLUS/src/GLUS/glus_version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #ifndef GLUS_VERSION_H_
19 | #define GLUS_VERSION_H_
20 |
21 | /**
22 | * Checks, if the given OpenGL version is supported. The function reads out and parses the version string.
23 | *
24 | * @return GLUS_TRUE, if the given version is supported.
25 | */
26 | GLUSAPI GLUSboolean GLUSAPIENTRY glusVersionIsSupported(const GLUSint major, const GLUSint minor);
27 |
28 | #endif /* GLUS_VERSION_H_ */
29 |
--------------------------------------------------------------------------------
/GLUS/src/glus_axisalignedbox.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSvoid GLUSAPIENTRY glusAxisAlignedBoxCopyf(GLUSfloat resultCenter[4], GLUSfloat resultHalfExtend[3], const GLUSfloat center[4], const GLUSfloat halfExtend[3])
21 | {
22 | resultCenter[0] = center[0];
23 | resultCenter[1] = center[1];
24 | resultCenter[2] = center[2];
25 | resultCenter[3] = center[3];
26 |
27 | resultHalfExtend[0] = halfExtend[0];
28 | resultHalfExtend[1] = halfExtend[1];
29 | resultHalfExtend[2] = halfExtend[2];
30 | }
31 |
32 | GLUSfloat GLUSAPIENTRY glusAxisAlignedBoxDistancePoint4f(const GLUSfloat center[4], const GLUSfloat halfExtend[3], const GLUSfloat point[4])
33 | {
34 | GLUSfloat vector[3];
35 |
36 | GLUSfloat insideDistance;
37 | GLUSfloat outsideDistance;
38 |
39 | glusPoint4SubtractPoint4f(vector, point, center);
40 |
41 | vector[0] = fabsf(vector[0]) - halfExtend[0];
42 | vector[1] = fabsf(vector[1]) - halfExtend[1];
43 | vector[2] = fabsf(vector[2]) - halfExtend[2];
44 |
45 | insideDistance = glusMathMinf(glusMathMaxf(vector[0], glusMathMaxf(vector[1], vector[2])), 0.0f);
46 |
47 | vector[0] = glusMathMaxf(vector[0], 0.0f);
48 | vector[1] = glusMathMaxf(vector[1], 0.0f);
49 | vector[2] = glusMathMaxf(vector[2], 0.0f);
50 |
51 | outsideDistance = glusVector3Lengthf(vector);
52 |
53 | return insideDistance + outsideDistance;
54 | }
55 |
--------------------------------------------------------------------------------
/GLUS/src/glus_complex.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSfloat GLUSAPIENTRY glusComplexAbsolutec(const GLUScomplex* complex)
21 | {
22 | return sqrtf(complex->real * complex->real + complex->imaginary * complex->imaginary);
23 | }
24 |
25 | GLUSvoid GLUSAPIENTRY glusComplexConjugatec(GLUScomplex* result, const GLUScomplex* complex)
26 | {
27 | result->real = complex->real;
28 | result->imaginary = -complex->imaginary;
29 | }
30 |
31 | GLUSvoid GLUSAPIENTRY glusComplexAddComplexc(GLUScomplex* result, const GLUScomplex* complex0, const GLUScomplex* complex1)
32 | {
33 | result->real = complex0->real + complex1->real;
34 | result->imaginary = complex0->imaginary + complex1->imaginary;
35 | }
36 |
37 | GLUSvoid GLUSAPIENTRY glusComplexSubtractComplexc(GLUScomplex* result, const GLUScomplex* complex0, const GLUScomplex* complex1)
38 | {
39 | result->real = complex0->real - complex1->real;
40 | result->imaginary = complex0->imaginary - complex1->imaginary;
41 | }
42 |
43 | GLUSvoid GLUSAPIENTRY glusComplexMultiplyComplexc(GLUScomplex* result, const GLUScomplex* complex0, const GLUScomplex* complex1)
44 | {
45 | GLUScomplex temp;
46 |
47 | temp.real = complex0->real * complex1->real - complex0->imaginary * complex1->imaginary;
48 | temp.imaginary = complex0->real * complex1->imaginary + complex1->real * complex0->imaginary;
49 |
50 | result->real = temp.real;
51 | result->imaginary = temp.imaginary;
52 | }
53 |
54 | GLUSvoid GLUSAPIENTRY glusComplexDivideComplexc(GLUScomplex* result, const GLUScomplex* complex0, const GLUScomplex* complex1)
55 | {
56 | GLUScomplex temp;
57 |
58 | GLUSfloat divisor = complex1->real * complex1->real + complex1->imaginary * complex1->imaginary;
59 |
60 | temp.real = (complex0->real * complex1->real + complex0->imaginary * complex1->imaginary) / divisor;
61 | temp.imaginary = (complex1->real * complex0->imaginary - complex0->real * complex1->imaginary) / divisor;
62 |
63 | result->real = temp.real;
64 | result->imaginary = temp.imaginary;
65 | }
66 |
67 | GLUSvoid GLUSAPIENTRY glusComplexMultiplyScalarc(GLUScomplex* result, const GLUScomplex* complex, const GLUSfloat scalar)
68 | {
69 | result->real = complex->real * scalar;
70 | result->imaginary = complex->imaginary * scalar;
71 | }
72 |
73 | GLUSvoid GLUSAPIENTRY glusComplexExpComplexc(GLUScomplex* result, const GLUScomplex* complex)
74 | {
75 | GLUScomplex temp;
76 |
77 | temp.real = expf(complex->real) * cosf(complex->imaginary);
78 | temp.imaginary = expf(complex->real) * sinf(complex->imaginary);
79 |
80 | result->real = temp.real;
81 | result->imaginary = temp.imaginary;
82 | }
83 |
84 | GLUSvoid glusComplexRootOfUnityc(GLUScomplex* result, const GLUSint n, const GLUSint k, const GLUSfloat dir)
85 | {
86 | result->real = cosf(2.0f * GLUS_PI * (GLUSfloat)k / (GLUSfloat)n);
87 | result->imaginary = dir * sinf(2.0f * GLUS_PI * (GLUSfloat)k / (GLUSfloat)n);
88 | }
89 |
--------------------------------------------------------------------------------
/GLUS/src/glus_extension.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSboolean GLUSAPIENTRY glusExtensionIsSupported(const GLUSchar* extension)
21 | {
22 | const GLUSubyte* allExtensions;
23 | const GLUSubyte* startExtension;
24 | GLUSubyte* walkerExtension;
25 | GLUSubyte* terminatorExtension;
26 |
27 | if (!extension)
28 | {
29 | return GLUS_FALSE;
30 | }
31 |
32 | walkerExtension = (GLUSubyte*)strchr(extension, ' ');
33 | if (walkerExtension || *extension == '\0')
34 | {
35 | return GLUS_FALSE;
36 | }
37 |
38 | allExtensions = glGetString(GLUS_EXTENSIONS);
39 |
40 | startExtension = allExtensions;
41 | while (startExtension)
42 | {
43 | walkerExtension = (GLUSubyte*)strstr((const GLUSchar*)startExtension, extension);
44 |
45 | if (!walkerExtension)
46 | {
47 | return GLUS_FALSE;
48 | }
49 |
50 | terminatorExtension = walkerExtension + strlen(extension);
51 |
52 | if (!terminatorExtension)
53 | {
54 | return GLUS_FALSE;
55 | }
56 |
57 | if (walkerExtension == startExtension || *(walkerExtension - 1) == ' ')
58 | {
59 | if (*terminatorExtension == ' ' || *terminatorExtension == '\0')
60 | {
61 | return GLUS_TRUE;
62 | }
63 | }
64 |
65 | startExtension = (const GLUSubyte*)terminatorExtension;
66 | }
67 |
68 | return GLUS_FALSE;
69 | }
70 |
--------------------------------------------------------------------------------
/GLUS/src/glus_extension_vg.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSboolean GLUSAPIENTRY glusExtensionIsSupported(const GLUSchar* extension)
21 | {
22 | const GLUSubyte* allExtensions;
23 | const GLUSubyte* startExtension;
24 | GLUSubyte* walkerExtension;
25 | GLUSubyte* terminatorExtension;
26 |
27 | if (!extension)
28 | {
29 | return GLUS_FALSE;
30 | }
31 |
32 | walkerExtension = (GLUSubyte*)strchr(extension, ' ');
33 | if (walkerExtension || *extension == '\0')
34 | {
35 | return GLUS_FALSE;
36 | }
37 |
38 | allExtensions = vgGetString(VG_EXTENSIONS);
39 |
40 | startExtension = allExtensions;
41 | while (startExtension)
42 | {
43 | walkerExtension = (GLUSubyte*)strstr((const GLUSchar*)startExtension, extension);
44 |
45 | if (!walkerExtension)
46 | {
47 | return GLUS_FALSE;
48 | }
49 |
50 | terminatorExtension = walkerExtension + strlen(extension);
51 |
52 | if (!terminatorExtension)
53 | {
54 | return GLUS_FALSE;
55 | }
56 |
57 | if (walkerExtension == startExtension || *(walkerExtension - 1) == ' ')
58 | {
59 | if (*terminatorExtension == ' ' || *terminatorExtension == '\0')
60 | {
61 | return GLUS_TRUE;
62 | }
63 | }
64 |
65 | startExtension = (const GLUSubyte*)terminatorExtension;
66 | }
67 |
68 | return GLUS_FALSE;
69 | }
70 |
--------------------------------------------------------------------------------
/GLUS/src/glus_file.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSboolean _glusFileCheckRead(FILE* f, size_t actualRead, size_t expectedRead)
21 | {
22 | if (!f)
23 | {
24 | return GLUS_FALSE;
25 | }
26 |
27 | if (actualRead < expectedRead)
28 | {
29 | glusFileClose(f);
30 |
31 | return GLUS_FALSE;
32 | }
33 |
34 | return GLUS_TRUE;
35 | }
36 |
37 | GLUSboolean _glusFileCheckWrite(FILE* f, size_t actualWrite, size_t expectedWrite)
38 | {
39 | if (!f)
40 | {
41 | return GLUS_FALSE;
42 | }
43 |
44 | if (actualWrite < expectedWrite)
45 | {
46 | if (ferror(f))
47 | {
48 | glusFileClose(f);
49 |
50 | return GLUS_FALSE;
51 | }
52 | }
53 |
54 | return GLUS_TRUE;
55 | }
56 |
57 | FILE* GLUSAPIENTRY glusFileOpen(const char* filename, const char* mode)
58 | {
59 | char buffer[GLUS_MAX_FILENAME];
60 |
61 | if (!filename)
62 | {
63 | // Note: Automatic errno setting.
64 | return fopen(filename, mode);
65 | }
66 |
67 | if (strlen(filename) + strlen(GLUS_BASE_DIRECTORY) >= GLUS_MAX_FILENAME)
68 | {
69 | // Note: Automatic errno setting.
70 | return fopen(filename, mode);
71 | }
72 |
73 | strcpy(buffer, GLUS_BASE_DIRECTORY);
74 | strcat(buffer, filename);
75 |
76 | return fopen(buffer, mode);
77 | }
78 |
79 | int GLUSAPIENTRY glusFileClose(FILE* stream)
80 | {
81 | return fclose(stream);
82 | }
83 |
--------------------------------------------------------------------------------
/GLUS/src/glus_file_binary.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | #define GLUS_MAX_BINARYILE_LENGTH 2147483647
21 |
22 | extern GLUSboolean _glusFileCheckRead(FILE* f, size_t actualRead, size_t expectedRead);
23 | extern GLUSboolean _glusFileCheckWrite(FILE* f, size_t actualWrite, size_t expectedWrite);
24 |
25 | GLUSboolean GLUSAPIENTRY glusFileLoadBinary(const GLUSchar* filename, GLUSbinaryfile* binaryfile)
26 | {
27 | FILE* f;
28 | size_t elementsRead;
29 |
30 | if (!filename || !binaryfile)
31 | {
32 | return GLUS_FALSE;
33 | }
34 |
35 | binaryfile->binary = 0;
36 |
37 | binaryfile->length = 0;
38 |
39 | f = glusFileOpen(filename, "rb");
40 |
41 | if (!f)
42 | {
43 | return GLUS_FALSE;
44 | }
45 |
46 | if (fseek(f, 0, SEEK_END))
47 | {
48 | glusFileClose(f);
49 |
50 | return GLUS_FALSE;
51 | }
52 |
53 | binaryfile->length = ftell(f);
54 |
55 | if (binaryfile->length < 0 || binaryfile->length == GLUS_MAX_BINARYILE_LENGTH)
56 | {
57 | glusFileClose(f);
58 |
59 | binaryfile->length = 0;
60 |
61 | return GLUS_FALSE;
62 | }
63 |
64 | binaryfile->binary = (GLUSubyte*)glusMemoryMalloc((size_t)binaryfile->length);
65 |
66 | if (!binaryfile->binary)
67 | {
68 | glusFileClose(f);
69 |
70 | binaryfile->length = 0;
71 |
72 | return GLUS_FALSE;
73 | }
74 |
75 | memset(binaryfile->binary, 0, (size_t)binaryfile->length);
76 |
77 | rewind(f);
78 |
79 | elementsRead = fread(binaryfile->binary, 1, (size_t)binaryfile->length, f);
80 |
81 | if (!_glusFileCheckRead(f, elementsRead, (size_t)binaryfile->length))
82 | {
83 | glusFileDestroyBinary(binaryfile);
84 |
85 | return GLUS_FALSE;
86 | }
87 |
88 | glusFileClose(f);
89 |
90 | return GLUS_TRUE;
91 | }
92 |
93 | GLUSboolean GLUSAPIENTRY glusFileSaveBinary(const GLUSchar* filename, const GLUSbinaryfile* binaryfile)
94 | {
95 | FILE* file;
96 | size_t elementsWritten;
97 |
98 | if (!filename || !binaryfile)
99 | {
100 | return GLUS_FALSE;
101 | }
102 |
103 | file = glusFileOpen(filename, "wb");
104 |
105 | if (!file)
106 | {
107 | return GLUS_FALSE;
108 | }
109 |
110 | elementsWritten = fwrite(binaryfile->binary, 1, binaryfile->length * sizeof(GLUSubyte), file);
111 |
112 | if (!_glusFileCheckWrite(file, elementsWritten, binaryfile->length * sizeof(GLUSubyte)))
113 | {
114 | return GLUS_FALSE;
115 | }
116 |
117 | glusFileClose(file);
118 |
119 | return GLUS_TRUE;
120 | }
121 |
122 | GLUSvoid GLUSAPIENTRY glusFileDestroyBinary(GLUSbinaryfile* binaryfile)
123 | {
124 | if (!binaryfile)
125 | {
126 | return;
127 | }
128 |
129 | if (binaryfile->binary)
130 | {
131 | glusMemoryFree(binaryfile->binary);
132 |
133 | binaryfile->binary = 0;
134 | }
135 |
136 | binaryfile->length = 0;
137 | }
138 |
--------------------------------------------------------------------------------
/GLUS/src/glus_file_text.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | #define GLUS_MAX_TEXTFILE_LENGTH 2147483646
21 |
22 | extern GLUSboolean _glusFileCheckRead(FILE* f, size_t actualRead, size_t expectedRead);
23 | extern GLUSboolean _glusFileCheckWrite(FILE* f, size_t actualWrite, size_t expectedWrite);
24 |
25 | GLUSboolean GLUSAPIENTRY glusFileLoadText(const GLUSchar* filename, GLUStextfile* textfile)
26 | {
27 | FILE* f;
28 | size_t elementsRead;
29 |
30 | if (!filename || !textfile)
31 | {
32 | return GLUS_FALSE;
33 | }
34 |
35 | textfile->text = 0;
36 |
37 | textfile->length = 0;
38 |
39 | f = glusFileOpen(filename, "rb");
40 |
41 | if (!f)
42 | {
43 | return GLUS_FALSE;
44 | }
45 |
46 | if (fseek(f, 0, SEEK_END))
47 | {
48 | glusFileClose(f);
49 |
50 | return GLUS_FALSE;
51 | }
52 |
53 | textfile->length = ftell(f);
54 |
55 | if (textfile->length < 0 || textfile->length == GLUS_MAX_TEXTFILE_LENGTH)
56 | {
57 | glusFileClose(f);
58 |
59 | textfile->length = 0;
60 |
61 | return GLUS_FALSE;
62 | }
63 |
64 | textfile->text = (GLUSchar*)glusMemoryMalloc((size_t)textfile->length + 1);
65 |
66 | if (!textfile->text)
67 | {
68 | glusFileClose(f);
69 |
70 | textfile->length = 0;
71 |
72 | return GLUS_FALSE;
73 | }
74 |
75 | memset(textfile->text, 0, (size_t)textfile->length + 1);
76 |
77 | rewind(f);
78 |
79 | elementsRead = fread(textfile->text, 1, (size_t)textfile->length, f);
80 |
81 | if (!_glusFileCheckRead(f, elementsRead, (size_t)textfile->length))
82 | {
83 | glusFileDestroyText(textfile);
84 |
85 | return GLUS_FALSE;
86 | }
87 |
88 | glusFileClose(f);
89 |
90 | return GLUS_TRUE;
91 | }
92 |
93 | GLUSboolean GLUSAPIENTRY glusFileSaveText(const GLUSchar* filename, const GLUStextfile* textfile)
94 | {
95 | FILE* file;
96 | size_t elementsWritten;
97 |
98 | if (!filename || !textfile)
99 | {
100 | return GLUS_FALSE;
101 | }
102 |
103 | file = glusFileOpen(filename, "w");
104 |
105 | if (!file)
106 | {
107 | return GLUS_FALSE;
108 | }
109 |
110 | elementsWritten = fwrite(textfile->text, 1, textfile->length * sizeof(GLUSchar), file);
111 |
112 | if (!_glusFileCheckWrite(file, elementsWritten, textfile->length * sizeof(GLUSchar)))
113 | {
114 | return GLUS_FALSE;
115 | }
116 |
117 | glusFileClose(file);
118 |
119 | return GLUS_TRUE;
120 | }
121 |
122 | GLUSvoid GLUSAPIENTRY glusFileDestroyText(GLUStextfile* textfile)
123 | {
124 | if (!textfile)
125 | {
126 | return;
127 | }
128 |
129 | if (textfile->text)
130 | {
131 | glusMemoryFree(textfile->text);
132 |
133 | textfile->text = 0;
134 | }
135 |
136 | textfile->length = 0;
137 | }
138 |
--------------------------------------------------------------------------------
/GLUS/src/glus_image.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSvoid _glusImageGatherSamplePoints(GLUSint sampleIndex[4], GLUSfloat sampleWeight[2], const GLUSfloat st[2], GLUSint width, GLUSint height, GLUSint stride)
21 | {
22 | GLUSfloat pixelTexCoord[2];
23 | GLUSfloat pixelTexCoordCenter[2];
24 |
25 | GLUSint samplePixel[2];
26 |
27 | GLUSint i;
28 |
29 | for (i = 0; i < 2; i++)
30 | {
31 | pixelTexCoord[i] = glusMathClampf(st[i], 0.0f, 1.0f);
32 | }
33 |
34 | pixelTexCoord[0] = pixelTexCoord[0] * (GLUSfloat)width;
35 | pixelTexCoord[1] = pixelTexCoord[1] * (GLUSfloat)height;
36 |
37 | for (i = 0; i < 2; i++)
38 | {
39 | pixelTexCoordCenter[i] = floorf(pixelTexCoord[i]) + 0.5f;
40 | }
41 |
42 | for (i = 0; i < 2; i++)
43 | {
44 | sampleWeight[i] = 1.0f - fabsf(pixelTexCoordCenter[i] - pixelTexCoord[i]);
45 | }
46 |
47 | // Check, if in bounds.
48 |
49 | samplePixel[0] = (GLUSint)pixelTexCoord[0];
50 | if (samplePixel[0] == width)
51 | {
52 | samplePixel[0]--;
53 | }
54 |
55 | samplePixel[1] = (GLUSint)pixelTexCoord[1];
56 | if (samplePixel[1] == height)
57 | {
58 | samplePixel[1]--;
59 | }
60 |
61 | // Main sample point
62 |
63 | sampleIndex[0] = samplePixel[1] * width * stride + samplePixel[0] * stride;
64 |
65 | // s axis sample point
66 |
67 | if (pixelTexCoordCenter[0] > 0.5f && pixelTexCoord[0] < pixelTexCoordCenter[0])
68 | {
69 | sampleIndex[1] = sampleIndex[0] - stride;
70 | sampleIndex[3] = -stride;
71 | }
72 | else if (pixelTexCoordCenter[0] < (GLUSfloat)width - 0.5f && pixelTexCoord[0] > pixelTexCoordCenter[0])
73 | {
74 | sampleIndex[1] = sampleIndex[0] + stride;
75 | sampleIndex[3] = stride;
76 | }
77 | else
78 | {
79 | sampleIndex[1] = sampleIndex[0];
80 | sampleIndex[3] = 0;
81 | }
82 |
83 | // t axis sample point
84 |
85 | if (pixelTexCoordCenter[1] > 0.5f && pixelTexCoord[1] < pixelTexCoordCenter[1])
86 | {
87 | sampleIndex[2] = sampleIndex[0] - stride * width;
88 | }
89 | else if (pixelTexCoordCenter[1] < (GLUSfloat)height - 0.5f && pixelTexCoord[1] > pixelTexCoordCenter[1])
90 | {
91 | sampleIndex[2] = sampleIndex[0] + stride * width;
92 | }
93 | else
94 | {
95 | sampleIndex[2] = sampleIndex[0];
96 | }
97 |
98 | // diagonal sample point
99 |
100 | sampleIndex[3] += sampleIndex[2];
101 | }
102 |
--------------------------------------------------------------------------------
/GLUS/src/glus_image_pkm.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSboolean GLUSAPIENTRY glusImageLoadPkm(const GLUSchar* filename, GLUSpkmimage* pkmimage)
21 | {
22 | GLUSbinaryfile binaryfile;
23 |
24 | GLUSubyte* buffer;
25 |
26 | GLUSubyte type;
27 |
28 | // check, if we have a valid pointer
29 | if (!filename || !pkmimage)
30 | {
31 | return GLUS_FALSE;
32 | }
33 |
34 | if (!glusFileLoadBinary(filename, &binaryfile))
35 | {
36 | return GLUS_FALSE;
37 | }
38 |
39 | buffer = binaryfile.binary;
40 | if (!(buffer[0] == 'P' && buffer[1] == 'K' && buffer[2] == 'M' && buffer[3] == ' '))
41 | {
42 | glusFileDestroyBinary(&binaryfile);
43 |
44 | return GLUS_FALSE;
45 | }
46 | buffer += 7;
47 |
48 | pkmimage->depth = 1;
49 |
50 | pkmimage->imageSize = binaryfile.length - 16;
51 | if (pkmimage->imageSize <= 0)
52 | {
53 | glusFileDestroyBinary(&binaryfile);
54 |
55 | return GLUS_FALSE;
56 | }
57 |
58 | pkmimage->data = (GLUSubyte*)glusMemoryMalloc(pkmimage->imageSize * sizeof(GLUSubyte));
59 | if (!pkmimage->data)
60 | {
61 | glusFileDestroyBinary(&binaryfile);
62 |
63 | return GLUS_FALSE;
64 | }
65 |
66 | type = *buffer;
67 | switch (type)
68 | {
69 | case 1:
70 | pkmimage->internalformat = GLUS_COMPRESSED_RGB8_ETC2;
71 | break;
72 | case 3:
73 | pkmimage->internalformat = GLUS_COMPRESSED_RGBA8_ETC2_EAC;
74 | break;
75 | case 4:
76 | pkmimage->internalformat = GLUS_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
77 | break;
78 | case 5:
79 | pkmimage->internalformat = GLUS_COMPRESSED_R11_EAC;
80 | break;
81 | case 6:
82 | pkmimage->internalformat = GLUS_COMPRESSED_RG11_EAC;
83 | break;
84 | case 7:
85 | pkmimage->internalformat = GLUS_COMPRESSED_SIGNED_R11_EAC;
86 | break;
87 | case 8:
88 | pkmimage->internalformat = GLUS_COMPRESSED_SIGNED_RG11_EAC;
89 | break;
90 | default:
91 | {
92 | glusImageDestroyPkm(pkmimage);
93 |
94 | glusFileDestroyBinary(&binaryfile);
95 |
96 | return GLUS_FALSE;
97 | }
98 | break;
99 | }
100 | buffer += 5;
101 |
102 | pkmimage->width = (GLUSushort)(*buffer) * 256;
103 | buffer += 1;
104 | pkmimage->width += (GLUSushort)(*buffer);
105 | buffer += 1;
106 |
107 | pkmimage->height = (GLUSushort)(*buffer) * 256;
108 | buffer += 1;
109 | pkmimage->height += (GLUSushort)(*buffer);
110 | buffer += 1;
111 |
112 | memcpy(pkmimage->data, buffer, pkmimage->imageSize);
113 |
114 | glusFileDestroyBinary(&binaryfile);
115 |
116 | return GLUS_TRUE;
117 | }
118 |
119 | GLUSvoid GLUSAPIENTRY glusImageDestroyPkm(GLUSpkmimage* pkmimage)
120 | {
121 | if (!pkmimage)
122 | {
123 | return;
124 | }
125 |
126 | if (pkmimage->data)
127 | {
128 | glusMemoryFree(pkmimage->data);
129 |
130 | pkmimage->data = 0;
131 | }
132 |
133 | pkmimage->width = 0;
134 |
135 | pkmimage->height = 0;
136 |
137 | pkmimage->depth = 0;
138 |
139 | pkmimage->internalformat = 0;
140 |
141 | pkmimage->imageSize = 0;
142 | }
143 |
--------------------------------------------------------------------------------
/GLUS/src/glus_intersect.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSint GLUSAPIENTRY glusIntersectRaySpheref(GLUSfloat* tNear, GLUSfloat* tFar, GLUSboolean* insideSphere, const GLUSfloat rayStart[4], const GLUSfloat rayDirection[3], const GLUSfloat sphereCenter[4], const GLUSfloat radius)
21 | {
22 | // see http://de.wikipedia.org/wiki/Quadratische_Gleichung (German)
23 | // see Real-Time Collision Detection p177
24 |
25 | GLUSint intersections = 0;
26 | GLUSfloat m[3];
27 | GLUSfloat b, c, discriminant, sqrtDiscriminant, t;
28 |
29 | glusPoint4SubtractPoint4f(m, rayStart, sphereCenter);
30 |
31 | b = glusVector3Dotf(m, rayDirection);
32 | c = glusVector3Dotf(m, m) - radius * radius;
33 |
34 | // Ray pointing away from sphere and ray starts outside sphere.
35 | if (b > 0.0f && c > 0.0f)
36 | {
37 | return intersections;
38 | }
39 |
40 | discriminant = b * b - c;
41 |
42 | // No solution, so no intersection. Ray passes the sphere.
43 | if (discriminant < 0.0f)
44 | {
45 | return intersections;
46 | }
47 |
48 | sqrtDiscriminant = sqrtf(discriminant);
49 |
50 | // If we come so far, we have at least one intersection.
51 |
52 | if (insideSphere)
53 | {
54 | *insideSphere = GLUS_FALSE;
55 | }
56 |
57 | t = -b - sqrtDiscriminant;
58 |
59 | // Ray starts inside the sphere, as t is negative.
60 | if (t < 0.0f)
61 | {
62 | // Use origin as intersection point.
63 | t = 0.0f;
64 |
65 | if (insideSphere)
66 | {
67 | *insideSphere = GLUS_TRUE;
68 | }
69 | }
70 |
71 | intersections++;
72 |
73 | if (tNear)
74 | {
75 | *tNear = t;
76 | }
77 |
78 | // Tangent point. Only one intersection. So leave.
79 | if (discriminant == 0.0f)
80 | {
81 | // Save in both for convenience.
82 | if (tFar)
83 | {
84 | *tFar = t;
85 | }
86 |
87 | return intersections;
88 | }
89 |
90 | //
91 |
92 | t = -b + sqrtDiscriminant;
93 |
94 | intersections++;
95 |
96 | if (tFar)
97 | {
98 | *tFar = t;
99 | }
100 |
101 | return intersections;
102 | }
103 |
--------------------------------------------------------------------------------
/GLUS/src/glus_line_wavefront.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | extern GLUSboolean _glusWavefrontParseLine(const GLUSchar* filename, GLUSline* line);
21 |
22 | GLUSboolean GLUSAPIENTRY glusLineLoadWavefront(const GLUSchar* filename, GLUSline* line)
23 | {
24 | return _glusWavefrontParseLine(filename, line);
25 | }
26 |
--------------------------------------------------------------------------------
/GLUS/src/glus_log.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | #define GLUS_MAX_CHARS_LOGGING 2047
21 |
22 | static const char* GLUS_LOG_STRINGS[] = {
23 | "",
24 | "ERROR",
25 | "WARNING",
26 | "INFO",
27 | "DEBUG",
28 | "SEVERE"
29 | };
30 |
31 | static GLUSuint g_verbosity = GLUS_LOG_INFO;
32 |
33 | GLUSvoid GLUSAPIENTRY glusLogSetLevel(const GLUSuint verbosity)
34 | {
35 | g_verbosity = verbosity;
36 | }
37 |
38 | GLUSuint GLUSAPIENTRY glusLogGetLevel()
39 | {
40 | return g_verbosity;
41 | }
42 |
43 | GLUSvoid GLUSAPIENTRY glusLogPrint(GLUSuint verbosity, const char* format, ...)
44 | {
45 | if (g_verbosity == GLUS_LOG_NOTHING || verbosity == GLUS_LOG_NOTHING)
46 | {
47 | return;
48 | }
49 |
50 | if (g_verbosity >= verbosity)
51 | {
52 | const char* logString = "UNKNOWN";
53 | char buffer[GLUS_MAX_CHARS_LOGGING + 1];
54 | va_list argList;
55 |
56 | if (verbosity > GLUS_LOG_NOTHING && verbosity <= GLUS_LOG_SEVERE)
57 | {
58 | logString = GLUS_LOG_STRINGS[verbosity];
59 | }
60 |
61 | buffer[GLUS_MAX_CHARS_LOGGING] = '\0';
62 |
63 | va_start(argList, format);
64 |
65 | vsnprintf(buffer, GLUS_MAX_CHARS_LOGGING, format, argList);
66 |
67 | printf("LOG [%s]: %s\n", logString, buffer);
68 |
69 | va_end(argList);
70 | }
71 | }
72 |
73 | GLUSvoid GLUSAPIENTRY glusLogPrintError(GLUSuint verbosity, const char* format, ...)
74 | {
75 | GLUSenum error;
76 |
77 | error = glGetError();
78 |
79 | if (g_verbosity == GLUS_LOG_NOTHING || verbosity == GLUS_LOG_NOTHING)
80 | {
81 | return;
82 | }
83 |
84 | if (verbosity < GLUS_LOG_DEBUG && error == GLUS_NO_ERROR)
85 | {
86 | return;
87 | }
88 |
89 | if (g_verbosity >= verbosity)
90 | {
91 | const char* logString = "UNKNOWN";
92 | char buffer[GLUS_MAX_CHARS_LOGGING + 1];
93 | va_list argList;
94 |
95 | if (verbosity > GLUS_LOG_NOTHING && verbosity <= GLUS_LOG_SEVERE)
96 | {
97 | logString = GLUS_LOG_STRINGS[verbosity];
98 | }
99 |
100 | buffer[GLUS_MAX_CHARS_LOGGING] = '\0';
101 |
102 | va_start(argList, format);
103 |
104 | vsnprintf(buffer, GLUS_MAX_CHARS_LOGGING, format, argList);
105 |
106 | printf("LOG [%s]: glGetError() = 0x%x %s\n", logString, error, buffer);
107 |
108 | va_end(argList);
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/GLUS/src/glus_log_vg.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | #define GLUS_MAX_CHARS_LOGGING 2047
21 |
22 | static const char* GLUS_LOG_STRINGS[] = {
23 | "",
24 | "ERROR",
25 | "WARNING",
26 | "INFO",
27 | "DEBUG",
28 | "SEVERE"
29 | };
30 |
31 | static GLUSuint g_verbosity = GLUS_LOG_INFO;
32 |
33 | GLUSvoid GLUSAPIENTRY glusLogSetLevel(const GLUSuint verbosity)
34 | {
35 | g_verbosity = verbosity;
36 | }
37 |
38 | GLUSuint GLUSAPIENTRY glusLogGetLevel()
39 | {
40 | return g_verbosity;
41 | }
42 |
43 | GLUSvoid GLUSAPIENTRY glusLogPrint(GLUSuint verbosity, const char* format, ...)
44 | {
45 | if (g_verbosity == GLUS_LOG_NOTHING || verbosity == GLUS_LOG_NOTHING)
46 | {
47 | return;
48 | }
49 |
50 | if (g_verbosity >= verbosity)
51 | {
52 | const char* logString = "UNKNOWN";
53 | char buffer[GLUS_MAX_CHARS_LOGGING + 1];
54 | va_list argList;
55 |
56 | if (verbosity > GLUS_LOG_NOTHING && verbosity <= GLUS_LOG_SEVERE)
57 | {
58 | logString = GLUS_LOG_STRINGS[verbosity];
59 | }
60 |
61 | buffer[GLUS_MAX_CHARS_LOGGING] = '\0';
62 |
63 | va_start(argList, format);
64 |
65 | vsnprintf(buffer, GLUS_MAX_CHARS_LOGGING, format, argList);
66 |
67 | printf("LOG [%s]: %s\n", logString, buffer);
68 |
69 | va_end(argList);
70 | }
71 | }
72 |
73 | GLUSvoid GLUSAPIENTRY glusLogPrintError(GLUSuint verbosity, const char* format, ...)
74 | {
75 | GLUSenum error;
76 |
77 | error = vgGetError();
78 |
79 | if (g_verbosity == GLUS_LOG_NOTHING || verbosity == GLUS_LOG_NOTHING)
80 | {
81 | return;
82 | }
83 |
84 | if (verbosity < GLUS_LOG_DEBUG && error == VG_NO_ERROR)
85 | {
86 | return;
87 | }
88 |
89 | if (g_verbosity >= verbosity)
90 | {
91 | const char* logString = "UNKNOWN";
92 | char buffer[GLUS_MAX_CHARS_LOGGING + 1];
93 | va_list argList;
94 |
95 | if (verbosity > GLUS_LOG_NOTHING && verbosity <= GLUS_LOG_SEVERE)
96 | {
97 | logString = GLUS_LOG_STRINGS[verbosity];
98 | }
99 |
100 | buffer[GLUS_MAX_CHARS_LOGGING] = '\0';
101 |
102 | va_start(argList, format);
103 |
104 | vsnprintf(buffer, GLUS_MAX_CHARS_LOGGING, format, argList);
105 |
106 | printf("LOG [%s]: vgGetError() = 0x%x %s\n", logString, error, buffer);
107 |
108 | va_end(argList);
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/GLUS/src/glus_math.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSfloat GLUSAPIENTRY glusMathMaxf(const GLUSfloat value0, const GLUSfloat value1)
21 | {
22 | return value0 > value1 ? value0 : value1;
23 | }
24 |
25 | GLUSfloat GLUSAPIENTRY glusMathMinf(const GLUSfloat value0, const GLUSfloat value1)
26 | {
27 | return value0 < value1 ? value0 : value1;
28 | }
29 |
30 | GLUSfloat GLUSAPIENTRY glusMathRadToDegf(const GLUSfloat radians)
31 | {
32 | return radians * 360.0f / (2.0f * GLUS_PI);
33 | }
34 |
35 | GLUSfloat GLUSAPIENTRY glusMathDegToRadf(const GLUSfloat degrees)
36 | {
37 | return degrees * 2.0f * GLUS_PI / 360.0f;
38 | }
39 |
40 | GLUSfloat GLUSAPIENTRY glusMathMixf(const GLUSfloat value0, const GLUSfloat value1, const GLUSfloat t)
41 | {
42 | return value0 * (1.0f - t) + value1 * t;
43 | }
44 |
45 | GLUSfloat GLUSAPIENTRY glusMathClampf(const GLUSfloat value, const GLUSfloat min, const GLUSfloat max)
46 | {
47 | if (value < min)
48 | {
49 | return min;
50 | }
51 | if (value > max)
52 | {
53 | return max;
54 | }
55 | return value;
56 | }
57 |
58 | GLUSfloat GLUSAPIENTRY glusMathLengthf(const GLUSfloat x, const GLUSfloat y, const GLUSfloat z)
59 | {
60 | return sqrtf(x*x + y*y + z*z);
61 | }
62 |
--------------------------------------------------------------------------------
/GLUS/src/glus_memory.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | void* GLUSAPIENTRY glusMemoryMalloc(size_t size)
21 | {
22 | return malloc(size);
23 | }
24 |
25 | void GLUSAPIENTRY glusMemoryFree(void* pointer)
26 | {
27 | free(pointer);
28 | }
29 |
--------------------------------------------------------------------------------
/GLUS/src/glus_orientedbox.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSvoid GLUSAPIENTRY glusOrientedBoxCopyf(GLUSfloat resultCenter[4], GLUSfloat resultHalfExtend[3], GLUSfloat resultOrientation[3], const GLUSfloat center[4], const GLUSfloat halfExtend[3], const GLUSfloat orientation[3])
21 | {
22 | resultCenter[0] = center[0];
23 | resultCenter[1] = center[1];
24 | resultCenter[2] = center[2];
25 | resultCenter[3] = center[3];
26 |
27 | resultHalfExtend[0] = halfExtend[0];
28 | resultHalfExtend[1] = halfExtend[1];
29 | resultHalfExtend[2] = halfExtend[2];
30 | }
31 |
32 | GLUSfloat GLUSAPIENTRY glusOrientedBoxDistancePoint4f(const GLUSfloat center[4], const GLUSfloat halfExtend[3], const GLUSfloat orientation[3], const GLUSfloat point[4])
33 | {
34 | GLUSfloat matrix[9];
35 | GLUSfloat vector[3];
36 |
37 | GLUSfloat insideDistance;
38 | GLUSfloat outsideDistance;
39 |
40 | glusPoint4SubtractPoint4f(vector, point, center);
41 |
42 | glusMatrix3x3Identityf(matrix);
43 | glusMatrix3x3RotateRzRyRxf(matrix, -orientation[2], -orientation[1], -orientation[0]);
44 | glusMatrix3x3MultiplyVector3f(vector, matrix, vector);
45 |
46 | vector[0] = fabsf(vector[0]) - halfExtend[0];
47 | vector[1] = fabsf(vector[1]) - halfExtend[1];
48 | vector[2] = fabsf(vector[2]) - halfExtend[2];
49 |
50 | insideDistance = glusMathMinf(glusMathMaxf(vector[0], glusMathMaxf(vector[1], vector[2])), 0.0f);
51 |
52 | vector[0] = glusMathMaxf(vector[0], 0.0f);
53 | vector[1] = glusMathMaxf(vector[1], 0.0f);
54 | vector[2] = glusMathMaxf(vector[2], 0.0f);
55 |
56 | outsideDistance = glusVector3Lengthf(vector);
57 |
58 | return insideDistance + outsideDistance;
59 | }
60 |
--------------------------------------------------------------------------------
/GLUS/src/glus_padding.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSboolean GLUSAPIENTRY glusPaddingConvertf(GLUSfloat* target, const GLUSfloat* source, const GLUSint channels, const GLUSint padding, const GLUSint numberElements)
21 | {
22 | GLUSint currentElement, currentChannel;
23 |
24 | if (!target || !source)
25 | {
26 | return GLUS_FALSE;
27 | }
28 |
29 | if (channels < 1 || padding < 0 || numberElements < 1)
30 | {
31 | return GLUS_FALSE;
32 | }
33 |
34 | for (currentElement = 0; currentElement < numberElements; currentElement++)
35 | {
36 | for (currentChannel = 0; currentChannel < channels + padding; currentChannel++)
37 | {
38 | if (currentChannel < channels)
39 | {
40 | target[currentElement * (channels + padding) + currentChannel] = source[currentElement * channels + currentChannel];
41 | }
42 | else
43 | {
44 | target[currentElement * (channels + padding) + currentChannel] = 0.0f;
45 | }
46 | }
47 | }
48 |
49 | return GLUS_TRUE;
50 | }
51 |
--------------------------------------------------------------------------------
/GLUS/src/glus_plane.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSvoid GLUSAPIENTRY glusPlaneCopyf(GLUSfloat result[4], const GLUSfloat plane[4])
21 | {
22 | result[0] = plane[0];
23 | result[1] = plane[1];
24 | result[2] = plane[2];
25 | result[3] = plane[3];
26 | }
27 |
28 | GLUSvoid GLUSAPIENTRY glusPlaneCreatef(GLUSfloat result[4], const GLUSfloat point[4], const GLUSfloat normal[3])
29 | {
30 | GLUSfloat normalized[3];
31 |
32 | glusVector3Copyf(normalized, normal);
33 | glusVector3Normalizef(normalized);
34 |
35 | result[0] = normalized[0];
36 | result[1] = normalized[1];
37 | result[2] = normalized[2];
38 |
39 | // D = -N*P
40 | result[3] = -glusVector3Dotf(normalized, point);
41 | }
42 |
43 | GLUSfloat GLUSAPIENTRY glusPlaneDistancePoint4f(const GLUSfloat plane[4], const GLUSfloat point[4])
44 | {
45 | return glusVector3Dotf(plane, point) + plane[3];
46 | }
47 |
48 | GLUSvoid GLUSAPIENTRY glusPlaneGetPoint4f(GLUSfloat point[4], const GLUSfloat plane[4])
49 | {
50 | point[0] = 0.0f;
51 | point[1] = 0.0f;
52 | point[2] = 0.0f;
53 | point[3] = 1.0f;
54 |
55 | if (plane[0] != 0.0f)
56 | {
57 | point[0] = -plane[3] / plane[0];
58 | }
59 | else if (plane[1] != 0.0f)
60 | {
61 | point[1] = -plane[3] / plane[1];
62 | }
63 | else if (plane[2] != 0.0f)
64 | {
65 | point[2] = -plane[3] / plane[2];
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/GLUS/src/glus_profile.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | static GLUSfloat passedTime = 0.0f;
21 | static GLUSint passedFrames = 0;
22 |
23 | GLUSvoid GLUSAPIENTRY glusProfileResetFPSf()
24 | {
25 | passedTime = 0.0f;
26 | passedFrames = 0;
27 | }
28 |
29 | GLUSboolean GLUSAPIENTRY glusProfileUpdateFPSf(GLUSfloat time, GLUSuint* frames)
30 | {
31 | passedTime += time;
32 | passedFrames++;
33 |
34 | if (passedTime >= 1.0f)
35 | {
36 | if (frames)
37 | {
38 | *frames = passedFrames;
39 | }
40 | else
41 | {
42 | glusLogPrint(GLUS_LOG_INFO, "FPS: %d", passedFrames);
43 | }
44 |
45 | glusProfileResetFPSf();
46 |
47 | return GLUS_TRUE;
48 | }
49 |
50 | return GLUS_FALSE;
51 | }
52 |
53 |
--------------------------------------------------------------------------------
/GLUS/src/glus_programpipeline_es31.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSAPI GLUSboolean GLUSAPIENTRY glusProgramPipelineBuild(GLUSprogrampipeline* programPipeline, GLUSuint vertexProgram, GLUSuint fragmentProgram)
21 | {
22 | if (!programPipeline)
23 | {
24 | return GLUS_FALSE;
25 | }
26 |
27 | programPipeline->computeProgram = 0;
28 | programPipeline->vertexProgram = vertexProgram;
29 | programPipeline->fragmentProgram = fragmentProgram;
30 |
31 | glGenProgramPipelines(1, &programPipeline->pipeline);
32 | if (vertexProgram)
33 | {
34 | glUseProgramStages(programPipeline->pipeline, GLUS_VERTEX_SHADER_BIT, vertexProgram);
35 | }
36 | if (fragmentProgram)
37 | {
38 | glUseProgramStages(programPipeline->pipeline, GLUS_FRAGMENT_SHADER_BIT, fragmentProgram);
39 | }
40 |
41 | return GLUS_TRUE;
42 | }
43 |
44 | GLUSboolean GLUSAPIENTRY glusProgramPipelineBuildCompute(GLUSprogrampipeline* programPipeline, GLUSuint computeProgram)
45 | {
46 | if (!programPipeline)
47 | {
48 | return GLUS_FALSE;
49 | }
50 |
51 | programPipeline->computeProgram = computeProgram;
52 | programPipeline->vertexProgram = 0;
53 | programPipeline->fragmentProgram = 0;
54 |
55 | glGenProgramPipelines(1, &programPipeline->pipeline);
56 | if (computeProgram)
57 | {
58 | glUseProgramStages(programPipeline->pipeline, GLUS_COMPUTE_SHADER_BIT, computeProgram);
59 | }
60 |
61 | return GLUS_TRUE;
62 | }
63 |
64 | GLUSvoid GLUSAPIENTRY glusProgramPipelineDestroy(GLUSprogrampipeline* programPipeline)
65 | {
66 | if (!programPipeline)
67 | {
68 | return;
69 | }
70 |
71 | if (programPipeline->pipeline)
72 | {
73 | glUseProgramStages(programPipeline->pipeline, GLUS_COMPUTE_SHADER_BIT, 0);
74 | glUseProgramStages(programPipeline->pipeline, GLUS_VERTEX_SHADER_BIT, 0);
75 | glUseProgramStages(programPipeline->pipeline, GLUS_FRAGMENT_SHADER_BIT, 0);
76 |
77 | glDeleteProgramPipelines(1, &programPipeline->pipeline);
78 |
79 | programPipeline->pipeline = 0;
80 | }
81 |
82 | programPipeline->computeProgram = 0;
83 | programPipeline->fragmentProgram = 0;
84 | programPipeline->vertexProgram = 0;
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/GLUS/src/glus_random.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | #define GLUS_UNIFORM_RANDOM_BIAS 0.0000001f
21 |
22 | GLUSvoid GLUSAPIENTRY glusRandomSetSeed(const GLUSuint seed)
23 | {
24 | srand(seed);
25 | }
26 |
27 | GLUSfloat GLUSAPIENTRY glusRandomUniformf(const GLUSfloat start, const GLUSfloat end)
28 | {
29 | return ((GLUSfloat)rand() / (GLUSfloat)RAND_MAX) * (end - start) + start;
30 | }
31 |
32 | // see http://mathworld.wolfram.com/Box-MullerTransformation.html
33 |
34 | GLUSfloat GLUSAPIENTRY glusRandomNormalf(const GLUSfloat mean, const GLUSfloat standardDeviation)
35 | {
36 | GLUSfloat x1, x2;
37 |
38 | // Avoid logf(0.0f) and logf(1.0f)
39 | x1 = glusRandomUniformf(GLUS_UNIFORM_RANDOM_BIAS, 1.0f - GLUS_UNIFORM_RANDOM_BIAS);
40 | x2 = glusRandomUniformf(0.0f, 1.0f);
41 |
42 | return mean + standardDeviation * (sqrtf(-2.0f * logf(x1)) * cosf(2.0f * GLUS_PI * x2));
43 | }
44 |
45 | // see http://mathworld.wolfram.com/HammersleyPointSet.html
46 | // see https://github.com/wdas/brdf/blob/master/src/shaderTemplates/brdfIBL.frag
47 |
48 | GLUSboolean GLUSAPIENTRY glusRandomHammersleyf(GLUSfloat result[2], const GLUSuint sample, const GLUSubyte m)
49 | {
50 | GLUSuint revertSample;
51 | GLUSfloat binaryFractionFactor;
52 |
53 | if (!result)
54 | {
55 | return GLUS_FALSE;
56 | }
57 |
58 | // Check, if m is in the allowed range, as only 32bit unsigned integer is supported.
59 | if (m == 0 || m > 32)
60 | {
61 | return GLUS_FALSE;
62 | }
63 |
64 | // If not all bits are used: Check, if sample is out of bounds.
65 | if (m < 32 && sample >= (GLUSuint)(1 << m))
66 | {
67 | return GLUS_FALSE;
68 | }
69 |
70 | // Revert bits by swapping blockwise. Lower bits are moved up and higher bits down.
71 | revertSample = (sample << 16u) | (sample >> 16u);
72 | revertSample = ((revertSample & 0x00ff00ffu) << 8u) | ((revertSample & 0xff00ff00u) >> 8u);
73 | revertSample = ((revertSample & 0x0f0f0f0fu) << 4u) | ((revertSample & 0xf0f0f0f0u) >> 4u);
74 | revertSample = ((revertSample & 0x33333333u) << 2u) | ((revertSample & 0xccccccccu) >> 2u);
75 | revertSample = ((revertSample & 0x55555555u) << 1u) | ((revertSample & 0xaaaaaaaau) >> 1u);
76 |
77 | // Shift back, as only m bits are used.
78 | revertSample = revertSample >> (32 - m);
79 |
80 | // Results are in range [0.0 1.0] and not [0.0, 1.0[.
81 | binaryFractionFactor = 1.0f / (powf(2.0f, (GLUSfloat)m) - 1.0f);
82 |
83 | result[0] = (GLUSfloat)revertSample * binaryFractionFactor;
84 | result[1] = (GLUSfloat)sample * binaryFractionFactor;
85 |
86 | return GLUS_TRUE;
87 | }
88 |
--------------------------------------------------------------------------------
/GLUS/src/glus_screenshot.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSboolean GLUSAPIENTRY glusScreenshotUseTga(GLUSint x, GLUSint y, const GLUStgaimage* screenshot)
21 | {
22 | if (!screenshot)
23 | {
24 | return GLUS_FALSE;
25 | }
26 |
27 | if (x < 0 || y < 0 || screenshot->width < 1 || screenshot->height < 1 || screenshot->depth != 1 || screenshot->format != GLUS_RGBA || screenshot->data == 0)
28 | {
29 | return GLUS_FALSE;
30 | }
31 |
32 | glBindFramebuffer(GLUS_FRAMEBUFFER, 0);
33 |
34 | glFlush();
35 |
36 | glPixelStorei(GLUS_PACK_ALIGNMENT, 1);
37 | glPixelStorei(GLUS_UNPACK_ALIGNMENT, 1);
38 |
39 | glReadPixels(x, y, screenshot->width, screenshot->height, GLUS_RGBA, GLUS_UNSIGNED_BYTE, screenshot->data);
40 |
41 | return GLUS_TRUE;
42 | }
43 |
44 | GLUSboolean GLUSAPIENTRY glusScreenshotCreateTga(GLUSint x, GLUSint y, GLUSsizei width, GLUSsizei height, GLUStgaimage* screenshot)
45 | {
46 | if (!screenshot)
47 | {
48 | return GLUS_FALSE;
49 | }
50 |
51 | screenshot->data = (GLUSubyte*)glusMemoryMalloc(width * height * 4);
52 | if (!screenshot->data)
53 | {
54 | return GLUS_FALSE;
55 | }
56 | screenshot->format= GLUS_RGBA;
57 | screenshot->width = width;
58 | screenshot->height = height;
59 | screenshot->depth = 1;
60 |
61 | return glusScreenshotUseTga(x, y, screenshot);
62 | }
63 |
--------------------------------------------------------------------------------
/GLUS/src/glus_screenshot_vg.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSboolean GLUSAPIENTRY glusScreenshotUseTga(GLUSint x, GLUSint y, const GLUStgaimage* screenshot)
21 | {
22 | if (!screenshot)
23 | {
24 | return GLUS_FALSE;
25 | }
26 |
27 | if (x < 0 || y < 0 || screenshot->width < 1 || screenshot->height < 1 || screenshot->depth != 1 || screenshot->format != GLUS_RGBA)
28 | {
29 | return GLUS_FALSE;
30 | }
31 |
32 | vgFlush();
33 |
34 | vgReadPixels(screenshot->data, screenshot->width * 4 * sizeof(GLUSubyte), VG_sABGR_8888, x, y, screenshot->width, screenshot->height);
35 |
36 | return GLUS_TRUE;
37 | }
38 |
39 | GLUSboolean GLUSAPIENTRY glusScreenshotCreateTga(GLUSint x, GLUSint y, GLUSsizei width, GLUSsizei height, GLUStgaimage* screenshot)
40 | {
41 | if (!screenshot)
42 | {
43 | return GLUS_FALSE;
44 | }
45 |
46 | screenshot->data = (GLUSubyte*)glusMemoryMalloc(width * height * 4);
47 | if (!screenshot->data)
48 | {
49 | return GLUS_FALSE;
50 | }
51 | screenshot->format= GLUS_RGBA;
52 | screenshot->width = width;
53 | screenshot->height = height;
54 | screenshot->depth = 1;
55 |
56 | return glusScreenshotUseTga(x, y, screenshot);
57 | }
58 |
--------------------------------------------------------------------------------
/GLUS/src/glus_shape_texgen.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSboolean GLUSAPIENTRY glusShapeTexGenByAxesf(GLUSshape* shape, const GLUSfloat sSizeX, const GLUSfloat sSizeZ, const GLUSfloat tSizeY, const GLUSfloat tSizeZ, const GLUSfloat sOffset, const GLUSfloat tOffset)
21 | {
22 | GLUSuint i;
23 |
24 | if (!shape)
25 | {
26 | return GLUS_FALSE;
27 | }
28 |
29 | if (shape->texCoords)
30 | {
31 | glusMemoryFree(shape->texCoords);
32 |
33 | shape->texCoords = 0;
34 | }
35 |
36 | shape->texCoords = (GLUSfloat*)glusMemoryMalloc(2 * shape->numberVertices * sizeof(GLUSfloat));
37 |
38 | if (!shape->texCoords)
39 | {
40 | return GLUS_FALSE;
41 | }
42 |
43 | for (i = 0; i < shape->numberVertices; i++)
44 | {
45 | shape->texCoords[2 * i + 0] = shape->vertices[4 * i + 0] * sSizeX + shape->vertices[4 * i + 2] * sSizeZ + sOffset;
46 | shape->texCoords[2 * i + 1] = shape->vertices[4 * i + 1] * tSizeY + shape->vertices[4 * i + 2] * tSizeZ + tOffset;
47 | }
48 |
49 | return GLUS_TRUE;
50 | }
51 |
52 | GLUSboolean GLUSAPIENTRY glusShapeTexGenByPlanesf(GLUSshape* shape, const GLUSfloat sPlane[4], const GLUSfloat tPlane[4], const float sSize, const float tSize, const float sOffset, const float tOffset)
53 | {
54 | GLUSuint i;
55 |
56 | if (!shape)
57 | {
58 | return GLUS_FALSE;
59 | }
60 |
61 | if (shape->texCoords)
62 | {
63 | glusMemoryFree(shape->texCoords);
64 |
65 | shape->texCoords = 0;
66 | }
67 |
68 | shape->texCoords = (GLUSfloat*)glusMemoryMalloc(2 * shape->numberVertices * sizeof(GLUSfloat));
69 |
70 | if (!shape->texCoords)
71 | {
72 | return GLUS_FALSE;
73 | }
74 |
75 | for (i = 0; i < shape->numberVertices; i++)
76 | {
77 | shape->texCoords[2 * i + 0] = glusPlaneDistancePoint4f(sPlane, &shape->vertices[4 * i]) * sSize + sOffset;
78 | shape->texCoords[2 * i + 1] = glusPlaneDistancePoint4f(tPlane, &shape->vertices[4 * i]) * tSize + tOffset;
79 | }
80 |
81 | return GLUS_TRUE;
82 | }
83 |
--------------------------------------------------------------------------------
/GLUS/src/glus_shape_wavefront.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | extern GLUSboolean _glusWavefrontParse(const GLUSchar* filename, GLUSshape* shape, GLUSwavefront* wavefront, GLUSscene* scene);
21 |
22 | GLUSboolean GLUSAPIENTRY glusShapeLoadWavefront(const GLUSchar* filename, GLUSshape* shape)
23 | {
24 | return _glusWavefrontParse(filename, shape, 0, 0);
25 | }
26 |
--------------------------------------------------------------------------------
/GLUS/src/glus_sphere.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSvoid GLUSAPIENTRY glusSphereCopyf(GLUSfloat resultCenter[4], GLUSfloat resultRadius, const GLUSfloat center[4], const GLUSfloat radius)
21 | {
22 | resultCenter[0] = center[0];
23 | resultCenter[1] = center[1];
24 | resultCenter[2] = center[2];
25 | resultCenter[3] = center[3];
26 |
27 | resultRadius = radius;
28 | }
29 |
30 | GLUSfloat GLUSAPIENTRY glusSphereDistancePoint4f(const GLUSfloat center[4], const GLUSfloat radius, const GLUSfloat point[4])
31 | {
32 | return glusPoint4Distancef(point, center) - radius;
33 | }
34 |
--------------------------------------------------------------------------------
/GLUS/src/glus_time.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSfloat GLUSAPIENTRY glusTimeGetTimestampf()
21 | {
22 | return (GLUSfloat)glfwGetTime();
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/GLUS/src/glus_time_es.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | extern double _glusOsGetRawTime(GLUSvoid);
21 |
22 | GLUSfloat GLUSAPIENTRY glusTimeGetTimestampf()
23 | {
24 | return (GLUSfloat)_glusOsGetRawTime();
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/GLUS/src/glus_version.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | GLUSboolean GLUSAPIENTRY glusVersionIsSupported(const GLUSint major, const GLUSint minor)
21 | {
22 | GLUSint driverMajor;
23 | GLUSint driverMinor;
24 |
25 | const GLUSchar* version = (const GLUSchar*) glGetString(GLUS_VERSION);
26 |
27 | if (!version)
28 | {
29 | return GLUS_FALSE;
30 | }
31 |
32 | if (major < 1 || minor < 0)
33 | {
34 | return GLUS_FALSE;
35 | }
36 |
37 | driverMajor = atoi(version);
38 |
39 | version = strchr(version, '.');
40 |
41 | if (!version)
42 | {
43 | return GLUS_FALSE;
44 | }
45 |
46 | version++;
47 |
48 | driverMinor = atoi(version);
49 |
50 | if (driverMajor < major)
51 | {
52 | return GLUS_FALSE;
53 | }
54 | else if (driverMajor == major)
55 | {
56 | return driverMinor >= minor;
57 | }
58 |
59 | return GLUS_TRUE;
60 | }
61 |
--------------------------------------------------------------------------------
/GLUS/src/glus_window_recording.c:
--------------------------------------------------------------------------------
1 | /*
2 | * GLUS - Modern OpenGL, OpenGL ES and OpenVG Utilities. Copyright (C) since 2010 Norbert Nopper
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with this program. If not, see .
16 | */
17 |
18 | #include "GL/glus.h"
19 |
20 | #define GLUS_MAX_FRAMES 10000
21 | #define GLUS_MAX_FRAMES_PER_SECOND 120
22 |
23 | static GLUSint g_currentFrame = 0;
24 | static GLUSint g_numberFrames = 0;
25 | static GLUSfloat g_recordingTime = 0.0f;
26 |
27 | static GLUStgaimage g_tgaimage = {0, 0, 0, 0, 0};
28 |
29 | GLUSint _glusWindowGetCurrentRecordingFrame(GLUSvoid)
30 | {
31 | return g_currentFrame;
32 | }
33 |
34 | GLUSint _glusWindowGetCurrentAndIncreaseRecordingFrame(GLUSvoid)
35 | {
36 | return g_currentFrame++;
37 | }
38 |
39 | GLUSint _glusWindowGetRecordingFrames(GLUSvoid)
40 | {
41 | return g_numberFrames;
42 | }
43 |
44 | GLUSfloat _glusWindowGetRecordingTime(GLUSvoid)
45 | {
46 | return g_recordingTime;
47 | }
48 |
49 | const GLUStgaimage* _glusWindowGetRecordingImageTga(GLUSvoid)
50 | {
51 | return &g_tgaimage;
52 | }
53 |
54 | GLUSboolean GLUSAPIENTRY glusWindowStartRecording(GLUSint numberFrames, GLUSint framesPerSecond)
55 | {
56 | glusWindowStopRecording();
57 |
58 | if (numberFrames < 1 || numberFrames > GLUS_MAX_FRAMES || framesPerSecond < 1 || framesPerSecond > GLUS_MAX_FRAMES_PER_SECOND)
59 | {
60 | return GLUS_FALSE;
61 | }
62 |
63 | if (!glusImageCreateTga(&g_tgaimage, glusWindowGetWidth(), glusWindowGetHeight(), 1, GLUS_RGBA))
64 | {
65 | return GLUS_FALSE;
66 | }
67 |
68 | g_numberFrames = numberFrames;
69 |
70 | g_recordingTime = 1.0f / (GLUSfloat)framesPerSecond;
71 |
72 | return GLUS_TRUE;
73 | }
74 |
75 | GLUSboolean GLUSAPIENTRY glusWindowIsRecording(GLUSvoid)
76 | {
77 | return g_tgaimage.data != 0;
78 | }
79 |
80 | GLUSvoid GLUSAPIENTRY glusWindowStopRecording(GLUSvoid)
81 | {
82 | g_currentFrame = 0;
83 | g_numberFrames = 0;
84 | g_recordingTime = 0.0f;
85 |
86 | glusImageDestroyTga(&g_tgaimage);
87 | }
88 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | OpenVG
2 | ======
3 |
4 | OpenVG 1.1
5 |
6 | Please read [GLUS/README.txt](https://github.com/McNopper/OpenVG/blob/master/GLUS/README.txt)
7 |
8 | Please read [VG_Binaries/README.txt](https://github.com/McNopper/OpenVG/blob/master/VG_Binaries/README.txt)
9 |
10 | ======
11 |
12 | Example01 - Basic window and OpenVG initialization
13 |
14 | Example02 - Rendering of a triangle
15 |
16 | Example03 - Rendering the Khronos tiger
17 |
18 | Example04 - Bitmap font rendering
19 |
20 | Example05 - TTF font rendering using font2openvg output
21 |
--------------------------------------------------------------------------------
/VG_Binaries/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | VG_Binaries
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/VG_Binaries/CourierNew.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/VG_Binaries/CourierNew.tga
--------------------------------------------------------------------------------
/VG_Binaries/README.txt:
--------------------------------------------------------------------------------
1 | OpenVG examples:
2 | ------------------------------
3 |
4 | Important for OpenVG on Windows:
5 |
6 | - Please make sure to copy the DLL of the used OpenVG library to the VG_Binaries folder.
7 |
8 | Further information:
9 |
10 | - README.txt of GLUS
11 |
--------------------------------------------------------------------------------
/VG_Binaries/libOpenVG.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/McNopper/OpenVG/08a1deb64326aa71b9df42e3b62203a8068109b9/VG_Binaries/libOpenVG.dll
--------------------------------------------------------------------------------