Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About paulshady

  • Rank
  1. paulshady

    Optimizing OpenTK/OpenGL code in C#

    Thanks, mhagain, that was really helpful. The link was very informative, too. One more question: So, the GPU is basically free? Meaning the developer doesn't have to do anything specific to cause work to be handed off to the GPU? Even if I'm just using the fixed function pipeline.
  2. paulshady

    Optimizing OpenTK/OpenGL code in C#

    I wouldn't say I'm unhappy, I would say I'm surprised with the results that I got. Here's what surprised me: In my Draw() loop I do hundreds of texture switches every frame, loads of matrix math, quite a bit of string manipulation, and I have nested foreach loops that could be optimized and written much more efficiently. But at the moment since the DrawElements() call takes up such a glaring percentage of time inside the Draw() loop, I don't really see a large payoff if I start cleaning up and optimizing the rest of the method. The open question I have at the moment is: Is the DrawElements() call much more expensive than almost any other call I would make? IE - Are results similar to what I have described expected? Thanks in advance for any replys.
  3. paulshady

    Optimizing OpenTK/OpenGL code in C#

    Anyone have any interesting input to this question? Thanks!
  4. Hey guys, I am working on a project in C# using OpenTK. I am using it in Windowed mode, meaning there are other controls visible on my WinForm, and there is also a GLControl visible on the WinForm. I'm drawing about 200-300 textured quads every frame. Right now I am not using the fixed function pipeline and not using any shaders. The vertex data for the quad is stored in a vertex buffer and index buffer. The VBO never changes, I just use matrix manipulation to move the quad around the screen and draw it where I need to. I used a profiler on my program and it seems over 95% of the time is spent in the OpenTK method: GL.DrawElements(...) My questions are: Is there any optimization I should be doing to lower that percentage? If I must draw this many quads every frame should I just assume the draw time will be very high? Is there a smarter way to do what I'm trying to accomplish? Should I even bother with other optimizing other areas such as ordering my texture switches? Since the draw call takes such a bulk of the time, it doesn't seem like other optimizations would get me very far. Any input or insight would be greatly appreciated Thanks guys!
  5. paulshady

    FVF and Shaders

    Edit: Moved to "For Beginners" lol, whatsup jeff
  6. paulshady

    Radnom number help

    OK, i'm proud of you for placing this in the "For Beginners" section... **** Anyways, heres some stuff to do: void functions dont return any data when called, change your function to this: int RollDice() { int num1; num1 = (rand() % 6) + 1; return num1; } that function returns an int when you call it! Also, if youre calling functions dont forget the parantheses Dice1() instead of Dice1.... Also, don't make 6 identical functions that all do the same thing, functions make it easy to do this: cout << RollDice() << " " << RollDice() << " " << RollDice() << endl;
  7. paulshady

    Stencil Shadows - please help me..

    genesys - you mention that you don't want to use VBO's....I could be wrong, but i don't think these calls use Vertex Buffer Objects glInterleavedArrays( GL_V3F, 0, myMesh.VertexBuffer ); glDrawElements( GL_TRIANGLES, listSize, GL_UNSIGNED_INT, &VertexBuffer ); you should prefer calls like these over sending hundreds of vertex3f calls over and over anyways.....i think that style is just for really new opengl users.....again, i could wrong
  8. paulshady

    Stencil Shadows - please help me..

    ive done something like this before: struct VERTEX_BUFFER { VECTOR3 position; //VECTOR3 is 3 floats } * VertexBuffer; For shadow volumes i think youll probably only need the position, otherwise you can fill up your struct with whatever else you want (UV Coords, Normals, etc...) Anyways, put your entire list of shadow volume data in the VERTEX_BUFFER thingy. Once you do that OGL allows this: glInterleavedArrays( GL_V3F, 0, myMesh.VertexBuffer ); glDrawElements( GL_TRIANGLES, listSize, GL_UNSIGNED_INT, &VertexBuffer ); I definitely prefer these calls over the GlBegin() glEnd() stuff. Let me know if youve used them before. also please don't correct my OGL syntax, i realize it might not be entirely accurate because i mainly use DirectX.
  9. paulshady

    Stencil Shadows - please help me..

    maybe the answer is actually in your question... it's slow.....why could it be slow? judging by your second image the lightsource appears to be the sun. you say "the light source is moving".....but shadows that the sun casts dont typically move noticeably all the time. Maybe you should do all these "COMPLEX" calculations once every 1000 frames or maybe 10,000 frames. ... Another possible solution would be to consider another method besides shadow volumes to create shadows for buildings and other static objects. I doubt that commercial games with big citys employ a method like the one your using to shadow TONS of buildings in a city. not trying to bash your idea or anything because i actually think the images you posted look pretty good. i would like to hear your thoughts on my feedback too. good luck
  10. paulshady

    Stencil Shadows - please help me..

    Quote: by caping you mean to trace for every quad the distance to the next object in lightvector direction and use this distance to calculate the length of the quad? whooooa, that sentence just blew my mind.... take a look at this page: http://www.codesampler.com/oglsrc/oglsrc_8.htm#ogl_shadow_volume maybe youve already been there, maybe not, itll probably give you some insight anyways
  11. paulshady

    Stencil Shadows - please help me..

    i'm not sure if this is the answer your looking for but you could cap your shadow volume to get rid of those floating artifacts below the whole city.
  12. paulshady

    file stream looping like crazy

    by the way, how do i add in that "SOLVED" thing?....or is that something a moderator does?
  13. paulshady

    file stream looping like crazy

    thanks for your help guys
  14. Lets say I have a text file with this line: 646; now heres some code: while (!inFile.eof()) { int number; inFile >> number; float erraticBehavior; inFile >> erraticBehavior; } this causes an endless loop.....why? I'm guessing the reason is that maybe the semicolon after the 646 is only 1 byte and i'm asking for a float value, which is more than 1 byte. That seems to be the case but I would expect that I would just get a wierd or undefined value for the float as opposed to the program deciding to just endlessly loop. Thanks for any replies
  15. paulshady

    King of pop.....or not?

    whoa whoa whoa........Sorry if the subject was a little misleading, I wasnt comparing him to MJ, I just thought more people would click on the thread titled "king of pop....or not?" rather than "the new justin timberlake cd!!!" anyways.....hmm, i don't know if you guys kid around a lot or not, but it was sort of a rhetorical question.....like, because of the subject matter, i was hoping to get a few humorous responses, as opposed to the BORING "You're gay" reply. Now, don't get me wrong, bash me all you want (i'm kind of excited to see what you come up with), but lets try and make all the replies at least a little funny.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!