Nvidia driver bug?

Started by elias4444, January 29, 2005, 00:14:42

Previous topic - Next topic

elias4444

In my quest to figure out how on earth to enable multisampling (which I still can't figure out - I'm so clueless), I was fiddling around with my Nvidia antialiasing settings, setting it to 2xQ and turning off the "application controlled" section. When I would then run a windowed lwjgl app (i.e., puppytron), the system would grind to a halt, and the application would bomb out. I tried it with my own non-fullscreen app and got an "out of memory" error.

It seems to work fine with full-screen apps however. Is this a bug? Or am I just unlucky with my hardware these days?  :roll:
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

spasi

I'm not sure if this problem has anything to do with LWJGL, but regarding the "Out of Memory" error, I'm seeing it with all leaked 7X.XX drivers (without antialiasing and may occur at any time - at least I haven't been able to reproduce it). Are you using one of those?

spasi

Oh, for multisampling, here's a standard pixel format you could use:

Display.create(new PixelFormat(24, 8, 24, 0, SAMPLES));


Call it after setting an appropriate display mode. Setting a value > 1 to SAMPLES will enable multisampling (my GeFX supports up to 32 :shock:).

elias4444

Ah, I am running the Nvidia beta drivers (ver. 67.66) from the officialy Nvidia beta driver page. I kind of have to since I've got the 6600gt with the AGP bridge. It doesn't work well with the "current" drivers.

You may want to keep an eye on them though, since the drivers from their beta page are usually the ones that hit stable.

BTW, thanks for the pixelformat. I guess I don't quite understand what pixelformat expects for alpha,depth,etc.. I thought color depth would be something like 24 for 24bit color, along with an alpha of 8 for 8bit alpha channel (to make the 32-bit color display mode that windows likes to run at). This would be a great area to write up some kind of tutorial perhaps.
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

elias4444

BTW, I tried that sample pixelformat you gave me, but I keep getting the following error:
org.lwjgl.LWJGLException: Samples > 0 but could not find a suitable ARB pixel format
	at org.lwjgl.opengl.Win32Display.createContext(Native Method)
	at org.lwjgl.opengl.Display.create(Display.java:530)
	at tools.ScreenManager.<init>(ScreenManager.java:112)
	at texturetester.TextureTester.begin(TextureTester.java:98)
	at texturetester.TextureTester.main(TextureTester.java:85)
Exception in thread "main" java.lang.UnsatisfiedLinkError: nglGenTextures
	at org.lwjgl.opengl.GL11.nglGenTextures(Native Method)
	at org.lwjgl.opengl.GL11.glGenTextures(GL11.java:1031)
	at tools.TextureLoader.createTextureID(TextureLoader.java:83)
	at tools.TextureLoader.getTexture(TextureLoader.java:340)
	at tools.TextureLoader.getTexture(TextureLoader.java:308)
	at tools.FontTranslator.<init>(FontTranslator.java:133)
	at texturetester.TextureTester.begin(TextureTester.java:100)
	at texturetester.TextureTester.main(TextureTester.java:85)

Any ideas what I'm doing wrong?
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

spasi

Could you please post some code?

By the way, this looks very wrong:

Exception in thread "main" java.lang.UnsatisfiedLinkError: nglGenTextures

elias4444

Oh, why not.  :P
Here's my screen manager code for my test app. I think the gentexture error is occuring because the screen isn't initializing - it works fine if I don't specify a specific pixelformat.  Please excuse my mess:
/*
 * Created on Oct 11, 2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package tools;

import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.PixelFormat;
import org.lwjgl.opengl.glu.GLU;


/**
 * @author jea
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class ScreenManager {
	
	private int WIDTH = 1024;
	private int HEIGHT = 768;
	private int rfreq = 60;
	private int displayBPP = 32;
	private boolean vsync = false;
	private boolean fullscreen = false;
	
	public float persdegree = 45f;
	public float nearplane = 5f;
	public float farplane = 1600f;
	public float backgroundzwidth = 1.0f;
	public float backgroundzheight = 1.0f;
	public float zplanematch = 1.0f;
	public float aspectratio = 1.0f;
	
	public ScreenManager(String TITLEPASS, int sizex, int sizey,boolean fullscreenpass,boolean vsyncpass) {
		System.setProperty("org.lwjgl.opengl.Window.undecorated","true");
		
		WIDTH = sizex;
		HEIGHT = sizey;		
		vsync = vsyncpass;
		fullscreen = fullscreenpass;
		
		aspectratio = (float)WIDTH/(float)HEIGHT;
		
		backgroundzwidth = 2f*((float)(Math.tan((persdegree/2f))*farplane));
		backgroundzheight = backgroundzwidth * ((float)HEIGHT/(float)WIDTH);
		
		zplanematch = -((float)((WIDTH/2f)/(Math.tan(persdegree/2f))));
		System.out.println(zplanematch);
		
		int tempxloc = (Display.getDisplayMode().getWidth() - WIDTH)/2;
		int tempyloc = (Display.getDisplayMode().getHeight() - HEIGHT)/2;
		
		try {
			DisplayMode modes[] = Display.getAvailableDisplayModes();
			boolean modeFound = false;
			for (int i = 0; i < modes.length; i++) {
				if (modes[i].getWidth() == WIDTH && 
						modes[i].getHeight() == HEIGHT && 
						modes[i].getBitsPerPixel() == displayBPP) {
					modeFound = true;
					Display.setDisplayMode(modes[i]);
					break;
				}
			}
			
			//// If 32bpp not found, try what they're running... ///////
			if (!modeFound) {
				for (int i = 0; i < modes.length; i++) {
					if (modes[i].getWidth() == WIDTH && 
							modes[i].getHeight() == HEIGHT && 
							modes[i].getBitsPerPixel() == org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel()) {
						modeFound = true;
						Display.setDisplayMode(modes[i]);
						break;
					}
				}
			}
			
			//// If 16bpp doesn't exist, forget it //////
			if (!modeFound) throw new Exception();
		} catch (Exception e) {
			e.printStackTrace(System.err);
			Sys.alert(TITLEPASS + "Error", "Unable to set desired display " +
					"mode ("+WIDTH+"x"+HEIGHT+"x"+displayBPP+").");
			System.exit(0);
		}
		
		rfreq = Display.getDisplayMode().getFrequency();
		
		try {
			Display.setTitle(TITLEPASS);
			Display.setFullscreen(fullscreen);
			Display.setVSyncEnabled(vsync);
			Display.setLocation(tempxloc,tempyloc);

			PixelFormat pf = new PixelFormat(24,8,24,0,8);
			Display.create(pf);
			//Display.create();
			
			GL11.glEnable(GL11.GL_TEXTURE_2D);
			GL11.glEnable(GL11.GL_NORMALIZE);
			// Setup translucency
			GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
			GL11.glEnable(GL11.GL_BLEND);
			
			GL11.glShadeModel(GL11.GL_SMOOTH);
			GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
			GL11.glClearDepth(1.0);
			GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
			GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do
			
			GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
			GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
			GL11.glEnable(GL11.GL_LINE_SMOOTH);
			
			// OpenGL uses a backwards x,y coordinate system, so use GL_BACK for culling
			//GL11.glCullFace(GL11.GL_BACK);
			//GL11.glEnable(GL11.GL_CULL_FACE);
			
			// Setup Sphere mapping, but don't turn it on... yet ///
			GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_SPHERE_MAP);
			GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_SPHERE_MAP);

			
			// Setup matrix Mode
			GL11.glMatrixMode(GL11.GL_PROJECTION);
			GL11.glLoadIdentity(); // reset projection matrix

			GLU.gluPerspective(persdegree,aspectratio,nearplane,farplane);
			GL11.glMatrixMode(GL11.GL_MODELVIEW); // Select The Modelview Matrix
			GL11.glLoadIdentity();

			//// Add some light /////
			GL11.glEnable(GL11.GL_LIGHT1);
			GL11.glEnable(GL11.GL_LIGHTING);
			/////////////////////////
			
			// Setup keyboard input
			Keyboard.create();
			
			if (fullscreen) {
				Mouse.create();
				Mouse.setGrabbed(true);
			} else {
				Mouse.setGrabbed(false);
			}
			
		} catch (LWJGLException le) {
			System.out.println("Game exiting - exception in initialization:");
			le.printStackTrace();
		}
	}
	
	public int getWidth() {
		return WIDTH;
	}
	
	public int getHeight() {
		return HEIGHT;
	}
	
	public int getRefreshRate() {
		return rfreq;
	}
	
	
	public void reinitialize() {
	}
	
	public void switchfullscreen() {
		try {
			if (Display.isFullscreen()) {
				Display.setFullscreen(false);
				Mouse.setGrabbed(false);
			} else {
				Display.setFullscreen(true);
				Mouse.setGrabbed(true);
			}
		} catch (LWJGLException e) {
			Sys.alert("Error: ", "Unable to switch screen mode!");
			e.printStackTrace();
		}
	}
	
	public void clearglscreen() {
		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
		GL11.glLoadIdentity();
	}
	
	public void updatedisplay() {
		Display.update();
	}

	
}
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

spasi

Yep, it's a bug. Multisampling doesn't work in Marathon too (same message). I'm sure Elias will solve the problem pretty soon. :wink:

elias


elias4444

Anywhere we can pick up the updated code? Or should we just wait for the next version of lwjgl?  :D
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

elias


elias4444

Thanks, you're awesome!
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

biggeruniverse

Quote from: "elias"Fixed.

Is that fix in the CVS tree? I have the latest CVS build, and I am still seeing this error under certain circumstances. (UnsatisfiedLinkError: nglGenTextures)

elias

The "UnsatisfiedLinkError: nglGenTextures" error is just a side-effect of the Display failing. You'll need to look at the exception from the Display.create() call.

- elias

biggeruniverse

nm. bad coder error.  :oops:

EDIT: exactly my problem.