Jump to content
  • Advertisement
Josheir

OpenGL Failing to Define Like a Header File isn't Specified.

Recommended Posts

I am trying to use : OpenGL and draw some simple text quickly. However I cannot get the top two commands to define. 

 

glColor3f(rgb.r, rgb.g, rgb.b); 
glRasterPos2f(x, y);

glutBitmapString(font, string);

I tried this :

#include <C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Include/gl/GL.h>

May I have some help please.  The last command which is with glut is fine.  Apparently, the problem is not with GLUT or FreeGlut, but with Visual Studio headers.  I am using Visual Studio 2017, C++.

 

Thank you,

Josheir

Edited by Josheir

Share this post


Link to post
Share on other sites
Advertisement
58 minutes ago, Josheir said:

I am trying to use : OpenGL and draw some simple text quickly. However I cannot get the top two commands to define. 

 


glColor3f(rgb.r, rgb.g, rgb.b); 
glRasterPos2f(x, y);

glutBitmapString(font, string);

I tried this :


#include <C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Include/gl/GL.h>

May I have some help please.  The last command which is with glut is fine.  Apparently, the problem is not with GLUT or FreeGlut, but with Visual Studio headers.  I am using Visual Studio 2017, C++.

 

Thank you,

Josheir

All you need to do is specify the .lib files in the linker by doing the following in Visual Studio:
    • Open the Project menu, then select [project name] Properties... -> Linker -> Input
    • Click the dropdown arrow in the Additional Dependencies field and click <Edit...>
    • Add opengl32.lib and glu32.lib to the list (see the included screenshot)
    • Click OK then Apply -> OK
    • Add #include <gl/GL.h> and #include <gl/GLU.h> to the necessary file(s)
    • Rebuild the Solution (Ctrl+Alt+F7)

devenv_2018-10-12_16-36-37.png

Edited by MrHallows
Fixed formatting

Share this post


Link to post
Share on other sites

Thank you for the reply, MrHallows.  However all that is already done.  I'm stumped.

Josheir

Share this post


Link to post
Share on other sites

I opened a new project with just :  

glColor3f(0.5, 0.5, 0.5);

in main().  Didn't work either, perplexed!

Edited by Josheir

Share this post


Link to post
Share on other sites
1 hour ago, Josheir said:

Thank you for the reply, MrHallows.  However all that is already done.  I'm stumped.

Josheir

Hmm.. That is certainly odd.

20 minutes ago, Josheir said:

I opened a new project with just :  


glColor3f(0.5, 0.5, 0.5);

in main().  Didn't work either, perplexed!

I assume you set up the new project in the same manner. A couple of questions:

    1) Are you getting any build/runtime errors at all or it's just not doing what it should be?
    2) What do your configuration settings look like?

Share this post


Link to post
Share on other sites

Please don't use MS OpenGL Ver. 1.1 includes

http://freeglut.sourceforge.net/

And also get this if you don't have it.

http://glew.sourceforge.net/

Your includes should look like this when you have your paths in VS properly configured.

#include <GL/glew.h>
#include <GL/freeglut.h>

Will this solve your problem? Maybe. But this is the horse. Your issue is a cart.

 

Edited by fleabay

Share this post


Link to post
Share on other sites

Well, I added the include to glew.h and half my problems were solved.  glColor3f(0.1f,0.1f,0.1f) is now working.  Maybe this sheds light on the red squiggly beneath glRasterPos3(…?

Thank you so much,

Josheir

 

Share this post


Link to post
Share on other sites

Okay it works...thanks everyone.  Needed glew.h, that's all!

Josheir

So, how is it recommended, fleabay, for organizing the various libs and headers that are used repeatedly?  Are we putting them all in a folder for libs and a folder for headers with subfolders?  Or, are we putting them all in the directory of each project, too?

Thanks again.

Josheir

 

Edited by Josheir

Share this post


Link to post
Share on other sites

The reason I ask, is two different headers are in the same sub folder, there!  So, what do you suggest?

Josheir

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 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!