Jump to content
  • Advertisement
Sign in to follow this  

OpenGL GLSL implementation

This topic is 4703 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 a problem when trying to implement GLSL Shaders in my OpenGL program. I am not using GLUT. I'm trying to use example code from Lighthouse3D's GLSL site. I am using this function to init the shaders.
GLhandleARB v,f,p;

GLvoid SetShaders() {

	char *vs = NULL,*fs = NULL;

	v = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
	f = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);

	vs = textFileRead("phong.vert");
	fs = textFileRead("phong.frag");

	const char * ff = fs;
	const char * vv = vs;

	glShaderSourceARB(v, 1, &vv,NULL);
	glShaderSourceARB(f, 1, &ff,NULL);



	p = glCreateProgramObjectARB();


And then activate shaders with: glUseProgramObjectARB(p); DrawSphere(); glUseProgramObjectARB(0); I'm not quite sure where to call the function but i've tried it in both InitGL and DrawGLScene with the same problem, an error that the program has to shut down. Can anyone please enlighten me ?

Share this post

Link to post
Share on other sites
Does your hardware support GLSL?.

the SetShaders() function should go in InitGlScene()

should go in DrawGLScene();

have you tried running the source from LightHouse3Ds website?:


Share this post

Link to post
Share on other sites
My first question is are you using GLEE, GLEW or pulling the functions you need out of the extension file yourself? with function pointers?

Share this post

Link to post
Share on other sites
My gfx card supports GLSL and I am using GLEW for extensions.
I am also using Dev-C++ and downloaded a GLEW DevPak, maybe that DevPak is to old and not supporting some stuff ?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!