|
-
Sep 29th, 2005, 07:36 AM
#9
Not NoteMe
Re: Pointer math / images
I guess you've probably sorted it by now, but here's something anyway:
Yesterday i got up to the stage you're at, getting each pixel individually using coordinates.
I had a TextureInc variable, which was a 2D vector which i used to step through the texture sample line.
This worked fine.
I then triend to make a pointer increment using this 2D vector. The trouble i'm having, and i think you're having too is with floats and ints. i.e. it doesn't make sence to have the pointer incrememnt through half a scanline in the texture, but often you need to incrememnt 0.5. When i was using the texturecoordinate incrementor i was using floats, so this was fine, since i just rounded when calling my texture colour lookup routine.
To get round the probelm i'm going to convert my 2 floats (the x incrememnt and the y incrememnt (or more accuratly the u and v incrememnts)) into ratios to the first sig fig. e.g. 0.7 would be 7 / 10, 0.04 would be 4 / 100.
Using these two numbers i'll work out when to incrememtn the pointer and by how much.
Something else i realised is that you HAVE to have 2 seperate pointer incrememtors, one for the x (u) and one for the y (v) incrememnts, because with the above system you may want to incrememnt the x, but not y and visa-versa.
Sorry if this is rushed, i'm off to work right now!
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|