PDA

View Full Version : Linking glew



Cucus
06-19-2011, 05:24 PM
Hi,

I'm trying to add glew library on my project Qt but I don't understand why, it didn't find some functions.

Here's my .pro:


#-------------------------------------------------
#
# Project created by QtCreator 2011-03-22T23:49:11
#
#-------------------------------------------------

QT += core gui opengl
QT += webkit

TARGET = Teste
TEMPLATE = app


SOURCES += main.cpp\
menuprincipal.cpp \
glwidget.cpp \
box.cpp \
point.cpp \
arraylist.cpp \
arraylist.operators.cpp \
xml.cpp \
tinyxmlparser.cpp \
tinyxmlerror.cpp \
tinyxml.cpp \
tinystr.cpp \
robot.cpp \
joint.cpp \
vertex.cpp \
properties.cpp \
face.cpp \
matrixcalculator.cpp

HEADERS += menuprincipal.h \
glwidget.h \
box.h \
point.h \
arraylist.h \
xml.h \
tinyxml.h \
tinystr.h \
robot.h \
joint.h \
vertex.h \
properties.h \
face.h \
matrixcalculator.h \
tree.hh

FORMS += menuprincipal.ui
LIBS += -lglew32


I don't have problems calling code = glewInit(); but when I try to call other functions like glGenVertexArrays, I have this error:
undefined reference to `_imp____glewGenVertexArrays'

I read the instructions of how to set this library here (http://glew.sourceforge.net/install.html) but nothing. I have put the header <GL/glew.h> in the right place but stills not working.
Any idea?

_x57_
06-20-2011, 01:31 AM
When you program links successfully and runs there shouldnt be a problem with the installation of the lib.

What does glewinit return? Does it return GLEW_OK?
Are you sure that your OpenGL version support glGenVertexArrays? Read here how to check for this:
Glew Basic Usage (http://glew.sourceforge.net/basic.html)

Also remember to install a proper OpenGL supporting graphics driver.

Cucus
06-20-2011, 06:57 AM
What does glewinit return? Does it return GLEW_OK?

It returns 0, is the right value true?



Are you sure that your OpenGL version support glGenVertexArrays? Read here how to check for this:
Glew Basic Usage (http://glew.sourceforge.net/basic.html)

Also remember to install a proper OpenGL supporting graphics driver.

I update my drivers yesterday

_x57_
06-20-2011, 07:32 AM
0 should equal GLEW_OK, so it seems ok.
However, you should check if your OpenGL version is at least 3.0 and that GLEW supports the command glGenVertexArrays as described in the link i gave you.

What other gl-commands do not work?

What hardware/system are you on?

Cucus
06-20-2011, 07:47 AM
With glewIsSupported(...) I check the version, I'm on openGL 3.3 (weird because as I said, I update yesterday :S)

Others call that don't work:
glBindVertexArray
glGenVertexArrays
glGenBuffers
glBindBuffer
glBufferData
and the constant "GLEW_VERSION_3_3"

This is all that I tryied for the moment.

System: Windows XP
Hardware:
NVIDIA Quadro FX1700 (version of driver: 6.14.0012.7536)
Intel 2Quad Q9300

V-man
06-20-2011, 11:53 AM
http://www.opengl.org/wiki/Extension_Loading_Library

Cucus
06-20-2011, 12:02 PM
If I understand what you're trying to say, I need to put glewExperimental=TRUE; on my code?

Still not working.

V-man
06-20-2011, 03:48 PM
Did you try one of the examples?
http://www.opengl.org/wiki/Tutorial1:_Rendering_shapes_with_glDrawRangeElemen ts,_VAO,_VBO,_shaders_(C%2B%2B_/_freeGLUT)

And if that doesn't work, try getting the function pointers yourself.
You can then trace into the GLEW code to see why it fails.

_x57_
06-21-2011, 02:33 AM
V-man is right, you should check if you can retrieve the OpenGL function pointers for the non-working functions directly from windows using wglGetProcAdress... see here (http://msdn.microsoft.com/en-us/library/dd374386%28v=vs.85%29.aspx) .

Also, since your graphics card is not a standard consumer model, you might to try to compile the code on another machine to ensure your code is fine.

Cucus
06-21-2011, 12:40 PM
The problem is solved, it was the graphic card. Now I m on another nVidia graphic card (more comercial) but I have another problem, check this post (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&amp;Number=299195#Post2991 95)