Hello.
I trying to find someway to render in a bitmap or texture, ashey texture will be better because I will put this image on the after some time. Then, If somebody know how tell me please. Thx.
Hello.
I trying to find someway to render in a bitmap or texture, ashey texture will be better because I will put this image on the after some time. Then, If somebody know how tell me please. Thx.
research FBO (Float Buffer Objects)
This post has a FBO class I created that might be of interest
The solution above doesn’t write to a texture per se so you would need to investigate it a bit to have that functionality. I did a specialization of FBOs and usually people do write to textures … I just didn’t need a texture file so that part of the code does not exist.
Thanks a lot! I really appreciate.
Could you explain one more thing?
I see your code, and It’s a little big, (not about de code, but I’m afraid in performance).
I’m using a tiled map, then, every frame, need create it, save it, make another things and after put in the screen.
Is correct make texture each frame, or there is another form to make it? Will I get good performance?
Thanks!
The code I linked you is expensive because it does a pixel calculation…it traverses all of the pixels of the image to count how many background pixels are and how many foreground pixels…that was a solution I needed and that is what causes it to be slow. I know you don’t need that part, you just need to get familiar with FBOs and I hope my code gets you on the way to that. I believe if you don’t do the processing I do, but simply output data to an image/texture then the speed is pretty good.
I’m definitely not an expert on the question you had, so it will be hard for me to answer. I don’t quite know if making a new texture each frame is expensive though reading one from a file would definitely be expensive, so if you are at least reusing the same image as a background, make sure not to reread it too often.
Can anyone else answer this better?
Creating a new texture each frame will be expensive. Each texture object has an int handle so that you can re-use it over many frames. If all you need to do is update the contents of the image, then I’d look at the glTexSubImage commands, which update the color data without re-initializing a whole block of memory.
This is rather Frame Buffer Object, isn’t it??
I’m sorry, you are correct. I was thinking about something completely different.
thanks.
Thank a lot all.
Now, I’m trying to use glCopyTexImage2D. It’s appears have a good performance, I don’t know if is the best know.
Then,… I create pbuffer, where is my playground to make pre-render. After I make a picture there, I’m trying to copy to my texture. But… don’t work!
texture.enable();
texture.bind();
gl.glCopyTexImage2D( GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, 0, 0, 128, 128, 0 );
texture.disable();
texture is com.sun.opengl.util.texture.Texture.
I think is some ability there I should started before try to copy. I don’t see anything in GLcanvas.
I’m noob in jogl, then I had tried use context too, and make current, but nothing got to the texture.
thx.
If you don’t need the pixel data in your app, you should use an FBO approach, since you can directly render to a texture this way, without the need to copy the data around.