LWJGL
May 22, 2012, 14:24:22 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D, o); not working?  (Read 1369 times)
lainmaster
Regular nerd
**
Posts: 64


« on: March 09, 2010, 21:27:57 »

Code:
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 30); // testing line

IntBuffer o = ByteBuffer.allocateDirect(64).order(ByteOrder.nativeOrder()).asIntBuffer();
GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D, o);
int iBoundTexture = o.get();
System.out.println("tex " + iBoundTexture);

Always outputs 0 (zero).
Also outputs 0 without the testing line (should be another texture bound)

is GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D, o); not working, or am I doing anything wrong?

BTW it's lwjgl 2.3 Windows 7 64 bits if it matters
Logged
Matthias
Talks Too Much
***
Posts: 178


WWW
« Reply #1 on: March 09, 2010, 23:33:25 »

Why do you ask OpenGL for things you set a few lines ago? You should just remember which texture you have bound - esp since glGet* can force synchronization which will hurt performance when you have a multithreaded OpenGL driver.
Logged

lainmaster
Regular nerd
**
Posts: 64


« Reply #2 on: March 10, 2010, 11:34:44 »

Well I guess the question has become irrelevant now, since it's rather easy and faster to keep track of the bound texture.

The real matter was to check whether or not my method was inside a glBegin-glEnd block, but that, too, won't matter anymore.

Still, the method is there, so it should work.
Logged
Kai
Talks Too Much
***
Posts: 131


« Reply #3 on: March 10, 2010, 12:12:44 »

Quote
Still, the method is there, so it should work.

The method sure works, but not inside a glBegin/glEnd-Block (if you were trying that), as stated by the specification, which also makes no sense since you cannot change state in a glBegin/glEnd-Block.

Quote
GL_INVALID_OPERATION is generated if glGet is executed between the execution of glBegin and the corresponding execution of glEnd.
Logged
lainmaster
Regular nerd
**
Posts: 64


« Reply #4 on: March 10, 2010, 13:41:54 »

Quote
Still, the method is there, so it should work.

The method sure works, but not inside a glBegin/glEnd-Block (if you were trying that), as stated by the specification, which also makes no sense since you cannot change state in a glBegin/glEnd-Block.

Quote
GL_INVALID_OPERATION is generated if glGet is executed between the execution of glBegin and the corresponding execution of glEnd.


Thanks, I had been searching for that but could not find.

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!