Jump to content
  • Advertisement
Sign in to follow this  
Dark Engineer

OpenGL GLSL not working

This topic is 1980 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have problem with glsl on windows 8 in Microsoft Visual Studio Express 2012 with Radeon. Even #version 150 is not recognized in code.


#version 150
#include <glm\ext.hpp>
#include <glm\glm.hpp>
#include <GL\glew.h>
#include <GL\glut.h>
#include <GL\GL.h>
#include <GL\GLU.h>
#include <GL\glfw.h>

in vec2 position;
out vec4 outColor;

int main()
	 vec3 commeo;
	glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
	glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
	glfwOpenWindow(800, 600, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);
	glfwSetWindowTitle("Crion World Alpha");
	while( glfwGetWindowParam( GLFW_WINDOW ) )

	if( glfwGetKey( GLFW_KEY_ESC ) == GLFW_PRESS )
		return 0;
	glewExperimental = GL_TRUE;
	GLuint vertexBuffer;
	glGenBuffers( 1, &vertexBuffer );

	printf( "%u\n", vertexBuffer);
	float vertices[] = {
		0.0f,	0.5f,
		0.5f,	-0.5f,
		-0.5f,	-0.5f

	GLuint vbo;
	glGenBuffers( 1, &vbo); //generate 1 buffer
	glBindBuffer( GL_ARRAY_BUFFER, vbo );
	glBufferData( GL_ARRAY_BUFFER, sizeof( vertices ), vertices, GL_STATIC_DRAW );

	GLuint vertexShader = glCreateShader( GL_VERTEX_SHADER );
	glShaderSource( vertexShader, 1, &vertexSource, NULL );
	glCompileShader( vertexShader );
	return 0;

I have errors:


	1	IntelliSense: unrecognized preprocessing directive	 /// #version 150
	2	IntelliSense: identifier "in" is undefined	
	4	IntelliSense: identifier "out" is undefined	
	6	IntelliSense: identifier "vec3" is undefined	
	7	IntelliSense: identifier "vertexSource" is undefined	

I have linked:


Share this post

Link to post
Share on other sites
There are plenty of resources on this! All I did was google glCreateProgram, but for somebody new to shader, try googling GLSL Tutorial!
Try these:
The lighthouse3d ones are really good! You will create a GLSL program object by calling glCreateProgram. To this object, you can attach Vertex, Geometry and Fragment shaders.
To start off with, why not try a vertex shader?
Have a look at http://www.lighthouse3d.com/tutorials/glsl-tutorial/hello-world-in-glsl/.
It's not as difficult as it seems at first. smile.png
Good luck. Edited by SuperVGA

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!