Hi All I'm trying to start Linux programming but keep coming up against problems. The latest one is OpenGL programming with a Geforce 3 graphics card. I'm told that I have to use the NVidia OpenGL libraries (nvsdk) but having downloaded it, it seems to be totally Windows. I have no idea how to use it (if it can be used under Linux) and even the docs are in Windows formats. Can anyone help me on this or do I have to throw this otherwise good card away and start again? TIA Stewart Taylor
Stewart Taylor writes:
Hi All
I'm trying to start Linux programming but keep coming up against problems. The latest one is OpenGL programming with a Geforce 3 graphics card. I'm told that I have to use the NVidia OpenGL libraries (nvsdk) but having downloaded it, it seems to be totally Windows. I have no idea how to use it (if it can be used under Linux) and even the docs are in Windows formats. Can anyone help me on this or do I have to throw this otherwise good card away and start again?
No you don't want to use that I'm sure. NVIDIA ships with the NVIDIA_GLX-1.0-xxxx package some header files. These should not differ too much from a standard GL.h file except that they probably have definitions for NVIDIA specific extensions. NVIDIA_GLX-1.0-2960/usr/include/GL/gl/gl.h glx.h glxtokens.h Copy these into /usr/include/GL or wherever you prefer. Then refer to them with: #include <GL/glu.h> This should get you started. If you don't know anything about OpenGL then I suggest you look into the GLUT toolkit. If you write an OpenGL program in Linux it will use the GLX interface whereas in windows it uses the WGL interface. The GLUT hides this from you, and lets you just programm OpenGL. To get you started with glut here is an example I did a while back that uses OpenGL to plot a koch snowflake. Compile like so: gcc -c -g koch.c gcc -o koch koch.o -lGL -lGLU -lglut Don't pay too much attention to the logic. Look in main for how the window is setup, and then look at the different glXXXXX calls. This is a 2d example, but it should help you get started. Save to file koch.c ------------------------------------------- #include <stdio.h> #include <time.h> #include <math.h> #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> #define WIN_HEIGHT 400 #define WIN_WIDTH 400 #define LEVEL 9 static void koch ( int level, float r, float *xleft, float *yleft, float *xright, float *yright ); static void draw_koch ( int level, int x1, int y1, int x0, int y0 ); static void draw_koch ( int level, int x1, int y1, int x0, int y0 ) { float xleft[30], yleft[30], xright[30], yright[30]; xleft[level-1] = (float)x0; yleft[level-1] = (float)y0; xright[level-1] = (float)x1; yright[level-1] = (float)y1; koch (level-1, (float)0.29, xleft, yleft, xright, yright); } static void koch ( int level, float r, float *xleft, float *yleft, float *xright, float *yright ) { if (level > 0) { level--; /* Left Branch */ xleft[level] = xleft[level+1]; yleft[level] = yleft[level+1]; xright[level] = (0.3333f * xright[level+1]) + (0.6667f * xleft[level+1]); yright[level] = (0.3333f * yright[level+1]) + (0.6667f * yleft[level+1]); koch (level, r, xleft, yleft, xright, yright); /* Middle Left Branch */ xleft[level] = xright[level]; yleft[level] = yright[level]; xright[level] = (0.5f * xright[level+1]) + (0.5f * xleft[level+1]) - (r * (yleft[level+1] - yright[level+1])); yright[level] = (0.5f * yright[level+1]) + (0.5f * yleft[level+1]) + (r * (xleft[level+1] - xright[level+1])); koch (level, r, xleft, yleft, xright, yright); /* Middle Right Branch */ xleft[level] = xright[level]; yleft[level] = yright[level]; xright[level] = (0.6667f * xright[level+1]) + (0.3333f * xleft[level+1]); yright[level] = (0.6667f * yright[level+1]) + (0.3333f * yleft[level+1]); koch (level, r, xleft, yleft, xright, yright); /* Right Branch */ xleft[level] = xright[level]; yleft[level] = yright[level]; xright[level] = xright[level+1]; yright[level] = yright[level+1]; koch (level, r, xleft, yleft, xright, yright); level++; } else { glBegin (GL_LINES); glVertex2i ((int)xleft[0], (int)yleft[0]); glVertex2i ((int)xright[0], (int)yright[0]); glEnd (); } } static int win_width = WIN_WIDTH; static int win_height = WIN_HEIGHT; static int the_level = LEVEL; static void redraw (void) { time_t start_time, end_time; printf ("Enter - redraw ()\n"); start_time = time (0); glClearColor (0.0, 0.0, 0.0, 0.0); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glFlush (); draw_koch (the_level, 0.0, win_height/2, win_width-1, win_height/2); end_time = time (0); printf ("Exit - redraw () %d secs\n", end_time - start_time); } static void reshape (int width, int height) { printf ("Enter - reshape ()\n"); win_width = width; win_height = height; glViewport (0, 0, width, height); glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluOrtho2D (-0.5, (width + 0.5), -0.5, (height + 0.5)); printf ("Exit - reshape ()\n"); } static void keyboard (int key, int x, int y) { int changed = 0; switch (key) { case GLUT_KEY_UP: if (++the_level > 10) the_level = 10; changed = 1; break; case GLUT_KEY_DOWN: if (--the_level < 1) the_level = 1; changed = 1; break; } if (changed) glutPostRedisplay (); } int main (int argc, char **argv) { /* init window parameters. */ glutInitWindowSize (WIN_WIDTH, WIN_HEIGHT); glutInitWindowPosition (100, 100); glutInitDisplayMode (GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH); /* create window. */ if (glutCreateWindow ("koch curve") <= 0) exit (0); /* set display and reshape functions. */ glutDisplayFunc (redraw); glutReshapeFunc (reshape); glutSpecialFunc (keyboard); /* start GLUT processing loop. */ glutMainLoop (); return 0; }
On Saturday 13 July 2002 21:57, Jesse Marlin wrote: Hi Jesse Thanks for your reply. I tried what your little demo and my own trial program using the nvidia header files and both produced a parse error in glu.h. When I ran them with the glut supplied files they both compiled and ran OK. Do you have any ideas on what caused this to happen. Out of interest when I started my move over to Linux I bought both the OpenGL Programming Guide and the OpenGL Reference Manualas I 've told that these are just about the best books to get me started. Stewart
No you don't want to use that I'm sure. NVIDIA ships with the NVIDIA_GLX-1.0-xxxx package some header files. These should not differ too much from a standard GL.h file except that they probably have definitions for NVIDIA specific extensions.
NVIDIA_GLX-1.0-2960/usr/include/GL/gl/gl.h glx.h glxtokens.h
Copy these into /usr/include/GL or wherever you prefer. Then refer to them with:
#include <GL/glu.h>
This should get you started. If you don't know anything about OpenGL then I suggest you look into the GLUT toolkit. If you write an OpenGL program in Linux it will use the GLX interface whereas in windows it uses the WGL interface. The GLUT hides this from you, and lets you just programm OpenGL.
To get you started with glut here is an example I did a while back that uses OpenGL to plot a koch snowflake. Compile like so:
gcc -c -g koch.c gcc -o koch koch.o -lGL -lGLU -lglut
Don't pay too much attention to the logic. Look in main for how the window is setup, and then look at the different glXXXXX calls. This is a 2d example, but it should help you get started.
Save to file koch.c -------------------------------------------
#include <stdio.h> #include <time.h> #include <math.h> #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h>
#define WIN_HEIGHT 400 #define WIN_WIDTH 400 #define LEVEL 9
static void koch ( int level, float r, float *xleft, float *yleft, float *xright, float *yright );
static void draw_koch ( int level, int x1, int y1, int x0, int y0 );
static void draw_koch ( int level, int x1, int y1, int x0, int y0 ) { float xleft[30], yleft[30], xright[30], yright[30];
xleft[level-1] = (float)x0; yleft[level-1] = (float)y0; xright[level-1] = (float)x1; yright[level-1] = (float)y1;
koch (level-1, (float)0.29, xleft, yleft, xright, yright); }
static void koch ( int level, float r, float *xleft, float *yleft, float *xright, float *yright ) { if (level > 0) { level--;
/* Left Branch */ xleft[level] = xleft[level+1]; yleft[level] = yleft[level+1]; xright[level] = (0.3333f * xright[level+1]) + (0.6667f * xleft[level+1]); yright[level] = (0.3333f * yright[level+1]) + (0.6667f * yleft[level+1]); koch (level, r, xleft, yleft, xright, yright);
/* Middle Left Branch */ xleft[level] = xright[level]; yleft[level] = yright[level]; xright[level] = (0.5f * xright[level+1]) + (0.5f * xleft[level+1]) - (r * (yleft[level+1] - yright[level+1])); yright[level] = (0.5f * yright[level+1]) + (0.5f * yleft[level+1]) + (r * (xleft[level+1] - xright[level+1])); koch (level, r, xleft, yleft, xright, yright);
/* Middle Right Branch */ xleft[level] = xright[level]; yleft[level] = yright[level]; xright[level] = (0.6667f * xright[level+1]) + (0.3333f * xleft[level+1]); yright[level] = (0.6667f * yright[level+1]) + (0.3333f * yleft[level+1]); koch (level, r, xleft, yleft, xright, yright);
/* Right Branch */ xleft[level] = xright[level]; yleft[level] = yright[level]; xright[level] = xright[level+1]; yright[level] = yright[level+1]; koch (level, r, xleft, yleft, xright, yright); level++; } else { glBegin (GL_LINES); glVertex2i ((int)xleft[0], (int)yleft[0]); glVertex2i ((int)xright[0], (int)yright[0]); glEnd (); } }
static int win_width = WIN_WIDTH; static int win_height = WIN_HEIGHT; static int the_level = LEVEL;
static void redraw (void) { time_t start_time, end_time;
printf ("Enter - redraw ()\n"); start_time = time (0);
glClearColor (0.0, 0.0, 0.0, 0.0); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glFlush ();
draw_koch (the_level, 0.0, win_height/2, win_width-1, win_height/2);
end_time = time (0); printf ("Exit - redraw () %d secs\n", end_time - start_time); }
static void reshape (int width, int height) { printf ("Enter - reshape ()\n"); win_width = width; win_height = height; glViewport (0, 0, width, height);
glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluOrtho2D (-0.5, (width + 0.5), -0.5, (height + 0.5));
printf ("Exit - reshape ()\n"); }
static void keyboard (int key, int x, int y) { int changed = 0;
switch (key) { case GLUT_KEY_UP: if (++the_level > 10) the_level = 10; changed = 1; break;
case GLUT_KEY_DOWN: if (--the_level < 1) the_level = 1; changed = 1; break; }
if (changed) glutPostRedisplay (); }
int main (int argc, char **argv) { /* init window parameters. */ glutInitWindowSize (WIN_WIDTH, WIN_HEIGHT); glutInitWindowPosition (100, 100); glutInitDisplayMode (GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH);
/* create window. */ if (glutCreateWindow ("koch curve") <= 0) exit (0);
/* set display and reshape functions. */ glutDisplayFunc (redraw); glutReshapeFunc (reshape); glutSpecialFunc (keyboard);
/* start GLUT processing loop. */ glutMainLoop (); return 0; }
Stewart Taylor writes:
On Saturday 13 July 2002 21:57, Jesse Marlin wrote:
Hi Jesse
Thanks for your reply. I tried what your little demo and my own trial program using the nvidia header files and both produced a parse error in glu.h. When I ran them with the glut supplied files they both compiled and
What kinds of errors? Show me the output.
ran OK. Do you have any ideas on what caused this to happen. Out of interest when I started my move over to Linux I bought both the OpenGL Programming Guide and the OpenGL Reference Manualas I 've told that these are just about the best books to get me started.
Is that the red book? That is the one I have heard is good. The one I own is "OpenGL Programming for the X Window System", and it has a green cover. Depending on what you are planning to do, using the GLUT toolkit should be adequate. So any book that discusses GLUT and OpenGL should be good enough to get you going. The book I have shows how to use the GLX interface and also GLUT.
Stewart
No you don't want to use that I'm sure. NVIDIA ships with the NVIDIA_GLX-1.0-xxxx package some header files. These should not differ too much from a standard GL.h file except that they probably have definitions for NVIDIA specific extensions.
NVIDIA_GLX-1.0-2960/usr/include/GL/gl/gl.h glx.h glxtokens.h
Copy these into /usr/include/GL or wherever you prefer. Then refer to them with:
#include <GL/glu.h>
This should get you started. If you don't know anything about OpenGL then I suggest you look into the GLUT toolkit. If you write an OpenGL program in Linux it will use the GLX interface whereas in windows it uses the WGL interface. The GLUT hides this from you, and lets you just programm OpenGL.
To get you started with glut here is an example I did a while back that uses OpenGL to plot a koch snowflake. Compile like so:
gcc -c -g koch.c gcc -o koch koch.o -lGL -lGLU -lglut
Don't pay too much attention to the logic. Look in main for how the window is setup, and then look at the different glXXXXX calls. This is a 2d example, but it should help you get started.
Save to file koch.c -------------------------------------------
#include <stdio.h> #include <time.h> #include <math.h> #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h>
#define WIN_HEIGHT 400 #define WIN_WIDTH 400 #define LEVEL 9
static void koch ( int level, float r, float *xleft, float *yleft, float *xright, float *yright );
static void draw_koch ( int level, int x1, int y1, int x0, int y0 );
static void draw_koch ( int level, int x1, int y1, int x0, int y0 ) { float xleft[30], yleft[30], xright[30], yright[30];
xleft[level-1] = (float)x0; yleft[level-1] = (float)y0; xright[level-1] = (float)x1; yright[level-1] = (float)y1;
koch (level-1, (float)0.29, xleft, yleft, xright, yright); }
static void koch ( int level, float r, float *xleft, float *yleft, float *xright, float *yright ) { if (level > 0) { level--;
/* Left Branch */ xleft[level] = xleft[level+1]; yleft[level] = yleft[level+1]; xright[level] = (0.3333f * xright[level+1]) + (0.6667f * xleft[level+1]); yright[level] = (0.3333f * yright[level+1]) + (0.6667f * yleft[level+1]); koch (level, r, xleft, yleft, xright, yright);
/* Middle Left Branch */ xleft[level] = xright[level]; yleft[level] = yright[level]; xright[level] = (0.5f * xright[level+1]) + (0.5f * xleft[level+1]) - (r * (yleft[level+1] - yright[level+1])); yright[level] = (0.5f * yright[level+1]) + (0.5f * yleft[level+1]) + (r * (xleft[level+1] - xright[level+1])); koch (level, r, xleft, yleft, xright, yright);
/* Middle Right Branch */ xleft[level] = xright[level]; yleft[level] = yright[level]; xright[level] = (0.6667f * xright[level+1]) + (0.3333f * xleft[level+1]); yright[level] = (0.6667f * yright[level+1]) + (0.3333f * yleft[level+1]); koch (level, r, xleft, yleft, xright, yright);
/* Right Branch */ xleft[level] = xright[level]; yleft[level] = yright[level]; xright[level] = xright[level+1]; yright[level] = yright[level+1]; koch (level, r, xleft, yleft, xright, yright); level++; } else { glBegin (GL_LINES); glVertex2i ((int)xleft[0], (int)yleft[0]); glVertex2i ((int)xright[0], (int)yright[0]); glEnd (); } }
static int win_width = WIN_WIDTH; static int win_height = WIN_HEIGHT; static int the_level = LEVEL;
static void redraw (void) { time_t start_time, end_time;
printf ("Enter - redraw ()\n"); start_time = time (0);
glClearColor (0.0, 0.0, 0.0, 0.0); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glFlush ();
draw_koch (the_level, 0.0, win_height/2, win_width-1, win_height/2);
end_time = time (0); printf ("Exit - redraw () %d secs\n", end_time - start_time); }
static void reshape (int width, int height) { printf ("Enter - reshape ()\n"); win_width = width; win_height = height; glViewport (0, 0, width, height);
glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluOrtho2D (-0.5, (width + 0.5), -0.5, (height + 0.5));
printf ("Exit - reshape ()\n"); }
static void keyboard (int key, int x, int y) { int changed = 0;
switch (key) { case GLUT_KEY_UP: if (++the_level > 10) the_level = 10; changed = 1; break;
case GLUT_KEY_DOWN: if (--the_level < 1) the_level = 1; changed = 1; break; }
if (changed) glutPostRedisplay (); }
int main (int argc, char **argv) { /* init window parameters. */ glutInitWindowSize (WIN_WIDTH, WIN_HEIGHT); glutInitWindowPosition (100, 100); glutInitDisplayMode (GLUT_RGBA | GLUT_SINGLE | GLUT_DEPTH);
/* create window. */ if (glutCreateWindow ("koch curve") <= 0) exit (0);
/* set display and reshape functions. */ glutDisplayFunc (redraw); glutReshapeFunc (reshape); glutSpecialFunc (keyboard);
/* start GLUT processing loop. */ glutMainLoop (); return 0; }
On Sunday 14 July 2002 19:20, Jesse Marlin wrote:
What kinds of errors? Show me the output.
I've put the output at the end.
Is that the red book? That is the one I have heard is good. The one I own is "OpenGL Programming for the X Window System", and it has a green cover. Depending on what you are planning to do, using the GLUT toolkit should be adequate. So any book that discusses GLUT and OpenGL should be good enough to get you going. The book I have shows how to use the GLX interface and also GLUT.
One is red the other blue. Can you please give me the isbn for "OpenGL Programming for the X Window System" so I can have a look. What is the difference with using GLX as opposed to glut? Stewart The output stewart@linux:~> gcc -c -g /home/stewart/test/kock.c >~/output.txt In file included from /home/stewart/test/kock.c:6: /usr/include/GL/glu.h:261: parse error before `*' /usr/include/GL/glu.h:263: syntax error before `void' /usr/include/GL/glu.h:263: warning: data definition has no type or storage class /usr/include/GL/glu.h:264: syntax error before `void' /usr/include/GL/glu.h:264: warning: data definition has no type or storage class /usr/include/GL/glu.h:265: syntax error before `void' /usr/include/GL/glu.h:265: warning: data definition has no type or storage class /usr/include/GL/glu.h:266: syntax error before `void' /usr/include/GL/glu.h:266: warning: data definition has no type or storage class /usr/include/GL/glu.h:267: syntax error before `GLint' /usr/include/GL/glu.h:267: warning: data definition has no type or storage class /usr/include/GL/glu.h:268: syntax error before `GLint' /usr/include/GL/glu.h:268: warning: data definition has no type or storage class /usr/include/GL/glu.h:269: syntax error before `GLint' /usr/include/GL/glu.h:269: warning: data definition has no type or storage class /usr/include/GL/glu.h:270: syntax error before `GLint' /usr/include/GL/glu.h:270: warning: data definition has no type or storage class /usr/include/GL/glu.h:271: syntax error before `GLint' /usr/include/GL/glu.h:271: warning: data definition has no type or storage class /usr/include/GL/glu.h:272: syntax error before `GLint' /usr/include/GL/glu.h:272: warning: data definition has no type or storage class /usr/include/GL/glu.h:273: syntax error before `GLboolean' /usr/include/GL/glu.h:273: warning: data definition has no type or storage class /usr/include/GL/glu.h:274: syntax error before `void' /usr/include/GL/glu.h:274: warning: data definition has no type or storage class /usr/include/GL/glu.h:275: syntax error before `void' /usr/include/GL/glu.h:275: warning: data definition has no type or storage class /usr/include/GL/glu.h:276: syntax error before `void' /usr/include/GL/glu.h:276: warning: data definition has no type or storage class /usr/include/GL/glu.h:277: syntax error before `void' /usr/include/GL/glu.h:277: warning: data definition has no type or storage class /usr/include/GL/glu.h:278: syntax error before `void' /usr/include/GL/glu.h:278: warning: data definition has no type or storage class /usr/include/GL/glu.h:279: syntax error before `void' /usr/include/GL/glu.h:279: warning: data definition has no type or storage class /usr/include/GL/glu.h:280: syntax error before `void' /usr/include/GL/glu.h:280: warning: data definition has no type or storage class /usr/include/GL/glu.h:281: syntax error before `void' /usr/include/GL/glu.h:281: warning: data definition has no type or storage class /usr/include/GL/glu.h:282: syntax error before `void' /usr/include/GL/glu.h:282: warning: data definition has no type or storage class /usr/include/GL/glu.h:283: syntax error before `const' /usr/include/GL/glu.h:283: parse error before `gluErrorString' /usr/include/GL/glu.h:283: warning: data definition has no type or storage class /usr/include/GL/glu.h:284: syntax error before `void' /usr/include/GL/glu.h:284: warning: data definition has no type or storage class /usr/include/GL/glu.h:285: syntax error before `const' /usr/include/GL/glu.h:285: parse error before `gluGetString' /usr/include/GL/glu.h:285: warning: data definition has no type or storage class /usr/include/GL/glu.h:286: syntax error before `void' /usr/include/GL/glu.h:286: warning: data definition has no type or storage class /usr/include/GL/glu.h:287: syntax error before `void' /usr/include/GL/glu.h:287: warning: data definition has no type or storage class /usr/include/GL/glu.h:288: syntax error before `void' /usr/include/GL/glu.h:288: warning: data definition has no type or storage class /usr/include/GL/glu.h:289: syntax error before `GLUnurbs' /usr/include/GL/glu.h:289: parse error before `gluNewNurbsRenderer' /usr/include/GL/glu.h:289: warning: data definition has no type or storage class /usr/include/GL/glu.h:290: syntax error before `GLUquadric' /usr/include/GL/glu.h:290: parse error before `gluNewQuadric' /usr/include/GL/glu.h:290: warning: data definition has no type or storage class /usr/include/GL/glu.h:291: syntax error before `GLUtesselator' /usr/include/GL/glu.h:291: parse error before `gluNewTess' /usr/include/GL/glu.h:291: warning: data definition has no type or storage class /usr/include/GL/glu.h:292: syntax error before `void' /usr/include/GL/glu.h:292: warning: data definition has no type or storage class /usr/include/GL/glu.h:293: syntax error before `void' /usr/include/GL/glu.h:293: parse error before `_GLUfuncptr' /usr/include/GL/glu.h:293: warning: data definition has no type or storage class /usr/include/GL/glu.h:294: syntax error before `void' /usr/include/GL/glu.h:294: warning: data definition has no type or storage class /usr/include/GL/glu.h:295: syntax error before `void' /usr/include/GL/glu.h:295: warning: data definition has no type or storage class /usr/include/GL/glu.h:296: syntax error before `void' /usr/include/GL/glu.h:296: warning: data definition has no type or storage class /usr/include/GL/glu.h:297: syntax error before `void' /usr/include/GL/glu.h:297: warning: data definition has no type or storage class /usr/include/GL/glu.h:298: syntax error before `void' /usr/include/GL/glu.h:298: warning: data definition has no type or storage class /usr/include/GL/glu.h:299: syntax error before `void' /usr/include/GL/glu.h:299: warning: data definition has no type or storage class /usr/include/GL/glu.h:300: syntax error before `void' /usr/include/GL/glu.h:300: warning: data definition has no type or storage class /usr/include/GL/glu.h:301: syntax error before `void' /usr/include/GL/glu.h:301: warning: data definition has no type or storage class /usr/include/GL/glu.h:302: syntax error before `void' /usr/include/GL/glu.h:302: warning: data definition has no type or storage class /usr/include/GL/glu.h:303: syntax error before `GLint' /usr/include/GL/glu.h:303: warning: data definition has no type or storage class /usr/include/GL/glu.h:304: syntax error before `void' /usr/include/GL/glu.h:304: warning: data definition has no type or storage class /usr/include/GL/glu.h:305: syntax error before `void' /usr/include/GL/glu.h:305: parse error before `_GLUfuncptr' /usr/include/GL/glu.h:305: warning: data definition has no type or storage class /usr/include/GL/glu.h:306: syntax error before `void' /usr/include/GL/glu.h:306: warning: data definition has no type or storage class /usr/include/GL/glu.h:307: syntax error before `void' /usr/include/GL/glu.h:307: warning: data definition has no type or storage class /usr/include/GL/glu.h:308: syntax error before `void' /usr/include/GL/glu.h:308: warning: data definition has no type or storage class /usr/include/GL/glu.h:309: syntax error before `void' /usr/include/GL/glu.h:309: warning: data definition has no type or storage class /usr/include/GL/glu.h:310: syntax error before `GLint' /usr/include/GL/glu.h:310: warning: data definition has no type or storage class /usr/include/GL/glu.h:311: syntax error before `void' /usr/include/GL/glu.h:311: warning: data definition has no type or storage class /usr/include/GL/glu.h:312: syntax error before `void' /usr/include/GL/glu.h:312: warning: data definition has no type or storage class /usr/include/GL/glu.h:313: syntax error before `void' /usr/include/GL/glu.h:313: warning: data definition has no type or storage class /usr/include/GL/glu.h:314: syntax error before `void' /usr/include/GL/glu.h:314: parse error before `_GLUfuncptr' /usr/include/GL/glu.h:314: warning: data definition has no type or storage class /usr/include/GL/glu.h:315: syntax error before `void' /usr/include/GL/glu.h:315: warning: data definition has no type or storage class /usr/include/GL/glu.h:316: syntax error before `void' /usr/include/GL/glu.h:316: warning: data definition has no type or storage class /usr/include/GL/glu.h:317: syntax error before `void' /usr/include/GL/glu.h:317: warning: data definition has no type or storage class /usr/include/GL/glu.h:318: syntax error before `void' /usr/include/GL/glu.h:318: warning: data definition has no type or storage class /usr/include/GL/glu.h:319: syntax error before `void' /usr/include/GL/glu.h:319: warning: data definition has no type or storage class /usr/include/GL/glu.h:320: syntax error before `GLint' /usr/include/GL/glu.h:320: warning: data definition has no type or storage class /usr/include/GL/glu.h:321: syntax error before `GLint' /usr/include/GL/glu.h:321: warning: data definition has no type or storage class /home/stewart/test/kock.c:201: parse error before `--' stewart@linux:~>
Stewart Taylor writes:
On Sunday 14 July 2002 19:20, Jesse Marlin wrote:
What kinds of errors? Show me the output.
I've put the output at the end.
Is that the red book? That is the one I have heard is good. The one I own is "OpenGL Programming for the X Window System", and it has a green cover. Depending on what you are planning to do, using the GLUT toolkit should be adequate. So any book that discusses GLUT and OpenGL should be good enough to get you going. The book I have shows how to use the GLX interface and also GLUT.
One is red the other blue. Can you please give me the isbn for "OpenGL Programming for the X Window System" so I can have a look. What is the difference with using GLX as opposed to glut?
ISBN: 0201483599 When programming in X you have to develop an Event model. A way to handle X events. Usually this is an infinite while loop that only exits when the program exits. Windows has a similar model. What glut tries to do is using the native windowing calls (WGL or GLX) it tries to provide an event model that will work on either X or Windows. You may not give a hoot about Windows but glut greatly simplifies programming in X with OpenGL. But if you need to do something that glut does not provide then you have no choice but to use the GLX calls.
Stewart
The output
stewart@linux:~> gcc -c -g /home/stewart/test/kock.c >~/output.txt In file included from /home/stewart/test/kock.c:6: /usr/include/GL/glu.h:261: parse error before `*' /usr/include/GL/glu.h:263: syntax error before `void' /usr/include/GL/glu.h:263: warning: data definition has no type or storage class
It almost looks like there is no gl.h. Do you have gl.h, glu.h, and glut.h? Did you copy everything from NVIDIA_GLX-1.0-????/usr/include/GL/ to /usr/include/GL? If you have mesa installed then that should be sufficient to use. The NVidia headers will probably be more up to date with their latest extensions. Here is a list of all the files I have:
ls /usr/include/GL gl.h gle.h glu.h glut.h glx.h glxtokens.h
/usr/include/GL/glu.h:264: syntax error before `void' /usr/include/GL/glu.h:264: warning: data definition has no type or storage class /usr/include/GL/glu.h:265: syntax error before `void' /usr/include/GL/glu.h:265: warning: data definition has no type or storage class /usr/include/GL/glu.h:266: syntax error before `void' /usr/include/GL/glu.h:266: warning: data definition has no type or storage class /usr/include/GL/glu.h:267: syntax error before `GLint' /usr/include/GL/glu.h:267: warning: data definition has no type or storage class /usr/include/GL/glu.h:268: syntax error before `GLint' /usr/include/GL/glu.h:268: warning: data definition has no type or storage class /usr/include/GL/glu.h:269: syntax error before `GLint' /usr/include/GL/glu.h:269: warning: data definition has no type or storage class /usr/include/GL/glu.h:270: syntax error before `GLint' /usr/include/GL/glu.h:270: warning: data definition has no type or storage class /usr/include/GL/glu.h:271: syntax error before `GLint' /usr/include/GL/glu.h:271: warning: data definition has no type or storage class /usr/include/GL/glu.h:272: syntax error before `GLint' /usr/include/GL/glu.h:272: warning: data definition has no type or storage class /usr/include/GL/glu.h:273: syntax error before `GLboolean' /usr/include/GL/glu.h:273: warning: data definition has no type or storage class /usr/include/GL/glu.h:274: syntax error before `void' /usr/include/GL/glu.h:274: warning: data definition has no type or storage class /usr/include/GL/glu.h:275: syntax error before `void' /usr/include/GL/glu.h:275: warning: data definition has no type or storage class /usr/include/GL/glu.h:276: syntax error before `void' /usr/include/GL/glu.h:276: warning: data definition has no type or storage class /usr/include/GL/glu.h:277: syntax error before `void' /usr/include/GL/glu.h:277: warning: data definition has no type or storage class /usr/include/GL/glu.h:278: syntax error before `void' /usr/include/GL/glu.h:278: warning: data definition has no type or storage class /usr/include/GL/glu.h:279: syntax error before `void' /usr/include/GL/glu.h:279: warning: data definition has no type or storage class /usr/include/GL/glu.h:280: syntax error before `void' /usr/include/GL/glu.h:280: warning: data definition has no type or storage class /usr/include/GL/glu.h:281: syntax error before `void' /usr/include/GL/glu.h:281: warning: data definition has no type or storage class /usr/include/GL/glu.h:282: syntax error before `void' /usr/include/GL/glu.h:282: warning: data definition has no type or storage class /usr/include/GL/glu.h:283: syntax error before `const' /usr/include/GL/glu.h:283: parse error before `gluErrorString' /usr/include/GL/glu.h:283: warning: data definition has no type or storage class /usr/include/GL/glu.h:284: syntax error before `void' /usr/include/GL/glu.h:284: warning: data definition has no type or storage class /usr/include/GL/glu.h:285: syntax error before `const' /usr/include/GL/glu.h:285: parse error before `gluGetString' /usr/include/GL/glu.h:285: warning: data definition has no type or storage class /usr/include/GL/glu.h:286: syntax error before `void' /usr/include/GL/glu.h:286: warning: data definition has no type or storage class /usr/include/GL/glu.h:287: syntax error before `void' /usr/include/GL/glu.h:287: warning: data definition has no type or storage class /usr/include/GL/glu.h:288: syntax error before `void' /usr/include/GL/glu.h:288: warning: data definition has no type or storage class /usr/include/GL/glu.h:289: syntax error before `GLUnurbs' /usr/include/GL/glu.h:289: parse error before `gluNewNurbsRenderer' /usr/include/GL/glu.h:289: warning: data definition has no type or storage class /usr/include/GL/glu.h:290: syntax error before `GLUquadric' /usr/include/GL/glu.h:290: parse error before `gluNewQuadric' /usr/include/GL/glu.h:290: warning: data definition has no type or storage class /usr/include/GL/glu.h:291: syntax error before `GLUtesselator' /usr/include/GL/glu.h:291: parse error before `gluNewTess' /usr/include/GL/glu.h:291: warning: data definition has no type or storage class /usr/include/GL/glu.h:292: syntax error before `void' /usr/include/GL/glu.h:292: warning: data definition has no type or storage class /usr/include/GL/glu.h:293: syntax error before `void' /usr/include/GL/glu.h:293: parse error before `_GLUfuncptr' /usr/include/GL/glu.h:293: warning: data definition has no type or storage class /usr/include/GL/glu.h:294: syntax error before `void' /usr/include/GL/glu.h:294: warning: data definition has no type or storage class /usr/include/GL/glu.h:295: syntax error before `void' /usr/include/GL/glu.h:295: warning: data definition has no type or storage class /usr/include/GL/glu.h:296: syntax error before `void' /usr/include/GL/glu.h:296: warning: data definition has no type or storage class /usr/include/GL/glu.h:297: syntax error before `void' /usr/include/GL/glu.h:297: warning: data definition has no type or storage class /usr/include/GL/glu.h:298: syntax error before `void' /usr/include/GL/glu.h:298: warning: data definition has no type or storage class /usr/include/GL/glu.h:299: syntax error before `void' /usr/include/GL/glu.h:299: warning: data definition has no type or storage class /usr/include/GL/glu.h:300: syntax error before `void' /usr/include/GL/glu.h:300: warning: data definition has no type or storage class /usr/include/GL/glu.h:301: syntax error before `void' /usr/include/GL/glu.h:301: warning: data definition has no type or storage class /usr/include/GL/glu.h:302: syntax error before `void' /usr/include/GL/glu.h:302: warning: data definition has no type or storage class /usr/include/GL/glu.h:303: syntax error before `GLint' /usr/include/GL/glu.h:303: warning: data definition has no type or storage class /usr/include/GL/glu.h:304: syntax error before `void' /usr/include/GL/glu.h:304: warning: data definition has no type or storage class /usr/include/GL/glu.h:305: syntax error before `void' /usr/include/GL/glu.h:305: parse error before `_GLUfuncptr' /usr/include/GL/glu.h:305: warning: data definition has no type or storage class /usr/include/GL/glu.h:306: syntax error before `void' /usr/include/GL/glu.h:306: warning: data definition has no type or storage class /usr/include/GL/glu.h:307: syntax error before `void' /usr/include/GL/glu.h:307: warning: data definition has no type or storage class /usr/include/GL/glu.h:308: syntax error before `void' /usr/include/GL/glu.h:308: warning: data definition has no type or storage class /usr/include/GL/glu.h:309: syntax error before `void' /usr/include/GL/glu.h:309: warning: data definition has no type or storage class /usr/include/GL/glu.h:310: syntax error before `GLint' /usr/include/GL/glu.h:310: warning: data definition has no type or storage class /usr/include/GL/glu.h:311: syntax error before `void' /usr/include/GL/glu.h:311: warning: data definition has no type or storage class /usr/include/GL/glu.h:312: syntax error before `void' /usr/include/GL/glu.h:312: warning: data definition has no type or storage class /usr/include/GL/glu.h:313: syntax error before `void' /usr/include/GL/glu.h:313: warning: data definition has no type or storage class /usr/include/GL/glu.h:314: syntax error before `void' /usr/include/GL/glu.h:314: parse error before `_GLUfuncptr' /usr/include/GL/glu.h:314: warning: data definition has no type or storage class /usr/include/GL/glu.h:315: syntax error before `void' /usr/include/GL/glu.h:315: warning: data definition has no type or storage class /usr/include/GL/glu.h:316: syntax error before `void' /usr/include/GL/glu.h:316: warning: data definition has no type or storage class /usr/include/GL/glu.h:317: syntax error before `void' /usr/include/GL/glu.h:317: warning: data definition has no type or storage class /usr/include/GL/glu.h:318: syntax error before `void' /usr/include/GL/glu.h:318: warning: data definition has no type or storage class /usr/include/GL/glu.h:319: syntax error before `void' /usr/include/GL/glu.h:319: warning: data definition has no type or storage class /usr/include/GL/glu.h:320: syntax error before `GLint' /usr/include/GL/glu.h:320: warning: data definition has no type or storage class /usr/include/GL/glu.h:321: syntax error before `GLint' /usr/include/GL/glu.h:321: warning: data definition has no type or storage class /home/stewart/test/kock.c:201: parse error before `--' stewart@linux:~>
On Monday 15 July 2002 14:00, Jesse Marlin wrote:
ISBN: 0201483599
Thanks I'll check out this book.
When programming in X you have to develop an Event model. A way to handle X events. Usually this is an infinite while loop that only exits when the program exits. Windows has a similar model. What glut tries to do is using the native windowing calls (WGL or GLX) it tries to provide an event model that will work on either X or Windows. You may not give a hoot about Windows but glut greatly simplifies programming in X with OpenGL. But if you need to do something that glut does not provide then you have no choice but to use the GLX calls.
Sounds as if all I'll need, at least for the time being, is glut.
It almost looks like there is no gl.h. Do you have gl.h, glu.h, and glut.h? Did you copy everything from NVIDIA_GLX-1.0-????/usr/include/GL/ to /usr/include/GL? If you have mesa installed then that should be sufficient to use. The NVidia headers will probably be more up to date with their
I opened the rpm in KPackage and gl.h, glx.h and glxtokens.h were shown as being place din usr/share/docs/packages/nv_glx/usr/include/GL these were the only files in that directory and I copied them all. So far it seems that mesa works fine as the demo programs from the OpenGL Programming Guide work as they should.
latest extensions. Here is a list of all the files I have:
ls /usr/include/GL
gl.h gle.h glu.h glut.h glx.h glxtokens.h
I have all these files in my /usr/include/GL Stewart
participants (2)
-
Jesse Marlin
-
Stewart Taylor