Textures and Objects

Started by
6 comments, last by Bruno 24 years ago
Hi I''m loading a texture, and putting it on the screen as a background with this code: t1=PR_LoadTexture("fundo.jpg"); PRGFX_PutTexture(0,0,t1,NORMAL); Then, i''m tyring to make a render on that texture, but i can''t. The object is loaded, and rotating, but is on the backside of the texture. If i use XRAY instead of NORMAL i can see the object moving on the back. Any ideias how do i render the object above the texture, and like this using the texture as a background? Thanks Bruno
Advertisement

i think PRGFX_PutTexture works as an overlay. i will be on top of all objects, you can have a few layers of overlays though.

If you want to have this texture, use PR_AllocSprite to convert it to an entity. this one always face the front.

another way is to face the texture on a rectangle mesh.
set it to double side. load the pro and use it directly.



Hi,
If you are using PR3, download the ProEdit Source Code, there is a snippet in there for displaying a jpg as a background image.

Cheers
Darrin
Thanks Iram
I did what you told me, but i had no luck,i mean i don''t neither a compilation or a linking error, but when i execute computer ignores the entity that i created...
Here is the code, can you give me a hand?
thanks

PR_OBJECT *backg;
PR_ENTITY *backg_entity;

t1=PR_LoadTexture("fundo.jpg");
backg = PR_AllocSprite(t1);
if (backg == NULL)
PR_FatalError ("Cannot open data file", "Program");
PR_CenterObject (backg, &cenx, &ceny, &cenz);
backg_entity = PR_CreateEntity (backg, "BIGB");


in the render loop, i have the transform_entity and the render_entity!!


On a previous program I was working with I tried the same thing to place a texture in the background. I found that it only worked with certain video cards. For example, it worked fine on my G400 but when my voodoo II ran the same program I got the results you are getting.

Gary
Thanks Gary
I''m still with the same problem ( , but i''m going to try the program in another computer, just to check.., i''m almost giving up on this
Thanks
Bruno
Hi Bruno,
You could try using the PRGFX_PutTexture, do this at the start of your render cycle, then clear the ZBuffer so it stays as the backmost image.

Cheers
Darrin
You could also just blit your backround image strait to the direct draw surface prior to rendering.

Or you could do what was done in Homeworld and just put a globe with inverted normals around the visable scene with the texture applied to it. This actualy creates a really neat effect of the background actually having distance and perspective.

This topic is closed to new replies.

Advertisement