Archived

This topic is now archived and is closed to further replies.

OpenGL OpenGL Game Programming's ambiguous Chapter 2

This topic is 5949 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I recently bought the book OpenGL Game Programming, and I''ve just completed reading Chapter 2. It seems to me that a few things aren''t explained in enough detail, such as the following...... 1.)I''ve seen quite a few Win32 tutorials, but none of them have ever explained this: exactly what in the world is a "handle"? They all use that term, but none of them define it in an easy-to-understand way. 2.) Page 46: "Several properties are assigned in the pixel format setup process, including color mode, depth buffer, bits per pixel, and whether the window is double-buffered." And no where are these terms explained; it''s all greek to me. Should I already know this stuff before moving on to OpenGL? Thanks in advance. ------------------------------- "A promise to a woman is just a lie that hasn''t happened yet." -Mr. Floppy

Share this post


Link to post
Share on other sites
I agree, but they already had a huge book, and the purpose was to teach OpenGL not windows programming. I found this helpful:

www.winprog.org

It answers a few questions. Take the windows programming tutorials.

Also, you should get a Windows Programming book from a bookstore or amazon.com, so you know how to program the games a bit better. That would definately explain it all.

Edited by - Drizzt DoUrden on September 27, 2001 7:11:04 PM

Share this post


Link to post
Share on other sites
A handle is like an ID we can maipulate resources such as windows, controls, devices, etc. by they handle, I picture this in my mind a linked list where all the controls in windows are stored and the handle is the ID to addressed some control ( i don''t know if this is correct or not but i undertand handles in that way).

Double buffer is a memory buffer on where you dump all your pixels and when you finish you dump the double buffer contents to the monitor so you can avoid flicking.

Bits per pixel how many bits you use to create a color the more bits the more colors.
color mode RGB, RGBA each color an a computer screen is composed by 3 colors ( Red, Green, Blue ) in some proportion. the A leter is the alpha value of the color ( transpanrency ).

Check the OpenGL Bible Book for OpenGL Setup and some graphics book for concepts.

sorry for my bad writing but I''m in a hurry.

Share this post


Link to post
Share on other sites
A handle is a 32-bit variable that references a certain object in system memory. Although its value might me meaningless to you (e.g. 0xa201fe39), the system knows what to do with it when you pass a window handle to a system function or the likes. A word of caution - never manipulate handles on your own; you could get some strange results, although my best guess is that you would crash your program (I''ve never tried this, so correct me if I''m wrong). The color mode of a display setting is the number of bits used to represent the color of each pixel on the screen. The most common modes are 8-bit palleted, meaning the screen is like a color-by-numbers picture, where each pixel has a number 1-256, and a look-up table (LUT) contains the RGB values for all 256 colors, 16-bit 555 (5 red bits, 5 green bits, 5 blue bits, 1 extraneous bit), 16-bit 565 (6 green bits), 24-bit, and 32-bit ARGB/RGBA (A = aplha = transparency value). A depth buffer, also known as a z-buffer, stores the depth of each pixel for 3-d scene rendering. I don''t know too much about it. A double-buffered window means that there are two ''surfaces'' that you are drawing to. You draw to a hidden back buffer, and then each frame, you flip the surfaces to produce smoother animation than with single buffering. I hope that helps.

Share this post


Link to post
Share on other sites
Thanks for your posts everyone.

However...perhaps I should''ve let you know ahead of time that I am completely clueless to all things graphics-related. And I suppose that it doesn''t help that I haven''t gained a mastery over C++ yet (which I''ve been learning for a year).

In any case, I think I''ll be getting in bed soon. I''ll check back/write more later.

Thanks!

-------------------------------
"A promise to a woman is just a lie that hasn''t happened yet."
-Mr. Floppy

Share this post


Link to post
Share on other sites
When we were told that we had to include introductory information on Win32 programming, we had a choice: provide really basic information and ask the readers to use it on more or less blind faith, or provide detailed coverage spanning several chapters. Since the latter would have required that we drop other chapters, we chose the former.

As far as the other issues, we had to make base assumptions about our readers. We assume that they have a good grasp of C++, and that they have at least a basic knowledge of the things involved in game development. It seems that most people who are into 3D gaming at all (and we''re not talking programming here, just gamers) would be familiar with many of the basic terms. If not, there are sites (such as our own Game Dictionary) that provide definitions.

In retrospect, perhaps we should have planned this to be two books from the very beginning, and made the first book a little more beginner-friendly.

Share this post


Link to post
Share on other sites
Mr. Astle: Okay, now I understand. I wish the book had had a section in the beginning telling the assumptions that the authors had made.

Share this post


Link to post
Share on other sites
quote:
Original post by Drizzt DoUrden
Didnt think it would be sp popular, huh?
No, we thought it would be fairly popular actually. The reason we never considered doing two volumes was that we didn''t think we''d ever want to write another book. A lot of time and effort went into the first, and we didn''t think we''d want to go through all that again.

Share this post


Link to post
Share on other sites
quote:
Original post by Ghostface
Mr. Astle: Okay, now I understand. I wish the book had had a section in the beginning telling the assumptions that the authors had made.
Heh, who calls me Mr. Astle? I could have sworn that the book had something at the front indicating the intended audience. I can remember writing something about it. But I looked and there''s nothing there. Anyway, I hope you''re able to work through the rest of it okay.

Share this post


Link to post
Share on other sites
I checked because I thought you wrote something too, but there''s nothing. There''s a brief mention that we assume people are familiar with C++, but it''s right before discussing something.

Kevin

Share this post


Link to post
Share on other sites
I''ve been really busy lately, but recently I took the time to sit down and read chapter three. Even though some of the explanations were quite incomprehensible (like, why are normalized vectors so imporant? but then again, i don''t know much), I moved through it and had an ok grasp on just about everything. Then, I got to a page where it mentioned that you should know trigonometry, and I just about screamed in frustration, because I haven''t had trig yet. So, I suppose this is a message from God telling me not to learn OpenGL. Or, at least that would be a convenient excuse for giving up.

In any case, I suppose I''ll just have to let the book gather a little bit of dust on my shelf until I do two things: learn the basics of Windows programming and understand all of its concepts, and learn trig.

PLEASE, if you guys write another book, be sure to include a "What you need to know" or "Authors'' assumptions" page at the beginning.



P.S. Do I need to know linear algebra? If so, I''m worse off than I thought.

-------------------------------
"A promise to a woman is just a lie that hasn''t happened yet."
-Mr. Floppy

Share this post


Link to post
Share on other sites
I suppose we COULD have had an appendix on trigonometry, but we were trying to make the schedule. In response to the two topics you feel you should know for 3D graphics - don''t worry about Windows, just know the basics; you need to have an idea on trigonometry to do anything seriously useful. That would actually apply to anything geometrical.

Kevin

Share this post


Link to post
Share on other sites
Trigonometry is great to know, but its not really essential for 3D programming. I still haven''t taken it and I''ve been working with 3D APIs for about a year now . I wouldn''t stop learning OpenGL just because you don''t know it, for the most part you only need the trigonometry for rotations and some collision detection stuff, so you can probably sneak by as long as you understand what the functions are doing -- even if you don''t fully understand the math. Yeah, I know thats not the best way to go about learning things, but its better than not learning at all.

Of course, its not bad to study the math a bit on your own before you take a class on it.

---------------------------
FaceHat Software -- Wear the hat.

Share this post


Link to post
Share on other sites
Well, the thing I found most usefull after reading the book, was teachers at school... Math teachers... Finally found a use for them, since Vector and Plane calculations are no longer handled in our Math classes... Though, old teachers tend to have very usefull books around, on just about any topic...

Share this post


Link to post
Share on other sites

  • Similar Content

    • By _OskaR
      Hi,
      I have an OpenGL application but without possibility to wite own shaders.
      I need to perform small VS modification - is possible to do it in an alternative way? Do we have apps or driver modifictions which will catch the shader sent to GPU and override it?
    • By xhcao
      Does sync be needed to read texture content after access texture image in compute shader?
      My simple code is as below,
      glUseProgram(program.get());
      glBindImageTexture(0, texture[0], 0, GL_FALSE, 3, GL_READ_ONLY, GL_R32UI);
      glBindImageTexture(1, texture[1], 0, GL_FALSE, 4, GL_WRITE_ONLY, GL_R32UI);
      glDispatchCompute(1, 1, 1);
      // Does sync be needed here?
      glUseProgram(0);
      glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);
      glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                     GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texture[1], 0);
      glReadPixels(0, 0, kWidth, kHeight, GL_RED_INTEGER, GL_UNSIGNED_INT, outputValues);
       
      Compute shader is very simple, imageLoad content from texture[0], and imageStore content to texture[1]. Does need to sync after dispatchCompute?
    • By Jonathan2006
      My question: is it possible to transform multiple angular velocities so that they can be reinserted as one? My research is below:
      // This works quat quaternion1 = GEQuaternionFromAngleRadians(angleRadiansVector1); quat quaternion2 = GEMultiplyQuaternions(quaternion1, GEQuaternionFromAngleRadians(angleRadiansVector2)); quat quaternion3 = GEMultiplyQuaternions(quaternion2, GEQuaternionFromAngleRadians(angleRadiansVector3)); glMultMatrixf(GEMat4FromQuaternion(quaternion3).array); // The first two work fine but not the third. Why? quat quaternion1 = GEQuaternionFromAngleRadians(angleRadiansVector1); vec3 vector1 = GETransformQuaternionAndVector(quaternion1, angularVelocity1); quat quaternion2 = GEQuaternionFromAngleRadians(angleRadiansVector2); vec3 vector2 = GETransformQuaternionAndVector(quaternion2, angularVelocity2); // This doesn't work //quat quaternion3 = GEQuaternionFromAngleRadians(angleRadiansVector3); //vec3 vector3 = GETransformQuaternionAndVector(quaternion3, angularVelocity3); vec3 angleVelocity = GEAddVectors(vector1, vector2); // Does not work: vec3 angleVelocity = GEAddVectors(vector1, GEAddVectors(vector2, vector3)); static vec3 angleRadiansVector; vec3 angularAcceleration = GESetVector(0.0, 0.0, 0.0); // Sending it through one angular velocity later in my motion engine angleVelocity = GEAddVectors(angleVelocity, GEMultiplyVectorAndScalar(angularAcceleration, timeStep)); angleRadiansVector = GEAddVectors(angleRadiansVector, GEMultiplyVectorAndScalar(angleVelocity, timeStep)); glMultMatrixf(GEMat4FromEulerAngle(angleRadiansVector).array); Also how do I combine multiple angularAcceleration variables? Is there an easier way to transform the angular values?
    • By dpadam450
      I have this code below in both my vertex and fragment shader, however when I request glGetUniformLocation("Lights[0].diffuse") or "Lights[0].attenuation", it returns -1. It will only give me a valid uniform location if I actually use the diffuse/attenuation variables in the VERTEX shader. Because I use position in the vertex shader, it always returns a valid uniform location. I've read that I can share uniforms across both vertex and fragment, but I'm confused what this is even compiling to if this is the case.
       
      #define NUM_LIGHTS 2
      struct Light
      {
          vec3 position;
          vec3 diffuse;
          float attenuation;
      };
      uniform Light Lights[NUM_LIGHTS];
       
       
    • By pr033r
      Hello,
      I have a Bachelor project on topic "Implenet 3D Boid's algorithm in OpenGL". All OpenGL issues works fine for me, all rendering etc. But when I started implement the boid's algorithm it was getting worse and worse. I read article (http://natureofcode.com/book/chapter-6-autonomous-agents/) inspirate from another code (here: https://github.com/jyanar/Boids/tree/master/src) but it still doesn't work like in tutorials and videos. For example the main problem: when I apply Cohesion (one of three main laws of boids) it makes some "cycling knot". Second, when some flock touch to another it scary change the coordination or respawn in origin (x: 0, y:0. z:0). Just some streng things. 
      I followed many tutorials, change a try everything but it isn't so smooth, without lags like in another videos. I really need your help. 
      My code (optimalizing branch): https://github.com/pr033r/BachelorProject/tree/Optimalizing
      Exe file (if you want to look) and models folder (for those who will download the sources):
      http://leteckaposta.cz/367190436
      Thanks for any help...

  • Popular Now