Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualk.pedersen

Posted 19 March 2012 - 12:55 PM

The following is the texture coordinate related code that I use. I have missed off the vertex and normal stuff so not to spam everyone with lots of code.

Does this appear to be correct?

Defines
GLuint coodBuffer;
GLuint inTexCoord;
std::vector<float> coords;

Load
inTexCoord = glGetAttribLocation(shaderProgram, "in_tex_coord");
glGenBuffersARB(1, &coordBuffer);

for(int i = 0; faces.size(); i++)
{
  coords.push_back(faces.at(i)->getA()->getU());
  coords.push_back(faces.at(i)->getA()->getV());

  coords.push_back(faces.at(i)->getB()->getU());
  coords.push_back(faces.at(i)->getB()->getV());

  coords.push_back(faces.at(i)->getC()->getU());
  coords.push_back(faces.at(i)->getC()->getV());
}

glBindBufferARB(GL_ARRAY_BUFFER_ARB, coordBuffer);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, coords.size() * sizeof(float), &coords[0], GL_STATIC_DRAW_ARB);

Draw
glEnableVertexAttribArray(inTexCoord);
glBindBuffer(GL_ARRAY_BUFFER_ARB, coordBuffer);
glVertexAttribPointerARB(inTexCoord, 2, GL_FLOAT, GL_FALSE, 0, 0);
glDrawArrays(GL_TRIANGLES, 0, faces.size() * 3);
glDisableVertexAttribArray(inTexCoord);

I have also attempted to use

glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);

But it makes no difference. I assume this hint only has an effect when using fixed functionality?

Edit:
From Madhed's software rendering suggestion, I tried it on a different machine (with newer gfx card) and it all works perfectly.
I noticed that it ran slower using shaders than just using the fixed function pipeline suggesting that it is indeed doing some sort of software emulation.
The graphics card in question is an intel GMA 945 running on Fedora 15's Xorg.

Hmm, I guess I am forced to stick with the fixed function pipeline with this card? So much for compatibility... lol

Thank you everyone for your help. Really appreciated! I have marked the topic as solved.

#11k.pedersen

Posted 19 March 2012 - 12:05 PM

The following is the texture coordinate related code that I use. I have missed off the vertex and normal stuff so not to spam everyone with lots of code.

Does this appear to be correct?

Defines
GLuint coodBuffer;
GLuint inTexCoord;
std::vector<float> coords;

Load
inTexCoord = glGetAttribLocation(shaderProgram, "in_tex_coord");
glGenBuffersARB(1, &coordBuffer);

for(int i = 0; faces.size(); i++)
{
  coords.push_back(faces.at(i)->getA()->getU());
  coords.push_back(faces.at(i)->getA()->getV());

  coords.push_back(faces.at(i)->getB()->getU());
  coords.push_back(faces.at(i)->getB()->getV());

  coords.push_back(faces.at(i)->getC()->getU());
  coords.push_back(faces.at(i)->getC()->getV());
}

glBindBufferARB(GL_ARRAY_BUFFER_ARB, coordBuffer);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, coords.size() * sizeof(float), &coords[0], GL_STATIC_DRAW_ARB);

Draw
glEnableVertexAttribArray(inTexCoord);
glBindBuffer(GL_ARRAY_BUFFER_ARB, coordBuffer);
glVertexAttribPointerARB(inTexCoord, 2, GL_FLOAT, GL_FALSE, 0, 0);
glDrawArrays(GL_TRIANGLES, 0, faces.size() * 3);
glDisableVertexAttribArray(inTexCoord);

I have also attempted to use

glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);

But it makes no difference. I assume this hint only has an effect when using fixed functionality?

Edit:
From Madhed's suggestion, I tried it on a different machine (with newer gfx card) and it all works perfectly.
I noticed that it ran slower using shaders than just using the fixed function pipeline suggesting that it is indeed doing some sort of software emulation.
The graphics card in question is an intel GMA 945 running on Fedora 15's Xorg.

Hmm, I guess I am forced to stick with the fixed function pipeline with this card? So much for compatibility... lol

Thank you everyone for your help. Really appreciated! I have marked the topic as solved.

#10k.pedersen

Posted 19 March 2012 - 12:00 PM

The following is the texture coordinate related code that I use. I have missed off the vertex and normal stuff so not to spam everyone with lots of code.

Does this appear to be correct?

Defines
GLuint coodBuffer;
GLuint inTexCoord;
std::vector<float> coords;

Load
inTexCoord = glGetAttribLocation(shaderProgram, "in_tex_coord");
glGenBuffersARB(1, &coordBuffer);

for(int i = 0; faces.size(); i++)
{
  coords.push_back(faces.at(i)->getA()->getU());
  coords.push_back(faces.at(i)->getA()->getV());

  coords.push_back(faces.at(i)->getB()->getU());
  coords.push_back(faces.at(i)->getB()->getV());

  coords.push_back(faces.at(i)->getC()->getU());
  coords.push_back(faces.at(i)->getC()->getV());
}

glBindBufferARB(GL_ARRAY_BUFFER_ARB, coordBuffer);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, coords.size() * sizeof(float), &coords[0], GL_STATIC_DRAW_ARB);

Draw
glEnableVertexAttribArray(inTexCoord);
glBindBuffer(GL_ARRAY_BUFFER_ARB, coordBuffer);
glVertexAttribPointerARB(inTexCoord, 2, GL_FLOAT, GL_FALSE, 0, 0);
glDrawArrays(GL_TRIANGLES, 0, faces.size() * 3);
glDisableVertexAttribArray(inTexCoord);

