Jump to content

  • Log In with Google      Sign In   
  • Create Account


Installing GLEW.h libraries for VS express 2010


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Vero   Members   -  Reputation: 138

Like
0Likes
Like

Posted 08 July 2012 - 08:27 PM

I having some serious issues trying to get the GLEW libraries to compile without linker errors any help would be appreciated.

[code=auto:0]

#include <Windows.h> // Header File For Windows
//#include <GL/GL.h> // Header file for OpenGL32 Library
//#include <GL/GLU.h> // Header File for GLu32 Library
#include <stdio.h>
#include <stdarg.h>
#include "aMaze_Objects.h"
#include <gl\glew.h>
#include <GL/glut.h>
#include "SOIL.h"
[code=auto:0]

here's the error log when i try to compile. I've tried numerious folders to place the bin lib and include files

1>------ Build started: Project: aMaze, Configuration: Debug Win32 ------
1>aMaze_Main.obj : error LNK2019: unresolved external symbol __imp__glewInit referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
1>aMaze_Objects.obj : error LNK2001: unresolved external symbol __imp____glewBlendFuncSeparate

1>C:\Users\Varonec\Dropbox\Game\aMaze\Debug\aMaze.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have tried searching the internet and I've read this link up and down:
file:///C:/Users/Varonec/Downloads/glew-1.7.0-win64%281%29/glew-1.7.0/doc/install.html

anyway, I'm not sure where I can go from here

Sponsor:

#2 BitMaster   Crossbones+   -  Reputation: 3883

Like
3Likes
Like

Posted 09 July 2012 - 12:46 AM

You need to tell the linker to link glew32.lib (or glew32s.lib if you want to link to the static version of GLEW). If you want to link to GLEW static, remember to define GLEW_STATIC before any place where you include glew.h.

On MSVC you can use
#pragma comment(lib, "glew32s.lib")
to link to the library or Project Properties->Configuration Properties->Linker->Input->Additional Dependencies. I don't have a MSVC 2010 to check right now but it should be similar there.

Edited by BitMaster, 09 July 2012 - 12:46 AM.


#3 Vero   Members   -  Reputation: 138

Like
0Likes
Like

Posted 09 July 2012 - 10:15 AM

Thank you so much for clearing that up. I'm finally able to get the glew libraries to compile and use the glew functionality.

So, I suppose there is a part two to this sadly. What I'm trying to accomplish is masking. Too Keep things simple the whole thing is done in glOrtho. I'm trying to create a sprite and the first step right now is rendering a texture and making everything outside of the draw part of the image transparent. the following is the draw function so far with no success in masking. there is nothing behind the drawn image only a black background right now. (no rendered quad or anything.)

GLvoid MPlayer::Draw()
{
    glEnable(GL_TEXTURE_2D);
    glColor4f(1.0f,1.0f,1.0f,1.0f);
    glLoadIdentity();
    glTranslatef(fPosition.x,fPosition.y,0.0f);
    //glRotatef(spin,0.0f,0.0f,1.0f);
    glBlendFunc(GL_DST_COLOR,GL_ZERO);
    glBindTexture(GL_TEXTURE_2D,mask[0]);
    glBegin(GL_QUADS);
        glTexCoord2f(0,0); glVertex2i( 3         , interval-2);         //start drawing
        glTexCoord2f(0,1); glVertex2i( 3         , 3);
        glTexCoord2f(1,1); glVertex2i( interval-2, 3);    
        glTexCoord2f(1,0); glVertex2i( interval-2, interval-2);
    glEnd();
//    glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA);
    glBlendFunc(GL_ONE, GL_ONE);
    glBindTexture(GL_TEXTURE_2D,sprite[0]);
    glBegin(GL_QUADS);
        glTexCoord2f(0,0); glVertex2i( 3         , interval-2);         //start drawing
        glTexCoord2f(0,1); glVertex2i( 3         , 3);
        glTexCoord2f(1,1); glVertex2i( interval-2, 3);    
        glTexCoord2f(1,0); glVertex2i( interval-2, interval-2);
    glEnd();
    glDisable(GL_TEXTURE_2D);
    glBlendFunc(GL_SRC_ALPHA,GL_ZERO);
}


#4 BitMaster   Crossbones+   -  Reputation: 3883

Like
0Likes
Like

Posted 10 July 2012 - 02:18 AM

First, I do not see a call of glEnable(GL_BLEND).
Second, are you sure the image contains an alpha channel and that the loading function you use loads the alpha channel and uploads it correctly to the texture?
Third, you probably want glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) or the inverse, depending on your alpha setup.

#5 Vero   Members   -  Reputation: 138

Like
0Likes
Like

Posted 10 July 2012 - 09:29 AM

Ok, I've created an simple little image it's a 32x32 pixel image with a white background in MSPaint. then I created a second image this one is a copy of the 1st image only any part that had color was replaced with white and the rest of the image was filled in as black.

Do I need to do something special to either image within the image editor? would I need to install something like GIMP to do so? or is MS paint in windows 7 capable of something that advanced? I uploaded the images into the program with SOIL. source: http://www.lonesock.net/soil.html

Image loader function:
bool MPlayer::LoadObjTexture(char *filename,int slot)
{
	char *index = strchr(filename,'.');
	char *mask= new char[0];
	strncpy(mask,filename,index-filename);
	mask[index-filename]='\0';
	strcat(mask,"_mask.bmp");

	if(MObject::LoadObjTexture(filename,slot,false)&&
	   MObject::LoadObjTexture(mask,slot,true))
		return true;
	else
	{
		MessageBox(NULL,L"Hero Sprite failed to Load",L"GAME ERROR",MB_OK|MB_ICONEXCLAMATION);
		return false;
	}
}

bool MObject::LoadObjTexture(char *Filename,int slot,bool isMask)
{
	if(isMask)
	{
		mask[slot]=SOIL_load_OGL_texture
			(
			Filename,
			SOIL_LOAD_AUTO,
			SOIL_CREATE_NEW_ID,
			SOIL_FLAG_INVERT_Y | SOIL_FLAG_MIPMAPS|SOIL_FLAG_NTSC_SAFE_RGB
			);
		if(mask[slot]==0)
			return false;
		else return true;
	}
	else{
		sprite[slot]=SOIL_load_OGL_texture
			(
			Filename,
			SOIL_LOAD_AUTO,
			SOIL_CREATE_NEW_ID,
			SOIL_FLAG_INVERT_Y | SOIL_FLAG_MIPMAPS|SOIL_FLAG_NTSC_SAFE_RGB
			);
		if(sprite[slot]==0)
			return false;
		else return true;
	}
	return false;
}

Edit: glEnable(GL_BLEND) was declared in my initGL() function which is called at the start of the program. currently I've had no reason to disable blending

Edited by Vero, 10 July 2012 - 09:31 AM.


#6 Vero   Members   -  Reputation: 138

Like
0Likes
Like

Posted 24 July 2012 - 01:47 PM

Just an FYI when getting Glew to compile, if you're comiling a 32bit program use the 32 bit libraries doesn't matter what your machine architecture is. Obvious problem was hidden in plain sight for me spent days banging my head against the keyboard when I couldn't compile and run my code on a different machine.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS