Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

82% done

Sign in to follow this  


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("Obj", submenu2);
//Glut Menu//


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:

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);
sscanf(line, "%*c %d %d %d", &t[triangleCount].v1, &t[triangleCount].v2, &t[triangleCount].v3);
loadedFile = true;

//objLoader Draw//
if(loadedFile = true) {

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);
//objLoader Draw//

Sign in to follow this  


Recommended Comments

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.

Share this comment

Link to comment
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.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!