Texture Colors Not exact as Texture

Started by
17 comments, last by marcClintDion 12 years, 5 months ago


I took this part out..It really wasn't constructive at all.

Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, 3 because you know that the testing of your faith produces perseverance. 4 Let perseverance finish its work so that you may be mature and complete, not lacking anything.

Advertisement
mhagain -- I don't appreciate you pointing out the flaws in my code. Please refrain from posting suggestions relating to other people's posts.

V-man -- Can you please explain the modern alternative for producing mipmaps?

Yann L -- Can you please explain what part of that code evokes undefined behaviour, and why it's at risk of leaking memory?
^^ Fixed that for you.
If someone asks me how to build a house and I suggest to him or her to go cut down trees, gather wood, and use a hammer and nails, yes, I have answered his question.
When someone else comes along and says, "You know, that way is deprecated; we use bricks and mortar now," he or she has given an answer that may be more suitable to the original person seeking advice.

In the pursuit of knowledge one must never be stuck in his or her own ways, and admit one's shortcomings with a smile as new things or ways are learned.

I would not be offended if someone suggested a better way than my own. Why were you?

One of the reasons I post here so often is because I can also learn when I give less-than-the-best advice and someone comes along and corrects it. I think I am pretty useful and help often, but I also say stupid things at times and make poor suggestions.

Your reaction to having been corrected is off-the-wall.

Also, Yann L showed you exactly where the error is.
You [or whomever] used new [] but not delete []. You [or whomever] used plain delete.
Instead of looking with an open mind and saying, "Oh I see, I made a mistake. Thank you for finding that because the quality of my software has increased because of it," you just screamed how correct the code is based on it working "on every computer", which is something you didn't even test, and stomped off with flawed code.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Actually L. Spiro. YOU told us exactly where this particular error is. The other person re-wrote the same mistake and said it was wrong without the correction that you presented. Maybe to you it was obvious that [] should have been added, but not to everyone. I do not get upset because I was corrected, I wasn't corrected, I was instead heckled for attempting to help. If I were building a house as you say and someone came by and critisized me for doing it wrong, then turned around and walked away without any clearly stated "help", I would have no respect for this person's opinion. If those people had put things nicely, and had given some useful advice I would have followed it. If that is how the "experts" around here behave then it is clear that the "experts" need to be told how to behave properly. It rubs me the wrong way when no-it-alls use what they "know" to make themselves feel superior. Simply put, I overreacted, but what I reacted to was most certainly something to react to. And by the way, I've tested that code extensively on many different computers with very different hardware and it works beautifully. I re-compile sometimes half-a-dozen times every few minutes. I have also used this code to load 240 pictures at 1024x1024 all at the same time, if there really were memory leaks and corruption it would have been very obvious, these computers would crash. Maybe the Dev-Cpp compiler fixes errors like these automatically, I will however take you advice on this matter and make the appropriate correction:delete[]. I am aware that Nvidia has posted a document called "fast texture transfers" and in this document it is pointed out that BGR should be used but in most cases even they say that it has little or no performance increase. The response I received was snarky and overblown. I escalated things and I'm sorry.

Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, 3 because you know that the testing of your faith produces perseverance. 4 Let perseverance finish its work so that you may be mature and complete, not lacking anything.

We;; for my part i wasn't trying to make little of your work; my motive was to point out to the OP that on a more modern GPU using BGR is preferable to swapping the bytes manually. I can see how it could have came across otherwise, and I could have picked my words better.

I have done quite a bit of benchmarking of texture uploads using different format and type parameters, and GL_BGRA is actually the one to use. ;)

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

Well if you want any openGL help, then you're kind of pissing of the wrong people. Secondly a fact is not an attack:
Not even mentioning that the code above invokes undefined behaviour and could possibly lead to memory leaks or even severe heap corruption.[/quote]

The code posted was bad. For instance why make a new array instead of just swapping the r,g,b values in the original array?

Send your pointless little snippet to the people who built freeImage and tell them that their software isn't written properly.[/quote]
Just because someone gave away free code doesn't mean it is good. It really was bad code, and was a memory leak.

The problem was already solved anyway and then you posted a ton of code and more work than the standard solution of GL_BGR. You can also google things like gluBuild2DMipMaps and find out why he is saying not to use it.

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

ok
From the Wiki
http://www.opengl.org/wiki/Common_Mistakes#GL_TEXTURE_MAG_FILTER

and also
http://www.opengl.org/wiki/Common_Mistakes#Automatic_mipmap_generation
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Secondly a fact is not an attack:[/quote]

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

This topic is closed to new replies.

Advertisement