We use glXGetProcAddress to load glXCreateContextAttribsARB ourselves,
so GLX_GLXEXT_PROTOTYPES is not needed.
... | ... |
@@ -5,15 +5,16 @@ |
5 | 5 |
extern "C" { |
6 | 6 |
#endif |
7 | 7 |
|
8 |
-#ifdef __APPLE__ |
|
8 |
+#if defined(__APPLE__) |
|
9 | 9 |
#define GL_SILENCE_DEPRECATION |
10 | 10 |
#include <OpenGL/gl3.h> |
11 |
+#elif defined(_WIN32) |
|
12 |
+ #include "glew.h" |
|
11 | 13 |
#else |
12 |
- #if defined(_WIN32) |
|
13 |
- #include "glew.h" |
|
14 |
- #endif |
|
14 |
+ #define GL_GLEXT_PROTOTYPES |
|
15 | 15 |
#include <GL/gl.h> |
16 | 16 |
#endif |
17 |
+ |
|
17 | 18 |
#include <stdio.h> |
18 | 19 |
#include <stdlib.h> |
19 | 20 |
#include <string.h> |
find . -type f -exec chmod -x {} +
Robert Cranston authored on 27/02/2024 02:27:271 | 1 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,74 @@ |
1 |
+#ifndef __TGA_LOADER__ |
|
2 |
+#define __TGA_LOADER__ |
|
3 |
+ |
|
4 |
+#ifdef __cplusplus |
|
5 |
+extern "C" { |
|
6 |
+#endif |
|
7 |
+ |
|
8 |
+#ifdef __APPLE__ |
|
9 |
+ #define GL_SILENCE_DEPRECATION |
|
10 |
+ #include <OpenGL/gl3.h> |
|
11 |
+#else |
|
12 |
+ #if defined(_WIN32) |
|
13 |
+ #include "glew.h" |
|
14 |
+ #endif |
|
15 |
+ #include <GL/gl.h> |
|
16 |
+#endif |
|
17 |
+#include <stdio.h> |
|
18 |
+#include <stdlib.h> |
|
19 |
+#include <string.h> |
|
20 |
+ |
|
21 |
+#ifndef __cplusplus |
|
22 |
+ #ifndef true |
|
23 |
+ #define true 1 |
|
24 |
+ #endif |
|
25 |
+ |
|
26 |
+ #ifndef false |
|
27 |
+ #define false 0 |
|
28 |
+ #endif |
|
29 |
+ |
|
30 |
+ #ifndef bool |
|
31 |
+ #define bool char |
|
32 |
+ #endif |
|
33 |
+#endif |
|
34 |
+ |
|
35 |
+typedef struct TextureData // Create A Structure for .tga loading. |
|
36 |
+{ |
|
37 |
+ GLubyte *imageData; // Image Data (Up To 32 Bits) |
|
38 |
+ GLuint bpp; // Image Color Depth In Bits Per Pixel. |
|
39 |
+ GLuint width; // Image Width |
|
40 |
+ GLuint height; // Image Height |
|
41 |
+ GLuint w; // Image Width "raw" |
|
42 |
+ GLuint h; // Image Height "raw" |
|
43 |
+ GLuint texID; // Texture ID Used To Select A Texture |
|
44 |
+ GLfloat texWidth, texHeight; |
|
45 |
+} TextureData, *TextureDataPtr; // Structure Name |
|
46 |
+ |
|
47 |
+bool LoadTGATexture(const char *filename, TextureData *texture); |
|
48 |
+void LoadTGATextureSimple(const char *filename, GLuint *tex); |
|
49 |
+void LoadTGASetMipmapping(bool active); |
|
50 |
+bool LoadTGATextureData(const char *filename, TextureData *texture); |
|
51 |
+ |
|
52 |
+// Constants for SaveTGA |
|
53 |
+#define TGA_ERROR_FILE_OPEN -5 |
|
54 |
+#define TGA_ERROR_READING_FILE -4 |
|
55 |
+#define TGA_ERROR_INDEXED_COLOR -3 |
|
56 |
+#define TGA_ERROR_MEMORY -2 |
|
57 |
+#define TGA_ERROR_COMPRESSED_FILE -1 |
|
58 |
+#define TGA_OK 0 |
|
59 |
+ |
|
60 |
+// Save functions |
|
61 |
+int SaveDataToTGA(char *filename, |
|
62 |
+ short int width, |
|
63 |
+ short int height, |
|
64 |
+ unsigned char pixelDepth, |
|
65 |
+ unsigned char *imageData); |
|
66 |
+void SaveTGA(TextureData *tex, char *filename); |
|
67 |
+void SaveFramebufferToTGA(char *filename, GLint x, GLint y, GLint w, GLint h); |
|
68 |
+ |
|
69 |
+#ifdef __cplusplus |
|
70 |
+} |
|
71 |
+#endif |
|
72 |
+ |
|
73 |
+#endif |
|
74 |
+ |