• entries
24
20
• views
2653

# Flowchart for Empty GLFW Window

1108 views

This example just create a window and clear a canvas with color. Tools: VS2015, GLFW, OpenGL, C++. All libraries are included in the project. You can just download and run it. But you need to set your Visual Studio version in the project settings, Platform Toolset, see the screenshot below:

Spoiler

Visual Studio Project: EmptyWindow_GlfwOpenGL31Cpp.zip

main.cpp

Spoiler

#include <GLFW/glfw3.h>

// Create a window with GLFW library
int main()
{
// Initialization
glfwInit();                     // Initialize the GLFW library
// Create a window
GLFWwindow *window = glfwCreateWindow(256, 256, "Empty Window", nullptr, nullptr);
glfwMakeContextCurrent(window); // Create OpenGL context for drawing

glClearColor(0.2f, 0.3f, 0.3f, 1.0f); // Set a color for clearing a canvas

// Main Loop of Application
// Should the window be closed?
while (!glfwWindowShouldClose(window))
{
// Check if any events have been activated
// (key pressed, mouse moved etc.) and call
// corresponding response functions
glfwPollEvents();

glClear(GL_COLOR_BUFFER_BIT);   // Clear canvas with previously specified color
glfwSwapBuffers(window);        // Swap the front and back buffers when rendering
}

// Clean up resources
// Clean up GLFW Library Resources
glfwTerminate();

return 0;
}

DRAKON-flowchart Sandbox

Spoiler

If you do not know what is DRAKON-flowchart, you can watch this short video that I found in Youtube:

Spoiler

Really cool, thanks for sharing. I'll look into DRAKON-flowchart to play around in it.

Thank you for your feedback. Yes, this tool is amazing. I like it so much. I want to apply this tool for game development. I think it is very good alternative for standard flowcharts.

I added the "main.cpp" code in my entry and I added the "Clean up GLFW Library Resources" Action icon in the "Clean up resources" branch of DRAKON-flowchart. Check above.

Posted (edited)

oh for sure...this guys got it.  Around the VisualStudio2013 era, this is exactly where I lived. This setup right here. (oglcore 3.3) Loved it. Now...the grass is not always greener. I know you would be better at this 8Observer8, dear sir...what I noticed was there seemed to be some drag in the glfw loop that I couldn't identify and my other sadness was input lag. I think timing was fine. I eventually moved to try custom / native / handle it yourself types and such, finding in some cases, you could do it better. What I'd be interested in is a comparable timing test of this against raw api creation / message handling. I think the extra layer costs some. Any way to try that?

###### looking for one last half-life3 confirmed...

Ah, a blog todo list...just noticed. <slaps head> and yes, the flow chart is very pretty.

Edited by GoliathForge

## Create an account

Register a new account

• ### Similar Content

• Hello everyone,
About a month ago I finished programming the lighting (or at least it is what I thought), because a few hours ago I realized that when I translate the object, the lighting breaks (not when rotating, because I multiply the normals by the transpose of the inverse of the modelMatrix), only if I move the object from the 0,0,0.
I only have one light, a directional one.
Here the rock is at 0,0,0.
T

Here the rock is at -10,0,0.

I only moved it to the left, and as you can see looks like the normals are wrong, but I do not touch them, except when I multiply them by the transpose of the inverse of the modelMatrix (if I do not multply the normals by that matrix the lighting doesnt break but when the object rotates the light rotates with it). So, is there a way to have the normals well for translating and rotating?

Now I can translate the object and the lighting doesnt brake, but if I rotate it the light rotates with it.

Now I can rotate it but if I move it the lighting breaks.

Thanks a lot!!

• I'm currently using Direct  X 11 for my procedural world/MMO project.  I've tried to find a freeish game engine or simply graphics engine that supports 64 bit coordinates (CPU side), but apparently there is no such animal.  Right now my investment in Direct X is very small as the vast majorly of the code is straight C++ and the graphics is isolated into an interface class. However now I'm going get more into the GPU stuff and I was wondering if it would be better to switch to something else that would give the program better portability.  I was leaning towards Vulkan for no other reason than it seems to be all the rage (ha, ha), but I wanted to get some opinions from folks with more GPU programming experience.
• By Josheir
I am trying to visualize if the attached diagram of data of triangles is correct for the attached hill image.  I used a nested for loop to find all triangles with any vertices having a height greater than zero.  The two triangles marked with an X surprisingly have no height values and the shape of the triangles is odd to me.  The triangles marked with A are left triangles and the triangles marked with B are right triangles.  The rendering was done in OpenGL with C++, and the X coordinates and  Z coordinates are by convention.
The one point with a height is shown here:

void addHillsManually() { heightMapFromArray[20][20] = .5; } Thank you,
Josheir

• By Jernej.L
I've attached a timing graph. the "debug" spikes are actual swapBuffers calls measured with hires performance timers, red line is "whole" 1 single frame time.

I cannot seem to be able to solve this mistery, so what would cause stutter / spikes when calling swapbuffers? This is on windows 10, amd gpu and all drivers installed correctly, i will greatly appreciate any kind of help.

• I am trying to make an OpenGL remake of some of the tricks that were used in the Goldeneye game from 1997 for the Nintendo 64.
I have a SGI computer to give myself the full programming experience and a C compiler for the code.

My only issue left, besides the game itself, is the issue with getting GLUT to work on the computer.

I get an error that has to do with the -n32 and -o32 not being able to work together in the compiling.

I have both the MipsPro compiler and the GCC compiler, and none of these work with GLUT.
I can get OpenGL code working, but I have to use the crappy X11 library that nobody uses unless you are going to use Linux as a main computer (which not many people really do).

I have all of the applications that I will need for editing and 3d modelling, but the last thing that I will need is for GLUT to start working so that I can begin the project without having to deal with the impediments of using the X11 library.

Why am I using an SGI computer?

It is for the SGI Indy community (nekochan) and the discord that I set up that includes me and some other dude trying to make a Nintendo 64 library with MIPS assembly.

As you may know, I cannot use the Nintendo 64 SDK because it is illegal and I can be put in federal prison for using it and sued for 2 million dollars.

How can I fix this? Nobody on the SGI computer discord will help me, so this is the next place I went to.