Jump to content

  • Log In with Google      Sign In   
  • Create Account

JOGL and Texture mapping


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 JDev   Members   -  Reputation: 100

Like
0Likes
Like

Posted 11 November 2004 - 12:44 PM

hello everyone, I'm having a problem with my 3D engine that is written in Java and JOGL. I am using the NeHe texture mapping program as an example and I'm loading his sample png image in my current program. I can load the image just fine, but then all I can see in my world is blue, white, and a dark green.....? My world is very simple right now, just a box that I can fly around in and each side of the box is a diffrent color. I'm attaching the image to a glQuad, and that is the only place currently that loads or draws any textures at all. Anybody else have a simular problem with JOGL...? thanks in advance, JDev

Sponsor:

#2 GKW   Members   -  Reputation: 200

Like
0Likes
Like

Posted 12 November 2004 - 05:03 AM

The problem is probably the texture not JOGL. How are you loading the texture? Have you tried a different texture to see if maybe the texture is saved in a format that isn't supported by java?
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson

#3 Solias   Members   -  Reputation: 560

Like
0Likes
Like

Posted 12 November 2004 - 06:18 AM

Post your setup and drawing code. Do you have texturing enabled? Are you using lighting? Can you see the quad at all? If so what color is it? Does it look textured, even if the terxture is wrong? I assume from your description the blue white and green you see are the sides of the box, or is that on the quad? Maybe post a screenshot if you think it would help.

If you have lighting on, try turning it off until you get textures working. Make sure textures are enabled and you are loading the texture into opengl correctly. If you are enabling any opengl state you don't absolutely need, comment that out. If you don't see the quad at all, check the position of the quad and the modelview matrix, also check the winding of the verts. Try turning off backface culling or swaping the winding order. It's pretty easy to draw geometry backwards or in a place you aren't expecting.

Try generating a simple test texture. Fill an array with a single color or maybe a simple pattern. Then load that as your texture. If you can get that working then the problem is in your png loader.

If you can see the quad but it is the wrong color check your texture coords, make sure you are setting them and they make sense. Also check all your opengl texture state, try using default values.

If the quad is drawn and textured, but the texture is wrong, check your texture loading code. Check your unpack alignment settings. Check the pixel format you are using, make sure it matches your data. Some file formats are bgr instead of rgb, if this is the case with yours you'll need to swap the bytes or if your opengl implementation supports it you can use the bgr format.



#4 JDev   Members   -  Reputation: 100

Like
0Likes
Like

Posted 12 November 2004 - 11:54 AM

This is going to sound really stupid, but I'm still really new to openGL. I was enabling texture mapping at the begining of my program and didn't disable it when I was drawing things that were not being texture mapped. Everything that was being drawn using the normal glColor3f functions had texture mapping enabled on them, but no points were specified. So basically, everything was being texture mapped with the one pixel at 0,0 of my default texture.
thanks for the reply's guys,
JDev




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS