CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2006
    Posts
    13

    opengl problems with texturing

    I am not having problems with texturing objects but having non textured objects display. They will display, but it will always be black no matter what color i set the non textured object to.also i am baseing this off of the tutorial on http://nehe.gamedev.net/data/lessons....asp?lesson=19
    and i am using bloodshed Dev-C++ compiler
    heres the InitGL section of the code:
    Code:
    int InitGL(GLvoid)										// All Setup For OpenGL Goes Here
    {
    	if (!LoadGLTextures())								// Jump To Texture Loading Routine
    	{
    		return FALSE;									// If Texture Didn't Load Return FALSE
    	}
    
    	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);							// Enables Depth Testing
        glDepthFunc(GL_LEQUAL);								// The Type Of Depth Testing To Do
    	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations
        glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
    	glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);		// Setup The Ambient Light
    	glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);		// Setup The Diffuse Light
    	glLightfv(GL_LIGHT1, GL_POSITION,LightPosition);	// Position The Light
    	glEnable(GL_LIGHT1);								// Enable Light One
    	glEnable(GL_LIGHTING);					// Enable Lighting				( NEW )
    	glEnable(GL_COLOR_MATERIAL);				// Enable Coloring Of Material			( NEW )
    
    	BuildFont();
        			
        return TRUE;										// Initialization Went OK
    }
    if you want to see any other parts of the code just ask

    thanks-

  2. #2
    Join Date
    Dec 2005
    Location
    Prague, Czech Republic
    Posts
    208

    Re: opengl problems with texturing

    You have to disable texturing when you draw non-textured colored polygons. Then, enable it again for textured polygons.

    ...
    glEnable(GL_TEXTURE_2D);
    draw textured objects
    glDisable(GL_TEXTURE_2D);
    draw colored objects
    ...

  3. #3
    Join Date
    Nov 2006
    Posts
    49

    Re: opengl problems with texturing

    i also got a problem..

    mind looking at the code.. i can do basic quad wrapping but not triangle wrapping..

    thanx..
    Attached Files Attached Files

  4. #4
    Join Date
    Apr 2006
    Posts
    13

    Re: opengl problems with texturing

    thanks alot for the help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured