How to setup shaders in openGLOpenGL - vertex normals in OBJHow do I iterate over the words of a string?How does vertex shader pass color information to fragment shader?OpenGL ignoring ShadersJoining more shaders (sources) to a programCan't link shaders to program object in OpenGL, can't debugopengl - unique color for each triangleOpenGL: Defining variables in shadersGL_DEPTH_TEST not work in glsl shaderOpenGL 3.0 GLSL 130 fragment shader compile errorOpenGL z value. Why negative value in front?

How to approach protecting my code as a research assistant? Should I be worried in the first place?

Is there such thing as a "3-dimensional surface?"

12V lead acid charger with LM317 not charging

Will a paper be retracted if a flaw in released software code invalidates its central idea?

monolingual dictionary

Why do dragons like shiny stuff?

How to switch an 80286 from protected to real mode?

Why do private jets such as Gulfstream fly higher than other civilian jets?

Does the Voyager team use a wrapper (Fortran(77?) to Python) to transmit current commands?

Is it a bad idea to offer variants of a final exam based on the type of allowed calculators?

Secure my password from unsafe servers

is it possible to terraform a planet made of human excrement into habitable planet?

Can ads on a page read my password?

Where to pee in London?

What city skyline is this picture of?

Differentiability of operator norm

Why does putting a dot after the URL remove login information?

Getting an entry level IT position later in life

Does this put me at risk for identity theft?

How do these cubesats' whip antennas work?

What is the German idiom or expression for when someone is being hypocritical against their own teachings?

Is there a difference between 「目を覚ます」 and 「目覚める」

Can a Hogwarts student refuse the Sorting Hat's decision?

Does a 4 bladed prop have almost twice the thrust of a 2 bladed prop?



How to setup shaders in openGL


OpenGL - vertex normals in OBJHow do I iterate over the words of a string?How does vertex shader pass color information to fragment shader?OpenGL ignoring ShadersJoining more shaders (sources) to a programCan't link shaders to program object in OpenGL, can't debugopengl - unique color for each triangleOpenGL: Defining variables in shadersGL_DEPTH_TEST not work in glsl shaderOpenGL 3.0 GLSL 130 fragment shader compile errorOpenGL z value. Why negative value in front?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm working on developing code in OpenGL, and I was completing one of the tutorials for a lesson. However, the code that I completed did not color the triangle. Based off of the tutorial, my triangle should come out as green, but it keeps turning out white. I think there is an error in the code for my shaders, but I can't seem to find the error.



I tried altering the code a few times, and I even moved on to the next tutorial, which shades each vertex. However, my triangle is still coming out as white.



#include <iostream> //Includes C++ i/o stream
#include <GL/glew.h> //Includes glew header
#include <GL/freeglut.h> //Includes freeglut header

using namespace std; //Uses the standard namespace

#define WINDOW_TITLE "Modern OpenGL" //Macro for window title

//Vertex and Fragment Shader Source Macro
#ifndef GLSL
#define GLSL(Version, Source) "#version " #Version "n" #Source
#endif

//Variables for window width and height
int WindowWidth = 800, WindowHeight = 600;

/* User-defined Function prototypes to:
* initialize the program, set the window size,
* redraw graphics on the window when resized,
* and render graphics on the screen
* */
void UInitialize(int, char*[]);
void UInitWindow(int, char*[]);
void UResizeWindow(int, int);
void URenderGraphics(void);
void UCreateVBO(void); //This step is missing from Tutorial 3-3
void UCreateShaders(void);

/*Vertex Shader Program Source Code*/
const GLchar * VertexShader = GLSL(440,
in layout(location=0) vec4 vertex_Position; //Receive vertex coordinates from attribute 0. i.e. 2
void main()
gl_Position = vertex_Position; //Sends vertex positions to gl_position vec 4

);

/*Fragment Shader Program Source Code*/
const GLchar * FragmentShader = GLSL(440,
void main()
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); //Sets the pixels / fragments of the triangle to green

);

//main function. Entry point to the OpenGL Program
int main(int argc, char* argv[])

UInitialize(argc, argv); //Initialize the OpenGL program
glutMainLoop(); // Starts the Open GL loop in the background
exit(EXIT_SUCCESS); //Terminates the program successfully



//Implements the UInitialize function
void UInitialize(int argc, char* argv[])

//glew status variable
GLenum GlewInitResult;

UInitWindow(argc, argv); //Creates the window

//Checks glew status
GlewInitResult = glewInit();

if(GLEW_OK != GlewInitResult)

fprintf(stderr, "Error: %sn", glewGetErrorString(GlewInitResult));
exit(EXIT_FAILURE);


//Displays GPU OpenGL version
fprintf(stdout, "INFO: OpenGL Version: %sn", glGetString(GL_VERSION));

UCreateVBO(); //Calls the function to create the Vertex Buffer Object

UCreateShaders(); //Calls the function to create the Shader Program

//Sets the background color of the window to black. Optional
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);



//Implements the UInitWindow function
void UInitWindow(int argc, char* argv[])
GLUT_RGBA);

//Creates a window with the macro placeholder title
glutCreateWindow(WINDOW_TITLE);

glutReshapeFunc(UResizeWindow); //Called when the window is resized
glutDisplayFunc(URenderGraphics); //Renders graphics on the screen



//Implements the UResizeWindow function
void UResizeWindow(int Width, int Height)

glViewport(0,0, Width, Height);


//Implements the URenderGraphics function
void URenderGraphics(void)
GL_DEPTH_BUFFER_BIT); //Clears the screen

/*Creates the triangle*/
GLuint totalVertices = 3; //Specifies the number of vertices for the triangle i.e. 3
glDrawArrays(GL_TRIANGLES, 0, totalVertices); //Draws the triangle

glutSwapBuffers(); //Flips the back buffer with the front buffer every frame. Similar to GL Flush



//Implements the CreateVBO function
void UCreateVBO(void)
0 offset
*/
glVertexAttribPointer(0, floatsPerVertex, GL_FLOAT, GL_FALSE, 0, 0);


//Implements the UCreateShaders function
void UCreateShaders(void)

//Create a shader program object
GLuint ProgramId = glCreateProgram();

GLuint vertexShaderId = glCreateShader(GL_VERTEX_SHADER); //Create a Vertex Shader Object
GLuint fragmentShaderId = glCreateShader(GL_FRAGMENT_SHADER); //Create a Fragment Shader Object

glShaderSource(vertexShaderId, 1, &VertexShader, NULL); //Retrieves the vertex shader source code
glShaderSource(fragmentShaderId, 1, &FragmentShader, NULL); //Retrieves the fragment shader source code

glCompileShader(vertexShaderId); //Compile the vertex shader
glCompileShader(fragmentShaderId); //Compile the fragment shader

//Attaches the vertex and fragment shaders to the shader program
glAttachShader(ProgramId, vertexShaderId);
glAttachShader(ProgramId, fragmentShaderId);

glLinkProgram(ProgramId); //Links the shader program
glUseProgram(ProgramId); //Uses the shader program



When completed correctly, the code should result in a solid green triangle.










share|improve this question



















  • 1





    "Vertex and Fragment Shader Source Macro" Please don't use macros like this. We have raw string literals now.

    – Nicol Bolas
    Mar 27 at 4:40











  • see complete GL+GLSL+VAO/VBO C++ example ... especially the GLSL logs usage there ...

    – Spektre
    Mar 27 at 8:31

















0















I'm working on developing code in OpenGL, and I was completing one of the tutorials for a lesson. However, the code that I completed did not color the triangle. Based off of the tutorial, my triangle should come out as green, but it keeps turning out white. I think there is an error in the code for my shaders, but I can't seem to find the error.



I tried altering the code a few times, and I even moved on to the next tutorial, which shades each vertex. However, my triangle is still coming out as white.



#include <iostream> //Includes C++ i/o stream
#include <GL/glew.h> //Includes glew header
#include <GL/freeglut.h> //Includes freeglut header

using namespace std; //Uses the standard namespace

#define WINDOW_TITLE "Modern OpenGL" //Macro for window title

//Vertex and Fragment Shader Source Macro
#ifndef GLSL
#define GLSL(Version, Source) "#version " #Version "n" #Source
#endif

//Variables for window width and height
int WindowWidth = 800, WindowHeight = 600;

/* User-defined Function prototypes to:
* initialize the program, set the window size,
* redraw graphics on the window when resized,
* and render graphics on the screen
* */
void UInitialize(int, char*[]);
void UInitWindow(int, char*[]);
void UResizeWindow(int, int);
void URenderGraphics(void);
void UCreateVBO(void); //This step is missing from Tutorial 3-3
void UCreateShaders(void);

/*Vertex Shader Program Source Code*/
const GLchar * VertexShader = GLSL(440,
in layout(location=0) vec4 vertex_Position; //Receive vertex coordinates from attribute 0. i.e. 2
void main()
gl_Position = vertex_Position; //Sends vertex positions to gl_position vec 4

);

/*Fragment Shader Program Source Code*/
const GLchar * FragmentShader = GLSL(440,
void main()
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); //Sets the pixels / fragments of the triangle to green

);

//main function. Entry point to the OpenGL Program
int main(int argc, char* argv[])

UInitialize(argc, argv); //Initialize the OpenGL program
glutMainLoop(); // Starts the Open GL loop in the background
exit(EXIT_SUCCESS); //Terminates the program successfully



//Implements the UInitialize function
void UInitialize(int argc, char* argv[])

//glew status variable
GLenum GlewInitResult;

UInitWindow(argc, argv); //Creates the window

//Checks glew status
GlewInitResult = glewInit();

if(GLEW_OK != GlewInitResult)

fprintf(stderr, "Error: %sn", glewGetErrorString(GlewInitResult));
exit(EXIT_FAILURE);


//Displays GPU OpenGL version
fprintf(stdout, "INFO: OpenGL Version: %sn", glGetString(GL_VERSION));

UCreateVBO(); //Calls the function to create the Vertex Buffer Object

UCreateShaders(); //Calls the function to create the Shader Program

//Sets the background color of the window to black. Optional
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);



//Implements the UInitWindow function
void UInitWindow(int argc, char* argv[])
GLUT_RGBA);

//Creates a window with the macro placeholder title
glutCreateWindow(WINDOW_TITLE);

glutReshapeFunc(UResizeWindow); //Called when the window is resized
glutDisplayFunc(URenderGraphics); //Renders graphics on the screen



//Implements the UResizeWindow function
void UResizeWindow(int Width, int Height)

glViewport(0,0, Width, Height);


//Implements the URenderGraphics function
void URenderGraphics(void)
GL_DEPTH_BUFFER_BIT); //Clears the screen

/*Creates the triangle*/
GLuint totalVertices = 3; //Specifies the number of vertices for the triangle i.e. 3
glDrawArrays(GL_TRIANGLES, 0, totalVertices); //Draws the triangle

glutSwapBuffers(); //Flips the back buffer with the front buffer every frame. Similar to GL Flush



//Implements the CreateVBO function
void UCreateVBO(void)
0 offset
*/
glVertexAttribPointer(0, floatsPerVertex, GL_FLOAT, GL_FALSE, 0, 0);


//Implements the UCreateShaders function
void UCreateShaders(void)

//Create a shader program object
GLuint ProgramId = glCreateProgram();

GLuint vertexShaderId = glCreateShader(GL_VERTEX_SHADER); //Create a Vertex Shader Object
GLuint fragmentShaderId = glCreateShader(GL_FRAGMENT_SHADER); //Create a Fragment Shader Object

glShaderSource(vertexShaderId, 1, &VertexShader, NULL); //Retrieves the vertex shader source code
glShaderSource(fragmentShaderId, 1, &FragmentShader, NULL); //Retrieves the fragment shader source code

