Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


GLSL not working


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Dark Engineer   Members   -  Reputation: 132

Like
0Likes
Like

Posted 21 January 2013 - 01:59 PM

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;
	glfwInit();
	glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
	glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
	glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
	
	glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_TRUE);
	glfwOpenWindow(800, 600, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);
	glfwSetWindowTitle("Crion World Alpha");
	while( glfwGetWindowParam( GLFW_WINDOW ) )
	{
		glfwSwapBuffers();
	}

	if( glfwGetKey( GLFW_KEY_ESC ) == GLFW_PRESS )
		return 0;
	glewExperimental = GL_TRUE;
	glewInit();
	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 );
	glfwTerminate();
	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:

opengl32.lib
glu32.lib
glut32.lib
glfwdll.lib
glew32d.lib



Sponsor:

#2 claesson92   Members   -  Reputation: 408

Like
2Likes
Like

Posted 21 January 2013 - 02:02 PM

The 

#version 150

 

goes in your GLSL file, not your C/C++.



#3 Dark Engineer   Members   -  Reputation: 132

Like
0Likes
Like

Posted 21 January 2013 - 02:07 PM

I don't know how to create glsl object

Edited by Dark Engineer, 21 January 2013 - 02:14 PM.


#4 SuperVGA   Members   -  Reputation: 1118

Like
2Likes
Like

Posted 21 January 2013 - 02:57 PM

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:
http://samplecodebank.blogspot.dk/2011/05/glcreateprogram-example.html
http://www.lighthouse3d.com/opengl/glsl/
http://www.clockworkcoders.com/oglsl/tutorials.html
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, 22 January 2013 - 03:33 AM.


#5 Dark Engineer   Members   -  Reputation: 132

Like
0Likes
Like

Posted 21 January 2013 - 03:14 PM

Thanks






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS