Skip to main content
gamedev.net
🔒 Locked

Plagiarizing

Started by Kyo Jul 31, 2002 at 8:04 PM 10 replies 950+ views
Original Post
Kyo
Kyo
I''ve been doing Nehe''s first tutorial in setting up an OGL window and am now trying to write my own OGL class, but when it came to writing the functions i just pretty much copied NeHe''s functions. Even though I know what they do and why i''m writing this so and so I just couldn''t think of a way of doing it differently so as not to make it a straight copy of NeHe''s work yet I just couldn''t think of a better or different(but still useful) way of doing things. So it doesn''t feel right to say that it''s my own work. For example in the window creation function the way NeHe done it in the tutorial is pretty much the only way i can think of to do it so the code is practically the same and same for the window kill and window initialization. Am I wrong in saying this is my work or am I simply adopting his coding style as a base?
Matt Calabrese
Matt Calabrese
Yeah, I''d say it''s wrong (sorry). While certain things, though not many, can only be done in a fairly fixed way, the structure of the code, and a lot of the implementation can be changed (and extremely improved upon). To be honest, you really don''t want to copy a lot of the functions from NeHe because a lot of it is not efficient and design leaves much to be desired. Call it using the NeHe code as a base, or whatever you want, but when you do, you can''t really call it your own -- only a program that you modified.

--------------------
Matthew Calabrese
Realtime 3D Orchestra:
Programmer, Composer,
and 3D Artist/Animator
"I can see the music..."
Kyo
Kyo
For example in the code to resize an OpenGL scene:

void OpenGL::ResizeGLWindow(GLsizei width,GLsizei height)
{
if (height==0)
{
height = 1;
}

glViewport(0,0,width,height); //set viewport size
glMatrixMode(GL_PROJECTION); //select projection matrix
glLoadIdentity(); //reset matrix
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); //aspect ratio
glMatrixMode(GL_MODELVIEW); //select modelview matrix
glLoadIdentity(); //reset matrix
}


I was thinking how else could this be written? If I were to write the function without taking a look at his code and get everything from MSDN it would still look pretty much the same.
kindfluffysteve
kindfluffysteve
i have no moral qualms about using somebody elses code if its the only way to get the job done and if i understand how its working. If the code is beyond me for example, using a network class somebody has created, i''ll mention the author in the credits.
Ronin Magus
Ronin Magus
Well if you think of it that way then you can't call it your own program when you use WNDCLASSEX and CreateWindowEx, it's Microsoft's.

Sometime there's just no other way to do it.

http://roninmagus.hopto.org

[edited by - Ronin Magus on August 1, 2002 6:45:49 PM]
Fluid FX
Fluid FX
well actually i think it is bad when you totally keep on foccusing on the way they do it, cause there is plenty to change...

ok so the "main code" (windows setup and so on) might not be so easy to change, but for example, nehe has no real code combining their load level, multitexturing, lightning, shadows, collision detection and waving flags ( and so on and on..)

so there is lots of changes you can make, but consider it this way: the main code of a windows program is not that easy to change...

tho if you give out any kind of exe to others, it would be nice to put nehe.gamedev.net or whatever in your after credits

GreetZ
jeeky
jeeky
Over time, you will learn that you can certainly rewrite other''s code to be both better and more to your own style.

For example, Kyo asked how to redo this:

void OpenGL::ResizeGLWindow(GLsizei width,GLsizei height)
{
if (height==0)
{
height = 1;
}

I would do this:
void OpenGL::ResizeGLWindow(const GLsizei width, const GLsizei height)
{
m_width = width;
m_height = (0 == height) ? 1 : height;
}

I have saved the window dimensions as member variables, since this is a class and these parameters are valuable in some other circumstances. I have also make the arguments const since they will not be changed. I have changed the comparison from (height == 0) to (0 == height). This ensures that I don''t accidentally do (height = 0) in my comparison because the code won''t compile if I do that.

Anyways, things such as const correctness, c++ style casting, and other features of more solid coding can generally be implemented into nearly any piece of sample code. In any event, once you are done, most of your code will generally be unique to you.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.