glCompileShader(vertexShaderId); //Compile the vertex shader
glCompileShader(fragmentShaderId); //Compile the fragment shader

//Attaches the vertex and fragment shaders to the shader program
glAttachShader(ProgramId, vertexShaderId);
glAttachShader(ProgramId, fragmentShaderId);

glLinkProgram(ProgramId); //Links the shader program
glUseProgram(ProgramId); //Uses the shader program



When completed correctly, the code should result in a solid green triangle.










share|improve this question



















  • 1





    "Vertex and Fragment Shader Source Macro" Please don't use macros like this. We have raw string literals now.

    – Nicol Bolas
    Mar 27 at 4:40











  • see complete GL+GLSL+VAO/VBO C++ example ... especially the GLSL logs usage there ...

    – Spektre
    Mar 27 at 8:31













0












0








0








I'm working on developing code in OpenGL, and I was completing one of the tutorials for a lesson. However, the code that I completed did not color the triangle. Based off of the tutorial, my triangle should come out as green, but it keeps turning out white. I think there is an error in the code for my shaders, but I can't seem to find the error.



I tried altering the code a few times, and I even moved on to the next tutorial, which shades each vertex. However, my triangle is still coming out as white.



#include <iostream> //Includes C++ i/o stream
#include <GL/glew.h> //Includes glew header
#include <GL/freeglut.h> //Includes freeglut header

using namespace std; //Uses the standard namespace

#define WINDOW_TITLE "Modern OpenGL" //Macro for window title

//Vertex and Fragment Shader Source Macro
#ifndef GLSL
#define GLSL(Version, Source) "#version " #Version "n" #Source
#endif

//Variables for window width and height
int WindowWidth = 800, WindowHeight = 600;

/* User-defined Function prototypes to:
* initialize the program, set the window size,
* redraw graphics on the window when resized,
* and render graphics on the screen
* */
void UInitialize(int, char*[]);
void UInitWindow(int, char*[]);
void UResizeWindow(int, int);
void URenderGraphics(void);
void UCreateVBO(void); //This step is missing from Tutorial 3-3
void UCreateShaders(void);

/*Vertex Shader Program Source Code*/
const GLchar * VertexShader = GLSL(440,
in layout(location=0) vec4 vertex_Position; //Receive vertex coordinates from attribute 0. i.e. 2
void main()
gl_Position = vertex_Position; //Sends vertex positions to gl_position vec 4

);

/*Fragment Shader Program Source Code*/
const GLchar * FragmentShader = GLSL(440,
void main()
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); //Sets the pixels / fragments of the triangle to green

);

//main function. Entry point to the OpenGL Program
int main(int argc, char* argv[])

UInitialize(argc, argv); //Initialize the OpenGL program
glutMainLoop(); // Starts the Open GL loop in the background
exit(EXIT_SUCCESS); //Terminates the program successfully



//Implements the UInitialize function
void UInitialize(int argc, char* argv[])

//glew status variable
GLenum GlewInitResult;

UInitWindow(argc, argv); //Creates the window

//Checks glew status
GlewInitResult = glewInit();

if(GLEW_OK != GlewInitResult)

fprintf(stderr, "Error: %sn", glewGetErrorString(GlewInitResult));
exit(EXIT_FAILURE);


//Displays GPU OpenGL version
fprintf(stdout, "INFO: OpenGL Version: %sn", glGetString(GL_VERSION));

UCreateVBO(); //Calls the function to create the Vertex Buffer Object

UCreateShaders(); //Calls the function to create the Shader Program

//Sets the background color of the window to black. Optional
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);



//Implements the UInitWindow function
void UInitWindow(int argc, char* argv[])
GLUT_RGBA);

//Creates a window with the macro placeholder title
glutCreateWindow(WINDOW_TITLE);

glutReshapeFunc(UResizeWindow); //Called when the window is resized
glutDisplayFunc(URenderGraphics); //Renders graphics on the screen



//Implements the UResizeWindow function
void UResizeWindow(int Width, int Height)

