I have :
#include <GL/freeglut.h>
#include <stdio.h>
static void RenderSceneCB()
{
static GLclampf c = 0.0f;
glClearColor (c,c,c,c);
printf("%f/n",c);
c += 1.0f/256.0f;
if (c>=1.0f) {
c = 0.0f;
}
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
}
static void InitializeGlutCallbacks()
{
glutDisplayFunc(RenderSceneCB);
}
int main(int argc, char** argv)
{
void (*RenderSceneCB)();
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA );
int width = 1920;
int height = 1080;
glutInitWindowSize(width,height);
int x = 200;
int y = 100;
glutInitWindowPosition(x,y);
int win = glutCreateWindow("Tutorial01");
printf("window id: %d/n",win);
GLclampf Red = 0.0f, Green = 0.0f, Blue = 0.0f, Alpha = 0.0f;
glClearColor (Red,Green,Blue,Alpha);
glutDisplayFunc(RenderSceneCB);
glutMainLoop();
return 0;
}
from the video at https://ogldev.org/www/tut`Preformatted text`orial01/tutorial01.html
I compiled with:
#! /bin/bash
CC=g++
LDFLAGS=`pkg-config --libs glew`
LDFLAGS="$LDFLAGS -lglut"
$CC tutorial01.cpp $LDFLAGS -o tutorial01
can anyone tell me why the segfault is happening and how to stop it?
Thanks.