LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-19-2005, 12:09 PM   #31
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32

Without knowing exactly what you want to do, there is no one formula I can give you. Especially with a perspective projection where things further away are going to be smaller. Take for instance a textured quad that is right up by the near clip plane. Say the near clip plane is big enough to create a 4x4 tile of your texture if you calculate it pixel-by-pixel. Now when you start moving that quad back, if you still want it to be exactly pixel-by-pixel, you are going to have to change the texcoords. If you don't it will still be a tiled 4x4 texture, but it will just get smaller as you move further away.

It seems highly unlikely that what you really want is for it to display the texture's pixel data at the same size no matter what the distance, but without knowing more I really can't say for sure. It seems more likely that you have an object that you want to have the texture repeated across x number of times. In that case, you just supply the desired texture coordinates.
 
Old 11-19-2005, 12:17 PM   #32
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
But how will I know how much times I want it to repeat? Don't you know how this is done in games? Is it hardcoded?
I just don't know how to do this. Should I hardcode it or use any formula.
What do you advise?

Thanks.
 
Old 11-19-2005, 02:51 PM   #33
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Without knowing exactly what you are texturing, I can't give you any one answer to your question. In most cases, you just know... Like say you are texturing the floor of a room. You probably don't want those texture coordinates changing on you or it won't look very realistic. How many times should you make it repeat to make it look good? Well... that depends on what your texture looks like, how big the floor is, and any other number of variables. Certain patterns will look good, others will not. You have to figure out what will look good and go with that. It's all really subjective.

Typically, in games, the texture coordinates are stored as part of the model information. The texture mapping is done with a modeling program of some sort, and then those texcoords are loaded up and used in the game. There are a few cases where texcoords might be dynamically generated; sky maps, tesselating models further using some level of detail algorithm, etc.
 
Old 11-19-2005, 11:19 PM   #34
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
Thanks, deiussum.
I've just understood that we'll be using models from Blender, so there'll be no need to texture ready models. They'll be textured in Blender.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sdl / opengl - cant press up and right atrain Linux - Games 2 03-27-2005 11:29 PM
Question about SDL OpenGL and -lglut doody Programming 2 11-16-2004 04:17 PM
OpenGL and SDL programming with Slackware zsejk Slackware 13 08-03-2004 07:52 PM
Using OpenGL (+SDL) for 2D programs R00ts Programming 4 07-16-2004 12:33 PM
OpenGL lighting with SDL MadCactus Programming 0 09-21-2003 11:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration