| The Following User Says Thank You to dragly For This Useful Post: | ||
|
|
2010-04-19
, 17:44
|
|
Posts: 77 |
Thanked: 176 times |
Joined on Dec 2009
@ Hamburg, Germany
|
#2
|
| The Following User Says Thank You to jfk For This Useful Post: | ||
|
|
2010-04-19
, 17:54
|
|
Posts: 252 |
Thanked: 252 times |
Joined on Nov 2009
|
#3
|
|
|
2010-04-20
, 15:36
|
|
Posts: 252 |
Thanked: 252 times |
Joined on Nov 2009
|
#4
|

bool Model::linkShaderProgram() {
if(program.link()) {
qDebug() << "Program linked";
} else {
qDebug() << "Failed to link program:" << program.log();
}
}
bool Model::setShaderFiles(QString fragmentShader, QString vertexShader) {
return setFragmentShaderFile(fragmentShader) && setVertexShaderFile(vertexShader) && linkShaderProgram() && initShaderProgram();;
}

|
|
2010-04-20
, 15:43
|
|
Posts: 77 |
Thanked: 176 times |
Joined on Dec 2009
@ Hamburg, Germany
|
#5
|
Unfortunately, I hadn't had the time to look over your code yet.
When I was trying to run my latest changes on my N900 I encountered the strangest bug I have yet seen. What happened was that nothing was rendered on-screen on my N900. After a long debugging session I figured that if I removed some QMatrix4x4::rotate and scale functions, it would render again. However, I didn't want to do this, so I debugged a bit further, trying to find the source of the problem.
By coincidence, I added qDebug() << "something"; in my objects' draw function (which also contains the rotation and scaling). All of a sudden the rendering came back with rotation and scaling! But as you might know, calling qDebug() a couple of times each frame is going to hit the performance big-time. So I tried something out-of-the blue again and put my QShaderProgram::bind() function in an if-statement, which would output something with qDebug() if it ever failed (which it never does) - well, guess what? It actually worked!
Now my application compiles, runs and renders - but I have no idea why this piece of code would help anything:
if(!program.bind()) { qDebug() << "Failed to bind program"; }By the way, it never fails to bind(), so the text is never outputted to the terminal.