glViewport(0,0, Width, Height);


//Implements the URenderGraphics function
void URenderGraphics(void)
GL_DEPTH_BUFFER_BIT); //Clears the screen

/*Creates the triangle*/
GLuint totalVertices = 3; //Specifies the number of vertices for the triangle i.e. 3
glDrawArrays(GL_TRIANGLES, 0, totalVertices); //Draws the triangle

glutSwapBuffers(); //Flips the back buffer with the front buffer every frame. Similar to GL Flush



//Implements the CreateVBO function
void UCreateVBO(void)
0 offset
*/
glVertexAttribPointer(0, floatsPerVertex, GL_FLOAT, GL_FALSE, 0, 0);


//Implements the UCreateShaders function
void UCreateShaders(void)

//Create a shader program object
GLuint ProgramId = glCreateProgram();

GLuint vertexShaderId = glCreateShader(GL_VERTEX_SHADER); //Create a Vertex Shader Object
GLuint fragmentShaderId = glCreateShader(GL_FRAGMENT_SHADER); //Create a Fragment Shader Object

glShaderSource(vertexShaderId, 1, &VertexShader, NULL); //Retrieves the vertex shader source code
glShaderSource(fragmentShaderId, 1, &FragmentShader, NULL); //Retrieves the fragment shader source code

glCompileShader(vertexShaderId); //Compile the vertex shader
glCompileShader(fragmentShaderId); //Compile the fragment shader

//Attaches the vertex and fragment shaders to the shader program
glAttachShader(ProgramId, vertexShaderId);
glAttachShader(ProgramId, fragmentShaderId);

glLinkProgram(ProgramId); //Links the shader program
glUseProgram(ProgramId); //Uses the shader program



When completed correctly, the code should result in a solid green triangle.










share|improve this question














I'm working on developing code in OpenGL, and I was completing one of the tutorials for a lesson. However, the code that I completed did not color the triangle. Based off of the tutorial, my triangle should come out as green, but it keeps turning out white. I think there is an error in the code for my shaders, but I can't seem to find the error.



I tried altering the code a few times, and I even moved on to the next tutorial, which shades each vertex. However, my triangle is still coming out as white.



#include <iostream> //Includes C++ i/o stream
#include <GL/glew.h> //Includes glew header
#include <GL/freeglut.h> //Includes freeglut header

using namespace std; //Uses the standard namespace

#define WINDOW_TITLE "Modern OpenGL" //Macro for window title

//Vertex and Fragment Shader Source Macro
#ifndef GLSL
#define GLSL(Version, Source) "#version " #Version "n" #Source
#endif

//Variables for window width and height
int WindowWidth = 800, WindowHeight = 600;

/* User-defined Function prototypes to:
* initialize the program, set the window size,
* redraw graphics on the window when resized,
* and render graphics on the screen
* */
void UInitialize(int, char*[]);
void UInitWindow(int, char*[]);
void UResizeWindow(int, int);
void URenderGraphics(void);
void UCreateVBO(void); //This step is missing from Tutorial 3-3
void UCreateShaders(void);

/*Vertex Shader Program Source Code*/
const GLchar * VertexShader = GLSL(440,
in layout(location=0) vec4 vertex_Position; //Receive vertex coordinates from attribute 0. i.e. 2
void main()
gl_Position = vertex_Position; //Sends vertex positions to gl_position vec 4

);

/*Fragment Shader Program Source Code*/
const GLchar * FragmentShader = GLSL(440,
void main()
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); //Sets the pixels / fragments of the triangle to green

);

//main function. Entry point to the OpenGL Program
int main(int argc, char* argv[])

UInitialize(argc, argv); //Initialize the OpenGL program
glutMainLoop(); // Starts the Open GL loop in the background
exit(EXIT_SUCCESS); //Terminates the program successfully



//Implements the UInitialize function
void UInitialize(int argc, char* argv[])

//glew status variable
GLenum GlewInitResult;

UInitWindow(argc, argv); //Creates the window

