2 probably very simple q's (copy texture regions and blending issues)
Hi guys, I''m relatively new to OpenGL, having changed from standard 2D for the nice fast rotation and alpahblending.
Basically I''m using a series of 2D textures in orthogonal projection mode to make 2D games.
I have a couple of questions (since I''m so in-experienced) that I hope you can help me with:
1. Can I copy a portion of one texture to a portion of another texture? Is an extension needed?
2. I want to simulate lighting in my 2D world.
Firstly, I display all my tile textures on the screen.
That''s easy, now what I''d like is a black texture the size of the screen (don''t worry about max texture sizes right now), which I can plonk white textures over the top of to specify viewable areas of the screen.
Then I''d like to be able to blit the big texture over the top of my tiles to obscure all the areas where the texture is black, and show all the areas where it is white.
Can I do this? Is it straightforward?
Thanks for any help,
Rob
1. Yes you need an extension. Your graphics card must support multitexuring. I don't know the exect extention name. I am hoping that the ppl that will post after me will tell you the name.
[edited by - snisarenko on April 8, 2003 11:14:20 PM]
[edited by - snisarenko on April 8, 2003 11:14:20 PM]
Great, so using the GL_ARB_multitexture extension, how do I go about generating the effect that I''m after?
Thanks guys!
Thanks guys!
If i understand you correctly, you probably want the b&w texture to be some sort of alpha map. You can set the background color to black. Then set the values of the black and white texture as alpha values for the other texture and draw it. If you''re using tiles you van use a stencil buffer test and use the b&w texture as stencil values.
Hope this helps, don''t know if it is what you mean and if this is the best way to do it. It will work though
Marty
Hope this helps, don''t know if it is what you mean and if this is the best way to do it. It will work though

Marty
_____ /____ /|| | || MtY | ||_____|/Marty
I think that is exactly what I want.
I shall look into implementing this.
Thank you everyone!
ps, how do I copy from one texture to another texture without going via the frame buffer?
I shall look into implementing this.
Thank you everyone!
ps, how do I copy from one texture to another texture without going via the frame buffer?
I''m not really all that sure what you mean when you''re saying you want to copy one texture to another, but there are a set of OpenGL commands that copy a texture... glCopyTexImage2D(), or you could use glTexSubImage2D()... I''m not quite sure what would be best.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement