Jump to content
  • Advertisement
Sign in to follow this  

no textures/milkshape3d

This topic is 4906 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi @all! i have this problem: i downloaded the nehe sdk (very cool) and now wanted to make a pong-opengl-clone as a first program. i want to use a ms3d model as the ball, just for testing model loading. so i created this cool ball and put in some model loading code. but when i start the app, the ball has no textures! its just white! i saw something in milkshape.cpp that says only milkshape 1.3 and 1.4 models are supported. i have milkshape 1.7.4. does anyone know if there is some newer ms3d loading code? (i change the line from 1.4 to 1.7, now i have a kind of black brown ball, lol). plz help ^^

Share this post

Link to post
Share on other sites
check if you have texturing enabled ( glEnable(GL_TEXTURE2D) etc)

also check to see if your textures are loaded
if your ball is textured, do you provide the texture image file with the model file? I mean, do you have the jpg (ar tga or whatever) in the same dir with the ms3d file?
I dont remeber if the texture filename is absolute or relative to the model..... you should check that also

Share this post

Link to post
Share on other sites
i think i made everything right, because this cross model from nehe's lesson 31 tut is loaded properly. and yes, i put the teture in the right directory. for testing, i set the texturing to false and changed the material of the ball to a green color, it appears green too in the program, but if i set texturing to true, its almost invisible because of the black color. o already changed some of the diffuse, emmissive etc. colors but it stays black. any ideas?

Share this post

Link to post
Share on other sites
Common texture errrors:

a) texture is not power of 2
b) texture not loaded
c) texture file not found
d) wrong texture parameters

Most of this can be cought if you check for errors after glBindTexture(). Also make sure that you check that there are no errors while reading the texturefile. If fopen() returns NULL, make sure to check the errno value.

if you have lighting enabled, you might also have set wrong lighting parameters. Try without.

Don't be lazy, check for errors, when there can be some. (this I learned the hard way :)

Share this post

Link to post
Share on other sites
here is the modified source code of the model loading example from the nehe sdk:

// example 7: model loading

#include "opengl.h"
#include "view.h"
#include "texture.h"
#include "text.h"
#include "md2.h"
#include "milkshape.h"
#include "model.h"

using namespace NeHe;

static bool init=true; // initialisation flag
static Texture tex; // the texture manager
static Model model; // the marine model
static Model kugel1; // the jeep model
static MD2 md2; // the MD2 model loader
static Milkshape milk; // milkshape model loader
static int numframes; // number of frames
static int frame=0; // present frame
static float framepos=0; // frame position
static View view; // the view controller
static Text2D txt; // 2d text handler
static int fps; // the last fps
static int fpsct=0; // fps counter

void InitScene(OpenGL *gl,ControlData *cont)
// Setup the font

// choose a font
TextType ttype;
ttype.name="Courier New";
// setup the text handler

// load the model file

// load the jeep

// get the number of frames

void DrawScene(OpenGL *gl,ControlData *cont)
// initialize scene
// do we need to quit?

// draw the model

// draw the jeep

// do we need to restart the animation?
// check fps?
}else if(fpsct>=cont->fps)

// write out the FPS
(cont->state)->SetColour(Colour(1.0f,1.0f,1.0f)); // Write out in white
view.Reset(); // reset the view
view.Translate(0.0f,0.0f,-0.11f); // translate back a little
view.Pos2D(-0.055f,0.035f); // move to top left
txt << "FPS:" << fps; // and write out the FPS


Share this post

Link to post
Share on other sites
if i remember correctly i had the same problem a while ago
i can't be sure, but i think the problem was that newer milkshape versions store texture filename differently than previuos versions (i cant remember how exactly)...
I suggest you to check where the filename of texture is extracted from milkshape file

Share this post

Link to post
Share on other sites
Jnz86 is right, older Milkshape models used an absolute path but newer versions, possibly ones after 1.4 - I'm not 100% sure, use a relative path. You say you downloaded the SDK, which version did you download? There's a SDK for 1.7.x models I'm sure; yep here it is: clicky (51Kb).

If this doesn't fix your problem them nefthy's list of items to check is a very good place to start debugging your code.

Good luck :)

Share this post

Link to post
Share on other sites
thx for the suggestions, but i downloaded the NEHE-SDK not the ms3d sdk. well, i found out something funny: i merged my fancy ball with the old cross model from nehe's lesson 31 and applied the material of it to the ball. i saved it and started the program, and voila, the ball has a wood texture!
i think the file formats cause this "no textures"-bug. has anyone a loader for 1.7.xx files, or knows how to change the existing code?

Share this post

Link to post
Share on other sites
Old problem this one, search the web for Brett Porters site REAL SOON , he has the updated 31 lesson which I downloaded and got to work since he wrote it in the first place



Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!