Render To Texture & Display.Update woes

Started by Kryton, October 15, 2006, 14:22:07

Previous topic - Next topic

Kryton

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. 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

biggeruniverse


Kryton

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.

biggeruniverse

I'll assume you've initalized your texture correctly. You may need to enable texturing before binding and copying to your texture.

Orangy Tang

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.

Fool Running

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 :) )
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

Kryton

Yes it was the texture ID (and I had forgotten to bind it).

Thanks for the help :D


Kry