Hi All,
Any body can help me to write conversion program for the following code below-
void draw()
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (0.0, 0.0, 1.0);
glLoadIdentity ();
//Render Point Shapefile
glColor3f (0.0, 0.0, 1.0);
glEnable(GL_POINT_SMOOTH) ;
glPointSize(5.0);
//glBegin(GL_POINTS);
for(unsigned int i=0;i<vPoints.size();i++)
{
glVertex2f(vPoints[i].dX,vPoints[i].dY);
}
glEnd();
//Render Line Shapefile
glColor3f (0.0, 1.0, 0.0);
for(unsigned int i=0;i<vLines.size();i++)
{
glBegin(GL_LINE_STRIP);
for(unsigned int j=0;j<vLines[i].vPointList.size();j++)
{
glVertex2f(vLines[i].vPointList[j].dX,vLines[i].vPointList[j].dY);
}
glEnd();
}
//Render Polygon Shapefile
glColor3f(1.0,0.0, 0.0);
for(unsigned int i=0;i<vPolygons.size();i++)
{
glBegin(GL_LINE_LOOP);
for(unsigned int j=0;j<vPolygons[i].vPointList.size();j++)
{
glVertex2f(vPolygons[i].vPointList[j].dX,vPolygons[i].vPointList[j].dY);
}
glEnd();
}
glFlush();
}
GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent) {
setMouseTracking(true);
}
void GLWidget::initializeGL() {
glClearColor (0.0, 0.0, 0.0, 0.0);
// glClearColor (1.0, 1.0, 1.0, 1.0);
glShadeModel (GL_FLAT);
glEnable (GL_LINE_SMOOTH);
glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
//Assign Default Map Bounds to glOrtho
sBoundingBox.fMaxX=180.0f;
sBoundingBox.fMaxY=90.0f;
sBoundingBox.fMinX=-180.0f;
sBoundingBox.fMinY=-90.0f;
}
void GLWidget::resizeGL(int w, int h) {
OpenShapeFile("test.shp");
//OpenShapeFile("/root/dev/qt_shape_view/shapeView/Shapefiles/test.shp");
if(h<=0) h=1 ;
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
//Assign Bounding Box Coordinates of Shapefile to glOrtho()
glOrtho(sBoundingBox.fMinX, sBoundingBox.fMaxX,sBoundingBox.fMinY,sBoundingBox .fMaxY,-1,1);
glMatrixMode(GL_MODELVIEW);
}
void GLWidget:aintGL() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
draw();
}
This is written for ubuntu desktop opengl and want to port it to opengl es2.
Regards,
swapan
Bookmarks