LWJGL Forum

Programming => OpenGL => Topic started by: Kryton on October 15, 2006, 14:22:07

Title: Render To Texture & Display.Update woes
Post by: Kryton on October 15, 2006, 14:22:07
Hi,

I've been playing with LWJGL over the weekend and thought I had gotten to grips with it. I managed to get the tutorial going in no time and began to look into experimenting with more `interesting' things (shaders etc.)...

My problem is, I've been following the basic GPGPU guide to render-to-texture, apply a shader, display result but it breaks!

I've uploaded the code (http://www.donotpaste.com/view.php?id=231). It keeps crashing on Display.update(), I don't know why. I searched and people mentioned threads and Display but it is entirely self-contained? Any ideas?


Thanks,
Kry
Title: Render To Texture & Display.Update woes
Post by: biggeruniverse on October 15, 2006, 16:13:31
With what error does it crash?
Title: Render To Texture & Display.Update woes
Post by: Kryton on October 15, 2006, 16:28:16
Quote from: "biggeruniverse"With what error does it crash?

Oops, forgot to mention that bit :-

Invalid operation (1282)
org.lwjgl.opengl.OpenGLException: Invalid operation (1282)
   at org.lwjgl.opengl.Util.checkGLError(Util.java:56)
   at org.lwjgl.opengl.Display.swapBuffers(Display.java:567)
   at org.lwjgl.opengl.Display.update(Display.java:583)
   at Render.run(Render.java:160)
   at Application.main(Application.java:12)


I've tried doing Render.run vs. Render.start in case it was threading (what other posts suggest) but no joy.
Title: Render To Texture & Display.Update woes
Post by: biggeruniverse on October 15, 2006, 17:52:34
I'll assume you've initalized your texture correctly. You may need to enable texturing before binding and copying to your texture.
Title: Render To Texture & Display.Update woes
Post by: Orangy Tang on October 16, 2006, 12:09:14
Display.update() automatically calls glGetError() for you, and will throw an exception if there is a gl error (in this case, INVALID_OPERATION).

You should read up on glGetError, but in short something in your GL calls is wrong - INVALID_OPERATION can be things like trying to set matrices inbetween glBegin/End blocks, etc. etc. The first step is narrowing down the actual gl call which is causing the error - I usually just scatter calls to Util.checkGLError() over the code and keep narrowing it down.

Once you've figured out the actual function thats causing the problem look up the docs for it somewhere (if it's GL1.1 then you can find them on msdn, otherwise check on opengl.org). It should list what conditions INVALID_OPERATION is triggerd by.
Title: hmmmmmm...
Post by: Fool Running on October 16, 2006, 13:59:30
The only thing I could see was that you never seem to be generating a texture id. You are just using the 0 that Java puts in the _texture variable.

Also, you aren't enabling texturing except for the render() method. You might need it to do the texture copying and stuff (not sure of that, though :) )
Title: Render To Texture & Display.Update woes
Post by: Kryton on October 16, 2006, 14:32:29
Yes it was the texture ID (and I had forgotten to bind it).

Thanks for the help :D


Kry