PDA

View Full Version : textures: work without lighting? and what about non-powers of 2?



dovkruger
02-02-2005, 01:05 PM
I have working code that displays a false-color image in ortho mode at z=0 without lighting. I put a texture behind it mapped to z=-0.5.

In order to show the texture, I call

glEnable(GL_TEXTURE_2D)

The rest of the world goes dim. Do textures automatically imply that I need lighting?

Second, I would dearly like to use non-power-of-2 texture sizes. I thought this was supported by some extras pre-2.0. Given that I am running on NVIDIA FX-5200 and FX-5700, is there any quick way for me to enable non-power-of-2 textures?

02-02-2005, 03:14 PM
No you can have textures without lighting, just be sure that you are not using modulated textures in your program i.e. GL_MODULATE when you are setting them up, try GL_REPLACE for a quick fix...

or change the glColor to white, (chances are its black and the modulation of the texture is causing it to display the texture black).

With regards to non-powers of 2, i think thats proposed for the 2.0 spec, there are work arounds i believe but they seem quite complicated, if i were you i'd just stick to n^2 textures, use a program like photoshop and just save a normal texture specifying the x and y as the same value (make sure you turn off the aspect ratio lock!)

Hope this helps, if not add me on msn or email me: nonchaotic@hotmail.com

Relic
02-02-2005, 10:53 PM
If you enable texturing for your background image, you need to disable textureing again before you draw the rest of your scene. Other than that, disable lighting for the background and set the glColor to white or simply use GL_DECAL as texture env mode.

Rectangular textures on GeForce FX boards should work with one of the texture_rectangle extensions: http://oss.sgi.com/projects/ogl-sample/registry/
Note that your texture coordinates need to be 0..width, 0..height instead of 0.0 to 1.0 for those and texture_rectangles don't support mipmapping.