Hello everybody…
I am starting with opengl and I already got it a lot…but still in problems…
lets go my questions…
1-How do I repeat a texture in a face?? for example…I made a square that is my floor with grass texture, but when i apply it it stretch the image and become very visible and large the pixels…how do i solve this??
2-This is simple curiosity…whats the diference between GLfloat and float? or GLint and int???and so on??
3-How is the best struct code of opengl?? explaining, where to put the drawing ( in a loop for example), where to create things… there is some tutorial explaining how to gain performance by structing the code organized??
1: simply multiply your texture coordinates in both u and v to whatever times you want the repeat to be done. Ie: if u and v lie in [0…1] you have only the image, without repetition, if they lie into [0…10] you have 10 times the image in u direction and 10 times the image in the v direction. You can also do that with the texture matrix.
2: normally none (my header has typedef float GLfloat). I can’t ensure it will be the same everywhere.
Point 1.: As arts said multiple your tex coords with some number (you will see) for example 10. And also make sure GL_REPEAT is set in the texture parameter section (where you load your texture).
Point 2.: Depends on the implementation, i personally try to use GLfloat everywhere and typdef it with my own names as arts does:
typedef myFloat GLfloat;
Point 3.:
Hard question, too general
I think its better to buy a book OpenGL Super Bible for example and check out their sample codes along with it. Even after that there will be questions … so i do also waiting for somebody to shed light on it.