Texturing not working...

Member
Posts: 509
Joined: 2002.05
Post: #1
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

PHP Code:
glEnableGL_TEXTURE_2D );                // Enable texture mapping
   
glShadeModelGL_SMOOTH );                // Enable smooth shading
   
glClearColor0.0f0.0f0.0f0.5f );   // Black background
   
glClearDepth1.0f );                     // Depth buffer setup
   
glEnableGL_DEPTH_TEST );                // Enable depth testing
   
glDepthFuncGL_LEQUAL );                 // Type of depth test to do
   // Really nice perspective calculations
   
glHintGL_PERSPECTIVE_CORRECTION_HINTGL_NICEST );

   
// Setup ambient light
   
glLightfvGL_LIGHT1GL_AMBIENTlightAmbient );
   
// Setup diffuse light
   
glLightfvGL_LIGHT1GL_DIFFUSElightDiffuse );
   
// Position the light
   
glLightfvGL_LIGHT1GL_POSITIONlightPosition );
   
glEnableGL_LIGHT1 );   // Enable light 1
   
glEnableGL_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
Quote this message in a reply
Mars_999
Unregistered
 
Post: #2
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?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
Does your model have pinned texture mapping? The loader doesn't cope with planar, cylindrical or spherical mapping IIRC...
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #4
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)
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #5
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.
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #6
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?
Quote this message in a reply
Member
Posts: 177
Joined: 2002.08
Post: #7
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?
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #8
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.
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #9
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 Smile
Quote this message in a reply
henryj
Unregistered
 
Post: #10
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.
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #11
I just submitted the bug to apple, i will let you know the outcome.
Quote this message in a reply
Post Reply