I have also attempted to use

glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);

But it makes no difference. I assume this hint only has an effect when using fixed functionality?

Edit:
From Madhed's suggestion, I tried it on a different machine (with newer gfx card) and it all works perfectly.
I noticed that it ran slower than using the fixed function pipeline suggesting that it is indeed doing some sort of software emulation.
The graphics card in question is an intel GMA 945 running on Fedora 15's Xorg.

Hmm, I guess I am forced to stick with the fixed function pipeline with this card? So much for compatibility... lol

#9k.pedersen

Posted 19 March 2012 - 10:58 AM

The following is the texture coordinate related code that I use. I have missed off the vertex and normal stuff so not to spam everyone with lots of code.

Does this appear to be correct?

Defines
GLuint coodBuffer;
GLuint inTexCoord;
std::vector<float> coords;

Load
inTexCoord = glGetAttribLocation(shaderProgram, "in_tex_coord");
glGenBuffersARB(1, &coordBuffer);

for(int i = 0; faces.size(); i++)
{
  coords.push_back(faces.at(i)->getA()->getU());
  coords.push_back(faces.at(i)->getA()->getV());

  coords.push_back(faces.at(i)->getB()->getU());
  coords.push_back(faces.at(i)->getB()->getV());

  coords.push_back(faces.at(i)->getC()->getU());
  coords.push_back(faces.at(i)->getC()->getV());
}

glBindBufferARB(GL_ARRAY_BUFFER_ARB, coordBuffer);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, coords.size() * sizeof(float), &coords[0], GL_STATIC_DRAW_ARB);

Draw
glEnableVertexAttribArray(inTexCoord);
glBindBuffer(GL_ARRAY_BUFFER_ARB, coordBuffer);
glVertexAttribPointerARB(inTexCoord, 2, GL_FLOAT, GL_FALSE, 0, 0);
glDrawArrays(GL_TRIANGLES, 0, faces.size() * 3);
glDisableVertexAttribArray(inTexCoord);

I have also attempted to use

glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);

But it makes no difference. I assume this hint only has an effect when using fixed functionality?

#8k.pedersen

Posted 19 March 2012 - 10:58 AM

The following is the texture coordinate related code that I use. I have missed off the vertex and normal stuff so not to spam everyone with lots of code.

Does this appear to be correct?

Defines
GLuint coodBuffer;
GLuint inTexCoord;
std::vector<float> coords;

Load
inTexCoord = glGetAttribLocation(shaderProgram, "in_tex_coord");
glGenBuffersARB(1, &coordBuffer);

for(int i = 0; faces.size(); i++)
{
  coords.push_back(faces.at(i)->getA()->getU());
  coords.push_back(faces.at(i)->getA()->getV());

  coords.push_back(faces.at(i)->getB()->getU());
  coords.push_back(faces.at(i)->getB()->getV());

  coords.push_back(faces.at(i)->getC()->getU());
  coords.push_back(faces.at(i)->getC()->getV());
}

glBindBufferARB(GL_ARRAY_BUFFER_ARB, coordBuffer);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, coords.size() * sizeof(float), &coords[0], GL_STATIC_DRAW_ARB);

Draw
glEnableVertexAttribArray(inTexCoord);
glBindBuffer(GL_ARRAY_BUFFER_ARB, coordBuffer);
glVertexAttribPointerARB(inTexCoord, 2, GL_FLOAT, GL_FALSE, 0, 0);
glDrawArrays(GL_TRIANGLES, 0, faces.size() * 3);
glDisableVertexAttribArray(inTexCoord);

I have also attempted to use

[i]glHint[/i]([i]GL_PERSPECTIVE_CORRECTION_HINT[/i],GL_NICEST);

But it makes no difference. I assume this hint only has an effect when using fixed functionality?

#7k.pedersen

Posted 19 March 2012 - 10:58 AM

The following is the texture coordinate related code that I use. I have missed off the vertex and normal stuff so not to spam everyone with lots of code.

Does this appear to be correct?

Defines
GLuint coodBuffer;
GLuint inTexCoord;
std::vector<float> coords;

Load
inTexCoord = glGetAttribLocation(shaderProgram, "in_tex_coord");
glGenBuffersARB(1, &coordBuffer);

for(int i = 0; faces.size(); i++)
{
  coords.push_back(faces.at(i)->getA()->getU());
  coords.push_back(faces.at(i)->getA()->getV());

  coords.push_back(faces.at(i)->getB()->getU());
  coords.push_back(faces.at(i)->getB()->getV());

  coords.push_back(faces.at(i)->getC()->getU());
  coords.push_back(faces.at(i)->getC()->getV());
}

glBindBufferARB(GL_ARRAY_BUFFER_ARB, coordBuffer);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, coords.size() * sizeof(float), &coords[0], GL_STATIC_DRAW_ARB);

Draw
glEnableVertexAttribArray(inTexCoord);
glBindBuffer(GL_ARRAY_BUFFER_ARB, coordBuffer);
glVertexAttribPointerARB(inTexCoord, 2, GL_FLOAT, GL_FALSE, 0, 0);
glDrawArrays(GL_TRIANGLES, 0, faces.size() * 3);
glDisableVertexAttribArray(inTexCoord);

I have also attempted to use
[i]glHint[/i]([i]GL_PERSPECTIVE_CORRECTION_HINT[/i],GL_NICEST);
But it makes no difference. I assume this hint only has an effect when using fixed functionality?

PARTNERS