GLSL in MFC

Started by
2 comments, last by V-man 16 years, 10 months ago
Hi all, I've been playing around for a long time, and have several nice container classes that wrap OpenGL/glu libraries into a nice CView/CWnd classes. However, I'm trying to do this for GLSL and am having trouble. Can you wrap GLSL libraries in a class like this? I've got demo apps up and running using GLEW no problem, but it always creates its own window. Is there a way to create/use GLSL functionality in MFC? Thanks
Advertisement
Yes, of course. MFC doesn't care and neither does GLSL.
If you have been using GL before, then it should be obvious. WHat is the problem you are having?
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
So, I have my normal OGL apps working just fine using gl/glu/glaux.h and corresponding MS libs. However, when I try to add any GLSL commands such as:
GLuint testFS;
testFS = glCreateShader(GL_FRAGMENT_SHADER);
glCompileShader(testFS);

The compiler obviously complains that it doesn't recognize those symbols. I thought I could use GLEW, but one of GLEW's startup sequence commands is glutCreateWindow(), but I want to use the CView's window, not create a new one. So, a couple quick questions:
1. Do microsoft's GL libraries support GLSL? Are there new ones that do?
2. Can I use GLSL w/o using GLEW?
3. or is there a method to get GLEW to attach itself to the existing CView/CWnd window?


GLEW doesn't use GLUT.
I use it with my MFC code currently.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement