Link to home
Start Free TrialLog in
Avatar of jsbsudha
jsbsudhaFlag for Germany

asked on

using opengl in VC++ win32 console application

I have GLUT library  in my vc++ console application... as i want to use glepolycylinder function I also added GLE.h...but  the application shows error as following

Error      4      error LNK2019: unresolved external symbol _glePolyCylinder referenced in function "void __cdecl display(void)" (?display@@YAXXZ)

Is  there any procedure to install GLE in my GLUT librray........

#include<iostream>	
#include<conio.h>
#include<stdlib.h>
#include <GL\glut.h>
#include "GL\glui.h"
#include"GL\gle.h"
 
#define NPTS 6
double points [NPTS][3];
float colors [NPTS][3];
int idx = 0;
 
 
GLfloat diffuseMaterial[4] = { 0.5, 0.5, 0.5, 1.0 };
	float x = 0.5,y = 0.5,z = 0.5;
int angle = 0;
 
/* some utilities for filling that array */
#define PNT(x,y,z) { 			\
   points[idx][0] = x; 			\
   points[idx][1] = y; 			\
   points[idx][2] = z;			\
   idx ++;				\
}
 
#define COL(r,g,b) { 			\
   colors[idx][0] = r; 			\
   colors[idx][1] = g; 			\
   colors[idx][2] = b;			\
}
 
/* 
 * Initialize a bent shape with three segments. 
 * The data format is a polyline.
 *
 * NOTE that neither the first, nor the last segment are drawn.
 * The first & last segment serve only to determine that angle 
 * at which the endcaps are drawn.
 */
 
 
 
/* draw the cylinder shape */
 
 
 
 
void init(void)
{
	glClearColor (0.0, 0.0, 0.0, 0.0);
	
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
 
glShadeModel (GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuseMaterial);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialf(GL_FRONT, GL_SHININESS, 25.0);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glColorMaterial(GL_FRONT, GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
 //initialize the join style here */
   gleSetJoinStyle (1);
 
   COL (0.0, 0.0, 0.0);
   PNT (-6.0, 6.0, 0.0);
 
   COL (0.0, 0.8, 0.3);
   PNT (6.0, 6.0, 0.0);
 
   COL (0.8, 0.3, 0.0);
   PNT (6.0, -6.0, 0.0);
 
   COL (0.2, 0.3, 0.9);
   PNT (-6.0, -6.0, 0.0);
 
   COL (0.2, 0.8, 0.5);
   PNT (-6.0, 6.0, 0.0);
 
   COL (0.0, 0.0, 0.0);
   PNT (6.0, 6.0, 0.0);
}
 
void display(void)
{
GLUquadricObj *quadratic;
	quadratic = gluNewQuadric();
	
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(0.0,1.0,0.0);
 
 
glBegin( GL_LINES );
 
glColor3f( 1.f, 0.f, 0.f ); // Sets current primary color to red
glVertex3f( 0.f, 0.f, 0.f ); // Specify three vertices
glVertex3f( 4.f, 0.f, 0.f );
 
glColor3f( 0.f, 1.f, 0.f ); // Sets current primary color to Green
glVertex3f( 0.f, 0.f, 0.f ); // Specify three vertices
glVertex3f( 0.f, 4.f, 0.f );
 
glColor3f( 0.f, 0.f, 1.f ); // Sets current primary color to Blue
glVertex3f( 0.f, 0.f, 0.f ); // Specify three vertices
glVertex3f( 0.f, 0.f, 4.f );
 
glColor3f( 1.f, 0.f, 1.f ); // Sets current primary color to Magenta
glVertex3f( 0.f, 0.f, 0.f ); // Specify three vertices
glVertex3f( 1.f, 1.f, 1.f );
 
glEnd();
 
glBegin( GL_LINES );
glColor3f( 1.f, 1.f, 1.f ); // Sets current primary color to white
//glRotatef(45,0,1,0);
//glRotatef(-45,1,0,0);
glVertex3f( 0.f, 0.f, 0.f ); // Specify two vertices
glVertex3f( 1.5f, 1.5f, 0.f );
glEnd();
 
glLoadIdentity();
 
  /* Phew. FINALLY, Draw the polycylinder  -- */
   glePolyCylinder (NPTS, points, colors, 2.3);
 
	glutSwapBuffers();
}
void reshape (int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
glOrtho(-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w,
2.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);
else
glOrtho(-2.5*(GLfloat)w/(GLfloat)h,
2.5*(GLfloat)w/(GLfloat)h, -2.5, 2.5, -10.0, 10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
 
 
int main(int argc, char **argv)
 
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize (640, 480);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}

Open in new window

Avatar of jkr
jkr
Flag of Germany image

Are you linking with 'gle.lib'?
BTW, you can get that from http://www.linas.org/gle - usually, that is. Currently, I cannot load that page.
Avatar of jsbsudha

ASKER

No I am not linking with GLE librray...... what is the procedure to install........I will look into your link.......0please wait
your link is not working.......I just added header fie GLE.h in the GL directory.
go to "project-settings" / "linker" and add gle.lib to the input librarys. then your programm can be linked with gle ..
including the header file is not linking .. did you install gle?
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
here is how you install it properly:

http://www.gle-graphics.org/tut/windows.html

Since the asker already has the header file, the matching library should be there also. Otherwise, even more would go wrong.
>> No I am not linking with GLE librray...... what is the procedure to install..Otherwise, even more would go wrong.

asker did not seem to know if he/she installed ot not ..
Thank you ...I have solved the errors by linking the GLE librray...........