PDA

View Full Version : Without GLEW



MZIskandar
09-05-2006, 03:50 PM
Hi guys..

I'm new to shaders and need your help.

I'm trying to write a program including shaders without using glew. How can I do that?

Currently I'm using DevC++.

Thank you.

Jan
09-05-2006, 05:32 PM
What's the reason NOT to use GLEW? That's like asking how to use the highway without a car.

Anyway, check out nehe.gamedev.net there is a tutorial to get you started with extensions the "old fashioned" way - if you really want to.

Jan.

Overmind
09-06-2006, 12:28 AM
It's one external dependency less. I don't see any reason why I should use GLEW, it's really a trivial library that just adds to my dependencies.

It's not really a problem to load extensions. Basically you need something like the following code for each function:

Header file ext.h:

#include <GL/gl.h>
#include <GL/glext.h>

#define glShaderSource __extproc_glShaderSource

extern PFNGLSHADERSOURCEPROC glShaderSource;C file:

#include "ext.h"

PFNGLSHADERSOURCEPROC glShaderSource;

void load() {
glShaderSource = glxGetProcAddressARB("glShaderSource");
}That's all easily generated out of glext.h with a simple awk script or something similar. So the only real coding I have to do is checking the version and extension string.

Of course, for small demos that's all overkill. There I would just use GLEW, SDL and so on for all the low level code.

MZIskandar
09-06-2006, 11:30 AM
Thank you..

Yes. No doubt. Using GLEW is easier.

The purpose for me not using GLEW is to learn explore more about shaders, extension and hardware caps programming.

I'll google on the hint given.