//Checks glew status
GlewInitResult = glewInit();

if(GLEW_OK != GlewInitResult)

fprintf(stderr, "Error: %sn", glewGetErrorString(GlewInitResult));
exit(EXIT_FAILURE);


//Displays GPU OpenGL version
fprintf(stdout, "INFO: OpenGL Version: %sn", glGetString(GL_VERSION));

UCreateVBO(); //Calls the function to create the Vertex Buffer Object

UCreateShaders(); //Calls the function to create the Shader Program

//Sets the background color of the window to black. Optional
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);



//Implements the UInitWindow function
void UInitWindow(int argc, char* argv[])
GLUT_RGBA);

//Creates a window with the macro placeholder title
glutCreateWindow(WINDOW_TITLE);

glutReshapeFunc(UResizeWindow); //Called when the window is resized
glutDisplayFunc(URenderGraphics); //Renders graphics on the screen



//Implements the UResizeWindow function
void UResizeWindow(int Width, int Height)

glViewport(0,0, Width, Height);


//Implements the URenderGraphics function
void URenderGraphics(void)
GL_DEPTH_BUFFER_BIT); //Clears the screen

/*Creates the triangle*/
GLuint totalVertices = 3; //Specifies the number of vertices for the triangle i.e. 3
glDrawArrays(GL_TRIANGLES, 0, totalVertices); //Draws the triangle

glutSwapBuffers(); //Flips the back buffer with the front buffer every frame. Similar to GL Flush



//Implements the CreateVBO function
void UCreateVBO(void)
0 offset
*/
glVertexAttribPointer(0, floatsPerVertex, GL_FLOAT, GL_FALSE, 0, 0);


//Implements the UCreateShaders function
void UCreateShaders(void)

//Create a shader program object
GLuint ProgramId = glCreateProgram();

GLuint vertexShaderId = glCreateShader(GL_VERTEX_SHADER); //Create a Vertex Shader Object
GLuint fragmentShaderId = glCreateShader(GL_FRAGMENT_SHADER); //Create a Fragment Shader Object

glShaderSource(vertexShaderId, 1, &VertexShader, NULL); //Retrieves the vertex shader source code
glShaderSource(fragmentShaderId, 1, &FragmentShader, NULL); //Retrieves the fragment shader source code

glCompileShader(vertexShaderId); //Compile the vertex shader
glCompileShader(fragmentShaderId); //Compile the fragment shader

//Attaches the vertex and fragment shaders to the shader program
glAttachShader(ProgramId, vertexShaderId);
glAttachShader(ProgramId, fragmentShaderId);

glLinkProgram(ProgramId); //Links the shader program
glUseProgram(ProgramId); //Uses the shader program



When completed correctly, the code should result in a solid green triangle.







c++ opengl






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 4:36









Tracy HarrisonTracy Harrison

365 bronze badges




365 bronze badges










  • 1





    "Vertex and Fragment Shader Source Macro" Please don't use macros like this. We have raw string literals now.

    – Nicol Bolas
    Mar 27 at 4:40











  • see complete GL+GLSL+VAO/VBO C++ example ... especially the GLSL logs usage there ...

    – Spektre
    Mar 27 at 8:31












  • 1





    "Vertex and Fragment Shader Source Macro" Please don't use macros like this. We have raw string literals now.

    – Nicol Bolas
    Mar 27 at 4:40











  • see complete GL+GLSL+VAO/VBO C++ example ... especially the GLSL logs usage there ...

    – Spektre
    Mar 27 at 8:31







1




1





"Vertex and Fragment Shader Source Macro" Please don't use macros like this. We have raw string literals now.

– Nicol Bolas
Mar 27 at 4:40





"Vertex and Fragment Shader Source Macro" Please don't use macros like this. We have raw string literals now.

– Nicol Bolas
Mar 27 at 4:40













see complete GL+GLSL+VAO/VBO C++ example ... especially the GLSL logs usage there ...

– Spektre
Mar 27 at 8:31





see complete GL+GLSL+VAO/VBO C++ example ... especially the GLSL logs usage there ...

– Spektre
Mar 27 at 8:31












1 Answer
1






active

oldest

votes


















3














The variable gl_FragColor is unavailable in GLSL 4.4 core profile since it was deprecated. Because you don't specify a compatibility profile, the default core is assumed. Either use



#version 440 compatibility


for your shaders, or, even better, use the GLSL 4.4 onwards approach:



#version 440 core
layout(location = 0) out vec4 OUT;
void main()
OUT = vec4(0.0, 1.0, 0.0, 1.0);






share|improve this answer




















  • 4





    Also, it's worth mentioning one should get and print the shader compile errors as it would have told you "global variable gl_FragColor is deprecated after version 120"

    – Andrew Wilson
    Mar 27 at 5:05










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55369895%2fhow-to-setup-shaders-in-opengl%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














The variable gl_FragColor is unavailable in GLSL 4.4 core profile since it was deprecated. Because you don't specify a compatibility profile, the default core is assumed. Either use



#version 440 compatibility


for your shaders, or, even better, use the GLSL 4.4 onwards approach:



#version 440 core
layout(location = 0) out vec4 OUT;
void main()
OUT = vec4(0.0, 1.0, 0.0, 1.0);






share|improve this answer




















  • 4





    Also, it's worth mentioning one should get and print the shader compile errors as it would have told you "global variable gl_FragColor is deprecated after version 120"

    – Andrew Wilson
    Mar 27 at 5:05















3














The variable gl_FragColor is unavailable in GLSL 4.4 core profile since it was deprecated. Because you don't specify a compatibility profile, the default core is assumed. Either use



#version 440 compatibility


for your shaders, or, even better, use the GLSL 4.4 onwards approach:



#version 440 core
layout(location = 0) out vec4 OUT;
void main()
OUT = vec4(0.0, 1.0, 0.0, 1.0);






share|improve this answer




















  • 4





    Also, it's worth mentioning one should get and print the shader compile errors as it would have told you "global variable gl_FragColor is deprecated after version 120"

    – Andrew Wilson
    Mar 27 at 5:05













3












3








3







The variable gl_FragColor is unavailable in GLSL 4.4 core profile since it was deprecated. Because you don't specify a compatibility profile, the default core is assumed. Either use



#version 440 compatibility


for your shaders, or, even better, use the GLSL 4.4 onwards approach:



#version 440 core
layout(location = 0) out vec4 OUT;
void main()
OUT = vec4(0.0, 1.0, 0.0, 1.0);






share|improve this answer













The variable gl_FragColor is unavailable in GLSL 4.4 core profile since it was deprecated. Because you don't specify a compatibility profile, the default core is assumed. Either use



#version 440 compatibility


for your shaders, or, even better, use the GLSL 4.4 onwards approach:



#version 440 core
layout(location = 0) out vec4 OUT;
void main()
OUT = vec4(0.0, 1.0, 0.0, 1.0);







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 27 at 5:00









ybungalobillybungalobill

48.5k13 gold badges102 silver badges168 bronze badges




48.5k13 gold badges102 silver badges168 bronze badges










  • 4





    Also, it's worth mentioning one should get and print the shader compile errors as it would have told you "global variable gl_FragColor is deprecated after version 120"

    – Andrew Wilson
    Mar 27 at 5:05












  • 4





    Also, it's worth mentioning one should get and print the shader compile errors as it would have told you "global variable gl_FragColor is deprecated after version 120"

    – Andrew Wilson
    Mar 27 at 5:05







4




4





Also, it's worth mentioning one should get and print the shader compile errors as it would have told you "global variable gl_FragColor is deprecated after version 120"

– Andrew Wilson
Mar 27 at 5:05





Also, it's worth mentioning one should get and print the shader compile errors as it would have told you "global variable gl_FragColor is deprecated after version 120"

– Andrew Wilson
Mar 27 at 5:05








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55369895%2fhow-to-setup-shaders-in-opengl%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해