Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Texturing question

Author
Message
NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 21st May 2010 16:34 Edited at: 21st May 2010 18:04
Hi,

I've been trying to add a texture to an object. I've attached the object. Basically it's a bit like a digital picture frame...thing . I'd like to be able to add any image to the picture part of it and keep the frame's texture. Also the screen is to be illuminated. My object has the frame texture and illuminated screen area built in. I've tried a few different ways of going about this, with no real success. I would like to be able to make a series of objects that use the same code to put a texture on them in the same way. Also I'd like it to reduce memory useage by shrinking the given image down as the frame texture is only 256x256.

I'll include a screenshot of my application at the moment.

EDIT-Also if possible it'd be nice to have the 2 textures physically combined and not just 2 stages/ layers, to save memory, but this isn't 100% needed.

Also I'd like to only take a square from the centre of the given image so the aspect doesn't look wrong when placed on a square model.

I know this is probably simple, but still a bit of work to get it right. I'm still not great at the programming of textures yet.
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 21st May 2010 18:13
Make the frame a separate object from the picture area. You can just have the frame, and a DBPro plane behind it.

Texture the plain with your image. No need to resize the images. They'll be stretched or shrunk to fit. The only downside of that is they might only get stretched in one direction, making your pictures not look right.

A solution for that would be to use a little math and take the larger of the width or height of the image, then create a bitmap in the proportions of your frame with that larger height or width, and paste your image in the middle. Then grab that image and texture your plane with it.

NickH
18
Years of Service
User Offline
Joined: 19th May 2008
Location: Nova Prospekt, North Yorks, UK
Posted: 21st May 2010 19:43 Edited at: 21st May 2010 22:01
Thanks KISTech,

I think I'll have a go at that very thing. I'll still try and reduce the size to reduce memory useage as the application doesn't allow the user to get closeup to the objects and I'm trying to limit the footprint as much as possible. 1 step at a time though

Login to post a reply

Server time is: 2026-07-26 02:12:10
Your offset time is: 2026-07-26 02:12:10