I can't get this code to work. I've tried drawing the same texture 3 different times, and the texture coords are painted on the screen after it, but none of the al_draw_prim calls work. They don't display anything. I know the texture loaded successfully because I display it first.
WorldWrap.7z Binary + src + data
I see this
{"name":"608139","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6a37e65e5fb247256b1938b38027cf3d.png","w":800,"h":600,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6a37e65e5fb247256b1938b38027cf3d"}
What's it supposed to look like?
BTW, you forgot to include mybackground.png, so I substituted a random image.
[EDIT]
Upon further examination, the x's and y's are the same, so you're only showing one pixel of Map.BMP, which is black.
Waiting for charter.com to reconnect so I can hit the submit button.
Maybe the new roomie's laptop is riddled with spyware and it's overloading the data cap with spam emails or something.
[EDIT 2]
I added a new vertex, and copied the first to the 5th and now it shows a rectangle, scrolling along with the arrow keys eventually changes the color due to enormous pixels much larger than the window, fiddling with the numbers hasn't helped yet.
{"name":"608140","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/3\/d3155a721a90088e2d470545b2a427fe.png","w":800,"h":600,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/3\/d3155a721a90088e2d470545b2a427fe"}
Sorry, forgot to specify, you can specify.
Usage :
WorldWrap.exe ImageFileName.png
It's supposed to be drawing 3 quads, one in the top left quadrant, one in the bottom right, and one in the center. It doesn't draw anything for me.
Oh, sorry, didn't update the binary. Gotta wait til I get home now.
Use an image program to provide a crude example of what that would look like, please. I'm multitasking too hard and my dual-cell brain is thrashing badly.
u, v need to be in pixels.
end argument is last valid index + 1 (i.e. 4 not 3).
Your bitmap needs to have its dimensions be a power of 2.
Has to be a power of 2? So how would I wrap a texture around that is not a power of 2?
how would I wrap a texture around that is not a power of 2?
You mean how to force a texture to be a power of 2? Either stretch it with a good graphic program to the desired dimensions, or copy the image and paste it to a larger image that does have power of two dimensions.
But I don't want it to be POT. Then I would have to scale it. The whole idea is that it can be any size and you can wrap the edges for a continuously scrolling background.
The answer then is a shader or abandoning al_draw_prim and just calling al_draw_bitmap_region 4 times (assuming your bitmap is larger than the screen).
Okay, I fixed what you said, and it's drawing now, but allegro is using a POT texture with zero alpha in the gaps and wrapping that. My source image is 1024x768 and the texture is 1024x1024 I believe. How do I avoid scaling? I don't want to change the aspect ratio either. You said draw 4 bitmaps, what if the view size is larger than the wrapped background? I might have to draw more. Isn't there an easy way to tile?
And I don't really know how to write a shader. Any good tutorials? Websites?
WorldWrap.7z Bin + src + dat
WorldWrap.exe HarperVR2.BMP
{"name":"608151","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/f\/8f76d9ce132caae530147f4db5ba57a4.png","w":812,"h":632,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/f\/8f76d9ce132caae530147f4db5ba57a4"}
It's a simple piece of code to draw a grid of bitmaps to fill the screen.
For shaders you need to use A5.1, obviously. I think just looking at A5 examples will be sufficient for such a simple shader. I'd just grab the default ones and modify them a bit (untested):
Then you'll need to set the bitmap_size_frac variable in your code like so:
int true_w, true_h; al_get_opengl_texture_size(tex, &true_w, &true_h); float bitmap_size_frac[2] = {(float)al_get_bitmap_width(tex) / true_w, (float)al_get_bitmap_height(tex) / true_h}; al_set_shader_float_vector("bitmap_size_frac", 2, bitmap_size_frac, 1);