nobody wrote on Saturday, June 21, 2008:
Hi,
I used glfw for Windows Vista and it worked perfectly. Now I switched
to Ubuntu 8.04 and want to continue develop under this platform.
But I am not able to compile my programs with glfwâŚI am new to Linux
Here are some Infos, which will maybe help you to help me
- downloaded glfw 2.6 source
- installed newest nvidia-driver (NVIDIA-Linux-x86-173.14.05-pkg1)
- installed the package "libglu1-mesa-dev" (For the GLU-Library)
- Then I created the shared and static glfw library with:
sudo make x11
sudo make x11-install
- All worked fine: Now I have the following important libs and Headerfiles:
/usr/include/GL ls
glext.h gl.h gl\_mangle.h glu.h glu\_mangle.h glxext.h glx.h glx\_mangle.h
/usr/local/lib ls
libglfw.a
- When I type glxinfo all seems ok:
/usr/local/lib glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
âŚ
âŚ
GLX version: 1.3
âŚ
âŚ
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 8500 GT/PCI/SSE2
OpenGL version string: 2.1.2 NVIDIA 173.14.05
- Then I wrote some sample Test Programm called test.c:
//********************************************************************************
#include <stdlib.h> // For malloc() etc.
#include <stdio.h> // For printf(), fopen() etc.
#include <math.h> // For sin(), cos() etc.
#include <GL/glfw.h> // For GLFW, OpenGL and GLU
void Draw( void )
{
int width, height; // Window dimensions
double t; // Time (in seconds)
// Get current time
t = glfwGetTime\(\);
// Get window size
glfwGetWindowSize\( &width, &height \);
// Make sure that height is non-zero to avoid division by zero
height = height < 1 ? 1 : height;
// Set viewport
glViewport\( 0, 0, width, height \);
// Clear color and depht buffers
glClearColor\( 0.0f, 0.0f, 0.0f, 0.0f \);
glClear\( GL\_COLOR\_BUFFER\_BIT | GL\_DEPTH\_BUFFER\_BIT \);
// Set up projection matrix
glMatrixMode\( GL\_PROJECTION \); // Select projection matrix
glLoadIdentity\(\); // Start with an identity matrix
gluPerspective\( // Set perspective view
65.0, // Field of view = 65 degrees
\(double\)width/\(double\)height, // Window aspect \(assumes square pixels\)
1.0, // Near Z clipping plane
100.0 // Far Z clippling plane
\);
// Set up modelview matrix
glMatrixMode\( GL\_MODELVIEW \); // Select modelview matrix
glLoadIdentity\(\); // Start with an identity matrix
gluLookAt\( // Set camera position and orientation
0.0, 0.0, 10.0, // Camera position \(x,y,z\)
0.0, 0.0, 0.0, // View point \(x,y,z\)
0.0, 1.0, 0.0 // Up-vector \(x,y,z\)
\);
// Here is where actual OpenGL rendering calls would begin...
}
int main( int argc, char **argv )
{
int ok; // Flag telling if the window was opened
int running; // Flag telling if the program is running
// Initialize GLFW
glfwInit\(\);
// Open window
ok = glfwOpenWindow\(
640, 480, // Width and height of window
8, 8, 8, // Number of red, green, and blue bits for color buffer
8, // Number of bits for alpha buffer
24, // Number of bits for depth buffer \(Z-buffer\)
0, // Number of bits for stencil buffer
GLFW\_WINDOW // We want a desktop window \(could be GLFW\_FULLSCREEN\)
\);
// If we could not open a window, exit now
if\( \!ok \)
\{
glfwTerminate\(\);
return 0;
\}
// Set window title
glfwSetWindowTitle\( "My OpenGL program" \);
// Enable sticky keys
glfwEnable\( GLFW\_STICKY\_KEYS \);
// Main rendering loop
do
\{
// Call our rendering function
Draw\(\);
// Swap front and back buffers \(we use a double buffered display\)
glfwSwapBuffers\(\);
// Check if the escape key was pressed, or if the window was closed
running = \!glfwGetKey\( GLFW\_KEY\_ESC \) &&
glfwGetWindowParam\( GLFW\_OPENED \);
\}
while\( running \);
// Terminate GLFW
glfwTerminate\(\);
// Exit program
return 0;
}
//********************************************************************************
- For the compiling I used the following command:
gcc test.c -o test.exe -lglfw -lGL -lGLU -lX11 -lpthread -lm
- then I got this
/usr/local/lib/libglfw.a(x11_init.o): In function `_glfwPlatformInitâ:
x11_init.c:(.text+0xea): undefined reference to `XRRQueryExtensionâ
/usr/local/lib/libglfw.a(x11_window.o): In function `_glfwPlatformRefreshWindowParamsâ:
x11_window.c:(.text+0x805): undefined reference to `XRRGetScreenInfoâ
x11_window.c:(.text+0x80f): undefined reference to `XRRConfigCurrentRateâ
x11_window.c:(.text+0x81d): undefined reference to `XRRFreeScreenConfigInfoâ
/usr/local/lib/libglfw.a(x11_window.o): In function `_glfwPlatformCloseWindowâ:
x11_window.c:(.text+0xb7f): undefined reference to `XRRGetScreenInfoâ
x11_window.c:(.text+0xba2): undefined reference to `XRRSetScreenConfigâ
x11_window.c:(.text+0xbab): undefined reference to `XRRFreeScreenConfigInfoâ
/usr/local/lib/libglfw.a(x11_window.o): In function `_glfwPlatformPollEventsâ:
x11_window.c:(.text+0x1158): undefined reference to `XRRUpdateConfigurationâ
/usr/local/lib/libglfw.a(x11_window.o): In function `_glfwPlatformOpenWindowâ:
x11_window.c:(.text+0x1fb3): undefined reference to `XRRSelectInputâ
/usr/local/lib/libglfw.a(x11_fullscreen.o): In function `_glfwPlatformGetVideoModesâ:
x11_fullscreen.c:(.text+0x1b0): undefined reference to `XRRGetScreenInfoâ
x11_fullscreen.c:(.text+0x1c1): undefined reference to `XRRConfigSizesâ
x11_fullscreen.c:(.text+0x1ff): undefined reference to `XRRFreeScreenConfigInfoâ
/usr/local/lib/libglfw.a(x11_fullscreen.o): In function `_glfwSetVideoModeMODEâ:
x11_fullscreen.c:(.text+0x308): undefined reference to `XRRGetScreenInfoâ
x11_fullscreen.c:(.text+0x323): undefined reference to `XRRConfigCurrentConfigurationâ
x11_fullscreen.c:(.text+0x373): undefined reference to `XRRSetScreenConfigAndRateâ
x11_fullscreen.c:(.text+0x38b): undefined reference to `XRRSetScreenConfigâ
/usr/local/lib/libglfw.a(x11_fullscreen.o): In function `_glfwGetClosestVideoModeâ:
x11_fullscreen.c:(.text+0x3dc): undefined reference to `XRRGetScreenInfoâ
x11_fullscreen.c:(.text+0x3ed): undefined reference to `XRRConfigSizesâ
x11_fullscreen.c:(.text+0x466): undefined reference to `XRRConfigRatesâ
x11_fullscreen.c:(.text+0x4b3): undefined reference to `XRRFreeScreenConfigInfoâ
/usr/local/lib/libglfw.a(x11_fullscreen.o): In function `_glfwSetVideoModeMODEâ:
x11_fullscreen.c:(.text+0x39d): undefined reference to `XRRFreeScreenConfigInfoâ
What I have done wrong ?
I have tried also tried to install the package "libxrandr-dev" but I had also the newest version already installed.
Can somebody plz help me to set the correct compile-Parameter ?
thanx und greetz
fbrjogl