[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1261
  • Last Modified:

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

0
jsbsudha
Asked:
jsbsudha
  • 5
  • 4
  • 3
1 Solution
 
jkrCommented:
Are you linking with 'gle.lib'?
0
 
jkrCommented:
BTW, you can get that from http://www.linas.org/gle - usually, that is. Currently, I cannot load that page.
0
 
jsbsudhaAuthor Commented:
No I am not linking with GLE librray...... what is the procedure to install........I will look into your link.......0please wait
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
jsbsudhaAuthor Commented:
your link is not working.......I just added header fie GLE.h in the GL directory.
0
 
ikeworkCommented:
go to "project-settings" / "linker" and add gle.lib to the input librarys. then your programm can be linked with gle ..
0
 
ikeworkCommented:
including the header file is not linking .. did you install gle?
0
 
jkrCommented:
>>your link is not working

Well, I mentioned that. But, since you have a gle.h, you should have a gle.lib from the same archive. Just add that to your project using either

#pragma comment(lib,"gle.lib")

or go to "Project", "Add Existing Item", change teh extension to "*.lib", navigate to gle.lib and select it.
0
 
ikeworkCommented:
here is how you install it properly:

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

0
 
ikeworkCommented:
0
 
jkrCommented:
Since the asker already has the header file, the matching library should be there also. Otherwise, even more would go wrong.
0
 
ikeworkCommented:
>> 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 ..
0
 
jsbsudhaAuthor Commented:
Thank you ...I have solved the errors by linking the GLE librray...........
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now