2D texture rendering realtime?
I''ve been looking everywhere for how to do this, but I can''t find anything on it.
Basically I''m trying to write and read from a texture to make a standard 2D fire effect to texture on to a cube.
Is there any way to just have a buffer to read and write from for a texture? And is it fast enough to update each frame?
You can just manage an array of colour values yourself, then copy them to a texture using glTexSubImage2D.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc03_2bqc.asp
Why you shouldn''t use iostream.h - ever! | A Good free online C++ book
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc03_2bqc.asp
Why you shouldn''t use iostream.h - ever! | A Good free online C++ book
Every frame you must reload the texture with TexImage()...I dont see the problem...of course you need to perform FXs yourself (in DirectDraw is the same thing however
Is fast? It depends by the dimension of your texture and the complexity of the effect...the time to reload the texture is not significant.
Is fast? It depends by the dimension of your texture and the complexity of the effect...the time to reload the texture is not significant.
It should work fine, I believe this is how some games, like Quake 2, do dynamic lighting.
Why you shouldn''t use iostream.h - ever! | A Good free online C++ book
Why you shouldn''t use iostream.h - ever! | A Good free online C++ book
quote:
It should work fine, I believe this is how some games, like Quake 2, do dynamic lighting
I doubt!
Ok, I don''t understand the documentation. Say I was to have a DWORD array[256][256] for the special effect. How would I copy that into the texture?
Well the documentation says it all but here is what you must do.
I see that the data is grayscale so do this:
glTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE,256,256,0,GL_LUMINANCE,GL_UNSIGNED_BYTE,data);
P.S.
Quake2 doesn''t use dynamic lighting guys
The PAIN is coming...this summer!!!In cinemas everywhere.
I see that the data is grayscale so do this:
glTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE,256,256,0,GL_LUMINANCE,GL_UNSIGNED_BYTE,data);
P.S.
Quake2 doesn''t use dynamic lighting guys
The PAIN is coming...this summer!!!In cinemas everywhere.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement