GLFW,GLEW & Visual Studio 2015 (C++)

  • Stap 1: Download
    • GLFW – v3.2.1  – x86 en x64
    • GLEW – v2.0.0 – x86
  • Stap 2: Unzip na n folder wat vir jou sin maak, verkieslik iets wat op verskillende rekenaars sal werk, so nie in documents wat afhangend van die “user” is nie. Bv.  C:\Users\XXXX\Documents\Visual Studio 2015\ gaan nie werk op alle rekenaars nie.
  • Stap 3: Run VS 2015 en maak n nuwe projek:screen-shot-02-13-17-at-04-05-pm
  • Stap 4: Voeg main.cpp file by

screen-shot-02-13-17-at-04-13-pm

  • Stap 5: Sluit al die “include” folders in van GLFW en GLEW

screen-shot-02-13-17-at-04-16-pm

  • Stap 6: Koppel al die eksterne header (.h) leêrs in die projek

screen-shot-02-13-17-at-04-25-pm

  • Stap 7: Verwys na GFLW en GLEW se .lib files

screen-shot-02-13-17-at-04-25-pm-001

  • Stap 8: Voeg GFLW en GLEW se .lib leêrs by

screen-shot-02-13-17-at-04-26-pm

  • Stap 9: Voeg die externe afhanklikes by

screen-shot-02-13-17-at-04-28-pm

  • Stap 10: Maak seker om al die ekstra afhanklikes by te voeg

screen-shot-02-13-17-at-04-28-pm-001

  • Stap 11: C++ kode om te GLFW en GLEW te toets:

#include <GLFW/glfw3.h>

int main(void)
{
GLFWwindow* window;

/* Initialize the library */
if (!glfwInit())
return -1;

/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, “Hello World”, NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}

/* Make the window’s context current */
glfwMakeContextCurrent(window);

/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);

/* Swap front and back buffers */
glfwSwapBuffers(window);

/* Poll for and process events */
glfwPollEvents();
}

glfwTerminate();
return 0;
}

 

  • Resultaat:

ScreenShot235.png

 

 

 

 

0 thoughts on “GLFW,GLEW & Visual Studio 2015 (C++)”

  1. ek is nie 100% seker wat al GLEW se vermoëns is nie, maar het dit opgetel in n paar tutoriale en dink dit is vir makliker keyboard handling ens. en orals waar ek gelees het, se hulle dit vergemaklik “modern OpenGL” hantering en sluit n paar nuwe kenmerke in om dinge te doen met “modern OpenGL”.

Leave a Reply