Jump to content
  • Advertisement
Sign in to follow this  
bjarnia

OpenGL glew/glee usage?

This topic is 3981 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

Ok.. I'm missing something here.. I'll admit that my C++ skills aren't the best, but so far they have been good enough. Anyway... I'm using SDL and OpenGL, and need to use OpenGL extensions.. I've used them before, but without a library like glee or glew and it was horrible so that's why I'm trying to use them now. Here's my problem... I have a (rather) simple terrain renderer. main.cpp includes: #include <SDL.h> #include <GL/glew.h> (I was originally including SDL_opengl.h in place of glew.h but glew.h takes care of all that) because I need access to OpenGL functions to set up OpenGL. Allthough I suppose I could technically remove all OpenGL functions from main. I would still like to initialize glew in main though? main.cpp includes world.h which includes terrain.h which needs to render.. So it obviously needs OpenGL access.. and Access to extensions.. So now I need to include glew.. But when I try to include it it gives me #error : gl.h included before glew.h Because I already included SDL_opengl.h in main. I tried to change the include in main.cpp to glew but the problem persisted. Am I doing something really wrong here?

Share this post


Link to post
Share on other sites
Advertisement
#include <gl/glew.h>
#include <GL/GL.h>
#include <SDL.h>

and in the initialize function you must call glew Initialization function:

glewInit();

Share this post


Link to post
Share on other sites
Quote:
Original post by Pooya65
#include <gl/glew.h>
#include <GL/GL.h>
#include <SDL.h>

and in the initialize function you must call glew Initialization function:

glewInit();



Thanks for taking the time to reply... But I'm not sure you understood the problem..
I can import glew fine for initialization... But when I want to import it again in a sub sub class to actually use it, it gives me an error, as if you could only import glew.h once in your entire program.

Share this post


Link to post
Share on other sites
Quote:

But when I want to import it again in a sub sub class to actually use it, it gives me an error, as if you could only import glew.h once in your entire program.


You need to supply the error message (since the other is just about including glew.h/glee.h before gl.h) and maybe even some code (in case this is just an ordinary error, which is caused by something completely different; like a typo).
There should not be any problems with importing GLee in several files, since it contains a preprocessor guard and therefore will not be included more than once.

Share this post


Link to post
Share on other sites
Quote:
Original post by nife87
Quote:

But when I want to import it again in a sub sub class to actually use it, it gives me an error, as if you could only import glew.h once in your entire program.


You need to supply the error message (since the other is just about including glew.h/glee.h before gl.h) and maybe even some code (in case this is just an ordinary error, which is caused by something completely different; like a typo).
There should not be any problems with importing GLee in several files, since it contains a preprocessor guard and therefore will not be included more than once.


Thanks... I was actually going to prove you wrong and post all my code, and after iterating through all the includes I found that one of my external image loading classes imported gl.h, that has to be the problem.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!