1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-22 18:28:52 -05:00

Make tests and examples use glad

This commit is contained in:
Camilla Berglund 2015-10-14 03:11:20 +02:00
parent bf123b5299
commit 1b1ef31228
25 changed files with 84 additions and 11675 deletions

11626
deps/GL/glext.h vendored

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ link_libraries(glfw)
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
add_definitions(-DGLFW_DLL) add_definitions(-DGLFW_DLL)
link_libraries("${OPENGL_gl_LIBRARY}" "${MATH_LIBRARY}") link_libraries("${MATH_LIBRARY}")
else() else()
link_libraries(${glfw_LIBRARIES}) link_libraries(${glfw_LIBRARIES})
endif() endif()
@ -11,10 +11,6 @@ endif()
include_directories("${GLFW_SOURCE_DIR}/include" include_directories("${GLFW_SOURCE_DIR}/include"
"${GLFW_SOURCE_DIR}/deps") "${GLFW_SOURCE_DIR}/deps")
if ("${OPENGL_INCLUDE_DIR}")
include_directories("${OPENGL_INCLUDE_DIR}")
endif()
set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h" set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h"
"${GLFW_SOURCE_DIR}/deps/glad.c") "${GLFW_SOURCE_DIR}/deps/glad.c")
set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
@ -22,13 +18,13 @@ set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
"${GLFW_SOURCE_DIR}/deps/tinycthread.c") "${GLFW_SOURCE_DIR}/deps/tinycthread.c")
add_executable(boing WIN32 MACOSX_BUNDLE boing.c) add_executable(boing WIN32 MACOSX_BUNDLE boing.c ${GLAD})
add_executable(gears WIN32 MACOSX_BUNDLE gears.c) add_executable(gears WIN32 MACOSX_BUNDLE gears.c ${GLAD})
add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${GLAD}) add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${GLAD})
add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${TINYCTHREAD} ${GETOPT}) add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${TINYCTHREAD} ${GETOPT} ${GLAD})
add_executable(simple WIN32 MACOSX_BUNDLE simple.c) add_executable(simple WIN32 MACOSX_BUNDLE simple.c ${GLAD})
add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c) add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${GLAD})
add_executable(wave WIN32 MACOSX_BUNDLE wave.c) add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${GLAD})
target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}") target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}")

View File

@ -36,6 +36,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <linmath.h> #include <linmath.h>
@ -616,6 +617,7 @@ int main( void )
glfwSetCursorPosCallback(window, cursor_position_callback); glfwSetCursorPosCallback(window, cursor_position_callback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval( 1 ); glfwSwapInterval( 1 );
glfwGetFramebufferSize(window, &width, &height); glfwGetFramebufferSize(window, &width, &height);

View File

@ -30,6 +30,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
/** /**
@ -323,6 +325,7 @@ int main(int argc, char *argv[])
glfwSetKeyCallback(window, key); glfwSetKeyCallback(window, key);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval( 1 ); glfwSwapInterval( 1 );
glfwGetFramebufferSize(window, &width, &height); glfwGetFramebufferSize(window, &width, &height);

View File

@ -39,6 +39,7 @@
#include <getopt.h> #include <getopt.h>
#include <linmath.h> #include <linmath.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
// Define tokens for GL_EXT_separate_specular_color if not already defined // Define tokens for GL_EXT_separate_specular_color if not already defined
@ -989,6 +990,7 @@ int main(int argc, char** argv)
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwSetFramebufferSizeCallback(window, resize_callback); glfwSetFramebufferSizeCallback(window, resize_callback);

View File

@ -24,6 +24,7 @@
//======================================================================== //========================================================================
//! [code] //! [code]
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdlib.h> #include <stdlib.h>
@ -57,6 +58,7 @@ int main(void)
} }
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwSetKeyCallback(window, key_callback); glfwSetKeyCallback(window, key_callback);

View File

@ -10,7 +10,7 @@
// because I am not a friend of orthogonal projections) // because I am not a friend of orthogonal projections)
//======================================================================== //========================================================================
#define GLFW_INCLUDE_GLEXT #include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#if defined(_MSC_VER) #if defined(_MSC_VER)
@ -513,14 +513,11 @@ int main(void)
// Enable vsync // Enable vsync
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
if (glfwExtensionSupported("GL_ARB_multisample") || if (GLAD_GL_ARB_multisample || GLAD_GL_VERSION_1_3)
glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR) >= 2 ||
glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR) >= 3)
{
glEnable(GL_MULTISAMPLE_ARB); glEnable(GL_MULTISAMPLE_ARB);
}
glfwGetFramebufferSize(window, &width, &height); glfwGetFramebufferSize(window, &width, &height);
framebufferSizeFun(window, width, height); framebufferSizeFun(window, width, height);

View File

@ -17,6 +17,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <linmath.h> #include <linmath.h>
@ -411,6 +412,7 @@ int main(int argc, char* argv[])
glfwSetScrollCallback(window, scroll_callback); glfwSetScrollCallback(window, scroll_callback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwGetFramebufferSize(window, &width, &height); glfwGetFramebufferSize(window, &width, &height);

View File

@ -3,7 +3,7 @@ link_libraries(glfw)
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
add_definitions(-DGLFW_DLL) add_definitions(-DGLFW_DLL)
link_libraries("${OPENGL_gl_LIBRARY}" "${MATH_LIBRARY}") link_libraries("${MATH_LIBRARY}")
else() else()
link_libraries(${glfw_LIBRARIES}) link_libraries(${glfw_LIBRARIES})
endif() endif()
@ -11,42 +11,40 @@ endif()
include_directories("${GLFW_SOURCE_DIR}/include" include_directories("${GLFW_SOURCE_DIR}/include"
"${GLFW_SOURCE_DIR}/deps") "${GLFW_SOURCE_DIR}/deps")
if ("${OPENGL_INCLUDE_DIR}") set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h"
include_directories("${OPENGL_INCLUDE_DIR}") "${GLFW_SOURCE_DIR}/deps/glad.c")
endif()
set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
"${GLFW_SOURCE_DIR}/deps/getopt.c") "${GLFW_SOURCE_DIR}/deps/getopt.c")
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
"${GLFW_SOURCE_DIR}/deps/tinycthread.c") "${GLFW_SOURCE_DIR}/deps/tinycthread.c")
add_executable(clipboard clipboard.c ${GETOPT}) add_executable(clipboard clipboard.c ${GETOPT} ${GLAD})
add_executable(events events.c ${GETOPT}) add_executable(events events.c ${GETOPT} ${GLAD})
add_executable(msaa msaa.c ${GETOPT}) add_executable(msaa msaa.c ${GETOPT} ${GLAD})
add_executable(gamma gamma.c ${GETOPT}) add_executable(gamma gamma.c ${GETOPT} ${GLAD})
add_executable(glfwinfo glfwinfo.c ${GETOPT}) add_executable(glfwinfo glfwinfo.c ${GETOPT} ${GLAD})
add_executable(iconify iconify.c ${GETOPT}) add_executable(iconify iconify.c ${GETOPT} ${GLAD})
add_executable(joysticks joysticks.c) add_executable(joysticks joysticks.c ${GLAD})
add_executable(monitors monitors.c ${GETOPT}) add_executable(monitors monitors.c ${GETOPT} ${GLAD})
add_executable(reopen reopen.c) add_executable(reopen reopen.c ${GLAD})
add_executable(cursor cursor.c) add_executable(cursor cursor.c ${GLAD})
add_executable(empty WIN32 MACOSX_BUNDLE empty.c ${TINYCTHREAD}) add_executable(empty WIN32 MACOSX_BUNDLE empty.c ${TINYCTHREAD} ${GLAD})
set_target_properties(empty PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Empty Event") set_target_properties(empty PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Empty Event")
add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c) add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${GLAD})
set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing") set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing")
add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GETOPT}) add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GETOPT} ${GLAD})
set_target_properties(tearing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Tearing") set_target_properties(tearing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Tearing")
add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD}) add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD})
set_target_properties(threads PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Threads") set_target_properties(threads PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Threads")
add_executable(title WIN32 MACOSX_BUNDLE title.c) add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD})
set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title") set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title")
add_executable(windows WIN32 MACOSX_BUNDLE windows.c) add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GLAD})
set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows") set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows")
target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}") target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}")

View File

@ -27,6 +27,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -127,6 +128,7 @@ int main(int argc, char** argv)
} }
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwSetKeyCallback(window, key_callback); glfwSetKeyCallback(window, key_callback);

View File

@ -30,6 +30,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#if defined(_MSC_VER) #if defined(_MSC_VER)
@ -237,6 +238,7 @@ int main(void)
} }
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwGetCursorPos(window, &cursor_x, &cursor_y); glfwGetCursorPos(window, &cursor_x, &cursor_y);
printf("Cursor position: %f %f\n", cursor_x, cursor_y); printf("Cursor position: %f %f\n", cursor_x, cursor_y);

View File

@ -29,6 +29,7 @@
#include "tinycthread.h" #include "tinycthread.h"
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <math.h> #include <math.h>
@ -90,6 +91,7 @@ int main(void)
} }
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSetKeyCallback(window, key_callback); glfwSetKeyCallback(window, key_callback);
if (thrd_create(&thread, thread_main, NULL) != thrd_success) if (thrd_create(&thread, thread_main, NULL) != thrd_success)

View File

@ -31,6 +31,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -552,6 +553,7 @@ int main(int argc, char** argv)
glfwSetDropCallback(slots[i].window, drop_callback); glfwSetDropCallback(slots[i].window, drop_callback);
glfwMakeContextCurrent(slots[i].window); glfwMakeContextCurrent(slots[i].window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
} }

View File

@ -28,6 +28,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -153,6 +154,7 @@ int main(int argc, char** argv)
set_gamma(window, 1.f); set_gamma(window, 1.f);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwSetKeyCallback(window, key_callback); glfwSetKeyCallback(window, key_callback);

View File

@ -23,14 +23,9 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
/* HACK: Explicitly include the glext.h shipping with GLFW, as this program uses
* many modern symbols not provided by the versions in some development
* environments (for example on OS X).
*/
#include <GL/glext.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -470,6 +465,7 @@ int main(int argc, char** argv)
} }
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
// Report client API version // Report client API version
@ -500,7 +496,7 @@ int main(int argc, char** argv)
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
printf(" forward-compatible"); printf(" forward-compatible");
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT) if (flags & 2/*GL_CONTEXT_FLAG_DEBUG_BIT*/)
printf(" debug"); printf(" debug");
if (flags & GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB) if (flags & GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB)
printf(" robustness"); printf(" robustness");

