OpenGL shaders in Windows

Started by
15 comments, last by Mariusz Pilipczuk 11 years, 3 months ago

I just went though the same thing. I was developing my game on Mac, and then after 1 year of getting the game in a good alpha state, I decieded to take that fearful leap and attempt to get it compiled on WIndows. (probably not the best idea to wait a year).

That's when I found out that I had to use glew because windows only had OpenGL 1.1 as mentioned aboved. Download the glew library, link to it, and I believe there is one init you have to do

glewinit()

I was using GLFW to create my window, and not SDL, but I'm sure this advice works for you too. I read that you have to call "glewinit()" after you create your window. So I had to make sure I called glewinit() after my glfwinit() function that set up the window.

Hopefully that helps you out. After getting GLEW in the project and calling the init, my linker errors were resolved. Hopefully this helps you some.

Advertisement

is GLEW built-in on Windows, or do I need to get some kind of DLL and headers from somewhere?


You need to get it yourself.

You can #define GLEW_STATIC before including glew32.h and GLEW will statically link with your program - probably a good option if you can't rely on your end-users having it (you need to link to glew32s.lib rather than glew32.lib if you do this).

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

You can use GLEW the same way in Linux (or wherever) also, which means you don't have to make things two different ways.

[size=2]Current project: Ephenation.
[size=2]Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

OK, now I have 2 problems.

If I include glew (the include file is called GL/glew.h) then it makes lots of re-declarations of symbols from SDL and vice-versa. If I don't include it, then there is no compilations error, but there is still a linker error, with all of the undefined references I showed above, as well as an undefined reference to glewInit() -.-

I'm passing the -lglew32 flag to the linker. Does anyone know why this is happening?

?

- dont include gl.h as glew.h takes care of this

- include glew.h in the files when you are using opengl functions

- try if including glew.h or sdl headers should be first

The thing is, i'm not including gl.h, I'm including SDL_opengl.h. This is confusing. Plus this would not cause linker errors. Isn't there anything else I need to link with? There were 4 different libs with GLEW.

This topic is closed to new replies.

Advertisement