Texturing not working...
I am trying to merge the Meshworks Importer source from the iDG site into the NeHe tutorial, so I can load a model. Right now I have it to the point where it loads the map file, and displays it, except EVERYTHING is a different shade of grey. So I think everything is working (shading, loading model, sending the triangles to GL ect), EXCEPT the texturing. Here is some code
Thats my setup code, is there a problem there? Could it be in the pixel setup (i don't know much about that).
Thanks in advance
PHP Code:
glEnable( GL_TEXTURE_2D ); // Enable texture mapping
glShadeModel( GL_SMOOTH ); // Enable smooth shading
glClearColor( 0.0f, 0.0f, 0.0f, 0.5f ); // Black background
glClearDepth( 1.0f ); // Depth buffer setup
glEnable( GL_DEPTH_TEST ); // Enable depth testing
glDepthFunc( GL_LEQUAL ); // Type of depth test to do
// Really nice perspective calculations
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
// Setup ambient light
glLightfv( GL_LIGHT1, GL_AMBIENT, lightAmbient );
// Setup diffuse light
glLightfv( GL_LIGHT1, GL_DIFFUSE, lightDiffuse );
// Position the light
glLightfv( GL_LIGHT1, GL_POSITION, lightPosition );
glEnable( GL_LIGHT1 ); // Enable light 1
glEnable( GL_LIGHTING );
glEnableClientState(GL_VERTEX_ARRAY);
Thats my setup code, is there a problem there? Could it be in the pixel setup (i don't know much about that).
Thanks in advance
Well for one do you have a texture loaded? Some code of your own to load textures or a library? If so, do you have glGenTextures(); glBindTexture() and setup the parameters for the textures?
Does your model have pinned texture mapping? The loader doesn't cope with planar, cylindrical or spherical mapping IIRC...
Quote:Originally posted by OneSadCookie
Does your model have pinned texture mapping? The loader doesn't cope with planar, cylindrical or spherical mapping IIRC...
It has planar, I will try pinned, but I thought it worked with planer, just not cylinder or sphere mapping. anyways, setting it to pinned didn't help.
Mars, Yes I do, its in the code from the meshworks importer.
Could the pixel format have anything to do with this, I am not 100% clear on the pixel format yet (I haven't examined the code real well)
After some NSLogging, it seams the program doesn't think it should be textured, so its not assigning them one... weird. Im going to try a new model.
It turns out when you move a file from the project folder into your program.app/contents/resources/ folder, Project builder gets rid of the resource fork (where textures are stored in Meshworks files). Is there anyway to tell the compiler to leave the resource fork alone when it compiles?
PB is probably using a version of cp that does not preserve resource forks. I'm really not sure how you'd get around it, though. Maybe store the textures in external files that don't rely on deprecated OS features?
Add a 'shell script files' build phase to your target, and copy the files into place yourself using CpMac or ditto.
But, yes, the resource fork is deprecated, so a better solution is to move the textures into their own file.
But, yes, the resource fork is deprecated, so a better solution is to move the textures into their own file.
I don't even need to use the resource fork anymore, i just wrote some code to load textures in a much better way.
Thanks for the help
Thanks for the help
Quote:Originally posted by Jake
It turns out when you move a file from the project folder into your program.app/contents/resources/ folder, Project builder gets rid of the resource fork (where textures are stored in Meshworks files). Is there anyway to tell the compiler to leave the resource fork alone when it compiles?
If this is true submit a bug to Apple because it shouldn't do this.
I just submitted the bug to apple, i will let you know the outcome.

