82% done

Published December 23, 2008
Advertisement
Ok so the menus did not come out the way I like but I have menus now. To get the kind I want I will have to write my own in glut but for now if you use the mouse right button a menu pops up with options and such.

code for the menus:
        //Glut Menu//	submenu =  glutCreateMenu(menu);	glutAddMenuEntry("New", 2);	glutAddMenuEntry("Load", 3);	glutAddMenuEntry("Exit", 4);	submenu2 = glutCreateMenu(menu);	glutAddMenuEntry("Load", 5);	menuip = glutCreateMenu(menu);	glutAddSubMenu("File",submenu);	glutAddSubMenu("Obj", submenu2);	glutAttachMenu(GLUT_RIGHT_BUTTON);	//Glut Menu//


*update*

ok I now have a some what working loader. I still need to add a box where you can enter the name of the file but other than that it uploads it to the screen.So far the image is only 2d on the screen but so ill need to fix that too. I wanted to load a cube from blender but for some reason the image drawn was not a cube. Did it get the obj data of the camera in blender or my draw method or my loader method needs some work...

Free Image Hosting at www.ImageShack.us

Source of the loader:
//objLoader//void loadObj(char* filename) {	char line[100];	FILE *fp;	errno_t err;	err = fopen_s(&fp,filename,"r");	cout << "opened: " << filename << endl;	if(fp != NULL) {		while(fgets(line,99,fp)) {			if(line[0] == 'v') {				sscanf(line, "%*c %f %f %f", &v[vertexCount].x, &v[vertexCount].y, &v[vertexCount].z);				vertexCount++;			}else{				sscanf(line, "%*c %d %d %d", &t[triangleCount].v1, &t[triangleCount].v2, &t[triangleCount].v3);				triangleCount++;			}		}	}	fclose(fp);	loadedFile = true;}//objLoader//        //objLoader Draw//	if(loadedFile = true) {		glBegin(GL_TRIANGLES);		for(int i = 0; i < triangleCount; i++) {			glVertex3f(v[t.v1-1].x * 0.25, v[t.v1-1].y * 0.25, v[t.v1-1].z * 0.25);			glVertex3f(v[t.v2-1].x * 0.25, v[t.v2-1].y * 0.25, v[t.v2-1].z * 0.25);			glVertex3f(v[t.v3-1].x * 0.25, v[t.v3-1].y * 0.25, v[t.v3-1].z * 0.25);		}		glEnd();		glFlush();	}	//objLoader Draw//
Previous Entry Update on my Map Tool
Next Entry update
0 likes 2 comments

Comments

nerd_boy
Not sure if you've got the file format specs or not so this may be of some help.

I tried doing a quick search for blender file loader dlls, since I would have imagined there would be one, but I had no such luck. Perhaps my googlfu isn't with me, today.
December 23, 2008 02:32 PM
LostSnow25
thx for the help but iv found a forum that had a example of the loader and with some tinkering made it work. i updated my post with the results. I just need to find out if its the obj file that was incorrect or my draw or loader method that is buged for making a some what incomplete cube.
December 23, 2008 02:37 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement

Latest Entries

eh?

946 views

so sad...

942 views

Stage 1: Update 1

822 views

-sign-

990 views

update

783 views

82% done

911 views

So it Begins....

673 views

First Entry YAYSSS

759 views
Advertisement