OpenGL with vertex arrays
Posted: Thu Aug 25, 2011 2:37 pm
EDIT:
See newest post...
See newest post...
The Next Generation of 2D Roleplaying Games
http://elysianshadows.com/phpBB3/
I am not quite sure what you are asking here. There is no question, and it looks like there's supposed to be a sentence between the second and third. If you could rephrase, someone might be able to provide some insight.N64vSNES wrote:I can't seem to find an answer for this so hopefully you guys could help.
Suppose I have a 32x32 texture and a 64x64 quad. Now if I render this then the texture gets "stretched" as you would imagine because you've specified the texture coords where the vertices are.
I'm fairly sure that using GL_REPEAT would do this IF I go past 1.0 with the texture coords however this isn't much using part of a texture atlas.
Any advice?
Thanks.
That's exactly what I was going to say.Krolgar wrote:I am not quite sure what you are asking here. There is no question, and it looks like there's supposed to be a sentence between the second and third. If you could rephrase, someone might be able to provide some insight.N64vSNES wrote:I can't seem to find an answer for this so hopefully you guys could help.
Suppose I have a 32x32 texture and a 64x64 quad. Now if I render this then the texture gets "stretched" as you would imagine because you've specified the texture coords where the vertices are.
I'm fairly sure that using GL_REPEAT would do this IF I go past 1.0 with the texture coords however this isn't much using part of a texture atlas.
Any advice?
Thanks.
Well this is going to cause problemsqpHalcy0n wrote:This can not be done as you describe within the fixed function. Sorry.
The texture or the geometry must be split or you must write the functionality into a shader program.
I'm guessing you're just trying to optimize some shit? ...you could always pick up shaders.N64vSNES wrote:Well this is going to cause problemsqpHalcy0n wrote:This can not be done as you describe within the fixed function. Sorry.
The texture or the geometry must be split or you must write the functionality into a shader program.
Thanks for the help though.
Yep. The only alternative would be dropping the whole texture atlas buissness but then I doubt I'd gain much performance having to switch textures. in fact, I might even make it slower that wayGyroVorbis wrote:I'm guessing you're just trying to optimize some shit? ...you could always pick up shaders.N64vSNES wrote:Well this is going to cause problemsqpHalcy0n wrote:This can not be done as you describe within the fixed function. Sorry.
The texture or the geometry must be split or you must write the functionality into a shader program.
Thanks for the help though.
Vertex transformation pipeline, optimized. I was about to say the same thing!qpHalcy0n wrote:...or you could just split up the geometry. You know that the vertex transformation pipeline is extremely optimized and that you should have no problem pushing dozens of thousands and thousands and thousands of polys through it.
Code: Select all
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,t_BlockSet.GetTex());
glColor3f(1,1,1);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, &Verts[0].x);
glTexCoordPointer(2,GL_FLOAT, 0, &TexChoords[0].x);
glDrawArrays(GL_QUADS,0,i_FacesDrawn * 4);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);