View File

@ -28,6 +28,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -149,6 +150,9 @@ static GLFWwindow* create_window(GLFWmonitor* monitor)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
return window; return window;
} }

View File

@ -28,6 +28,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -216,6 +217,7 @@ int main(void)
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
while (!glfwWindowShouldClose(window)) while (!glfwWindowShouldClose(window))

View File

@ -28,6 +28,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -149,6 +150,7 @@ static void test_modes(GLFWmonitor* monitor)
glfwSetKeyCallback(window, key_callback); glfwSetKeyCallback(window, key_callback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwSetTime(0.0); glfwSetTime(0.0);

View File

@ -29,7 +29,7 @@
// //
//======================================================================== //========================================================================
#define GLFW_INCLUDE_GLEXT #include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -110,11 +110,12 @@ int main(int argc, char** argv)
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
if (!glfwExtensionSupported("GL_ARB_multisample")) if (!GLAD_GL_ARB_multisample && !GLAD_GL_VERSION_1_3)
{ {
printf("GL_ARB_multisample extension not supported\n"); printf("Multisampling is not supported\n");
glfwTerminate(); glfwTerminate();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -122,7 +123,7 @@ int main(int argc, char** argv)
glfwShowWindow(window); glfwShowWindow(window);
glGetIntegerv(GL_SAMPLES_ARB, &samples); glGetIntegerv(GL_SAMPLES, &samples);
if (samples) if (samples)
printf("Context reports MSAA is available with %i samples\n", samples); printf("Context reports MSAA is available with %i samples\n", samples);
else else

View File

@ -33,6 +33,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <time.h> #include <time.h>
@ -80,6 +81,7 @@ static GLFWwindow* open_window(int width, int height, GLFWmonitor* monitor)
return NULL; return NULL;
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);

View File

@ -27,6 +27,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -59,6 +60,7 @@ static GLFWwindow* open_window(const char* title, GLFWwindow* share, int posX, i
return NULL; return NULL;
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwSetWindowPos(window, posX, posY); glfwSetWindowPos(window, posX, posY);
glfwShowWindow(window); glfwShowWindow(window);

View File

@ -28,6 +28,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -170,6 +171,7 @@ int main(int argc, char** argv)
} }
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
set_swap_interval(window, 0); set_swap_interval(window, 0);
last_time = glfwGetTime(); last_time = glfwGetTime();

View File

@ -30,6 +30,7 @@
#include "tinycthread.h" #include "tinycthread.h"
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -102,7 +103,14 @@ int main(void)
glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200); glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200);
glfwShowWindow(threads[i].window); glfwShowWindow(threads[i].window);
}
glfwMakeContextCurrent(threads[0].window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwMakeContextCurrent(NULL);
for (i = 0; i < count; i++)
{
if (thrd_create(&threads[i].id, thread_main, threads + i) != if (thrd_create(&threads[i].id, thread_main, threads + i) !=
thrd_success) thrd_success)
{ {

View File

@ -27,6 +27,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -59,6 +60,7 @@ int main(void)
} }
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1); glfwSwapInterval(1);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);

View File

@ -27,6 +27,7 @@
// //
//======================================================================== //========================================================================
#include <glad/glad.h>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <stdio.h> #include <stdio.h>
@ -105,6 +106,7 @@ int main(int argc, char** argv)
glfwSetKeyCallback(windows[i], key_callback); glfwSetKeyCallback(windows[i], key_callback);
glfwMakeContextCurrent(windows[i]); glfwMakeContextCurrent(windows[i]);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glClearColor(colors[i].r, colors[i].g, colors[i].b, 1.f); glClearColor(colors[i].r, colors[i].g, colors[i].b, 1.f);
glfwGetWindowFrameSize(windows[i], &left, &top, &right, &bottom); glfwGetWindowFrameSize(windows[i], &left, &top, &right, &bottom);