Rename OpenGL triangle example to triangle-opengl

This commit is contained in:
Camilla Löwy 2019-05-19 19:46:22 +02:00
parent d44bfe0264
commit a639d6e635
4 changed files with 14 additions and 13 deletions

2
.gitignore vendored
View File

@ -60,7 +60,7 @@ examples/offscreen
examples/particles examples/particles
examples/splitview examples/splitview
examples/sharing examples/sharing
examples/simple examples/triangle-opengl
examples/wave examples/wave
tests/*.app tests/*.app
tests/*.exe tests/*.exe

View File

@ -4,7 +4,7 @@
@tableofcontents @tableofcontents
This guide takes you through writing a simple application using GLFW 3. The This guide takes you through writing a small application using GLFW 3. The
application will create a window and OpenGL context, render a rotating triangle application will create a window and OpenGL context, render a rotating triangle
and exit when the user closes the window or presses _Escape_. This guide will and exit when the user closes the window or presses _Escape_. This guide will
introduce a few of the most commonly used functions, but there are many more. introduce a few of the most commonly used functions, but there are many more.
@ -326,19 +326,20 @@ for example, many kinds of editing tools.
@section quick_example Putting it together @section quick_example Putting it together
Now that you know how to initialize GLFW, create a window and poll for Now that you know how to initialize GLFW, create a window and poll for
keyboard input, it's possible to create a simple program. keyboard input, it's possible to create a small program.
This program creates a 640 by 480 windowed mode window and starts a loop that This program creates a 640 by 480 windowed mode window and starts a loop that
clears the screen, renders a triangle and processes events until the user either clears the screen, renders a triangle and processes events until the user either
presses _Escape_ or closes the window. presses _Escape_ or closes the window.
@snippet simple.c code @snippet triangle-opengl.c code
The program above can be found in the The program above can be found in the
[source package](https://www.glfw.org/download.html) as `examples/simple.c` [source package](https://www.glfw.org/download.html) as
and is compiled along with all other examples when you build GLFW. If you `examples/triangle-opengl.c` and is compiled along with all other examples when
built GLFW from the source package then already have this as `simple.exe` on you build GLFW. If you built GLFW from the source package then already have
Windows, `simple` on Linux or `simple.app` on macOS. this as `triangle-opengl.exe` on Windows, `triangle-opengl` on Linux or
`triangle-opengl.app` on macOS.
This tutorial used only a few of the many functions GLFW provides. There are This tutorial used only a few of the many functions GLFW provides. There are
guides for each of the areas covered by GLFW. Each guide will introduce all the guides for each of the areas covered by GLFW. Each guide will introduce all the

View File

@ -36,8 +36,8 @@ add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${ICON} ${GLAD_GL})
add_executable(offscreen offscreen.c ${ICON} ${GLAD_GL}) add_executable(offscreen offscreen.c ${ICON} ${GLAD_GL})
add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD_GL}) add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD_GL})
add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${ICON} ${GLAD_GL}) add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${ICON} ${GLAD_GL})
add_executable(simple WIN32 MACOSX_BUNDLE simple.c ${ICON} ${GLAD_GL})
add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD_GL}) add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD_GL})
add_executable(triangle-opengl WIN32 MACOSX_BUNDLE triangle-opengl.c ${ICON} ${GLAD_GL})
add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD_GL}) add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD_GL})
target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}") target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}")
@ -45,7 +45,7 @@ if (RT_LIBRARY)
target_link_libraries(particles "${RT_LIBRARY}") target_link_libraries(particles "${RT_LIBRARY}")
endif() endif()
set(WINDOWS_BINARIES boing gears heightmap particles sharing simple splitview wave) set(WINDOWS_BINARIES boing gears heightmap particles sharing splitview triangle-opengl wave)
set(CONSOLE_BINARIES offscreen) set(CONSOLE_BINARIES offscreen)
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
@ -63,7 +63,7 @@ if (APPLE)
set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap") set_target_properties(heightmap PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Heightmap")
set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles") set_target_properties(particles PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Particles")
set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing") set_target_properties(sharing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Sharing")
set_target_properties(simple PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Simple") set_target_properties(triangle-opengl PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "OpenGL Triangle")
set_target_properties(splitview PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "SplitView") set_target_properties(splitview PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "SplitView")
set_target_properties(wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave") set_target_properties(wave PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Wave")

View File

@ -1,5 +1,5 @@
//======================================================================== //========================================================================
// Simple GLFW example // OpenGL triangle example
// Copyright (c) Camilla Löwy <elmindreda@glfw.org> // Copyright (c) Camilla Löwy <elmindreda@glfw.org>
// //
// This software is provided 'as-is', without any express or implied // This software is provided 'as-is', without any express or implied
@ -87,7 +87,7 @@ int main(void)
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
GLFWwindow* window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL); GLFWwindow* window = glfwCreateWindow(640, 480, "OpenGL Triangle", NULL, NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();