How Can I.....(OpenGL)

This is a discussion on How Can I.....(OpenGL) within the Game Programming forums, part of the General Programming Boards category; so everytime you change the translate for the cube, it redraws, cuz theres a difference between your entire screen translating ...

  1. #16
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    so everytime you change the translate for the cube, it redraws, cuz theres a difference between your entire screen translating and just the cube

  2. #17
    Registered User
    Join Date
    Aug 2003
    Posts
    1,205
    You need to redraw it yourself.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  3. #18
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    Quote Originally Posted by Shamino
    so everytime you change the translate for the cube, it redraws, cuz theres a difference between your entire screen translating and just the cube
    There is no such thing as "change the translate for the cube" in openGL because there is no cube within opengl. All that's within opengl is the matrix stack (position/rotation/scale). Nothing is there until you give it drawing instructions.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  4. #19
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    this thread has gone completely offtopic...


    I really think you have no Idea at all what I'm talking about, and nor do I you....
    Last edited by Shamino; 05-25-2005 at 10:55 AM.

  5. #20
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Listen. It's simple.

    • Draw everything in memory
    • Blit everything from memory to screen
    • Wash, rinse, repeat ad nauseum


    Translating an object and all of those topcis are simple, very simple, 3D graphics fundamentals. If you do not understand them I suggest reading a book about 3D mathematics. There is no way possible we could explain 3D in one thread. Do yourself a favor and drop the game idea for now, purchase a book or two, and when you have compiled enough 3D knowledge....apply it and create your game.

    Otherwise all of our posts will just lead to more questions.

  6. #21
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    I understand perfectly translating 3d objects and drawing them n everything, i made pong! :d but what you are suggesting is something i've never done before

  7. #22
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    I understand perfectly translating 3d objects and drawing them n everything, i made pong! :d but what you are suggesting is something i've never done before
    Based on your responses in this thread I don't think you do.

    Evryone knows about double buffering and yet you act as if it is a foreign topic here. Also you want to perform everything on the front buffer - as in erasing rows of blocks, etc. That is not the proper way to use OpenGL.

    In Direct3D you would have to do the following to get a pointer to the front buffer.

    • Get an interface pointer to the swap chain.
    • Get an interface pointer to the front buffer via the swap chain interface
    • Get a pointer to the actual surface that is the front buffer by locking the surface.
    • Render to the front buffer
    • Unlock the front buffer


    This would result in major slowdowns. Anytime you must lock the buffer, you are probably not doing something right. And while steps 1 and 2 can be done beforehand and are not required each frame, locking and unlocking the buffer even just once per frame is too much.

    Everything in computer graphics is done via the back buffer. You render to the back buffer and then present it to the front buffer.
    Last edited by VirtualAce; 05-25-2005 at 05:26 PM.

  8. #23
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    ahhh, the buffers are foreign to me, this is true, I know how to draw objects, yes... but the buffer thingy is quite foreign to me...

    I understand what you are saying bubba i think... the back buffer is kinda like what you have drawn into memory, and the front buffer is only things you want to bring out of memory onto the actual screen... You are correct, I have been doing it wrong, I've been doing everything on the front buffer, nothing has been thrown into memory except for textures...... Thanks for this insight


    when I learned how to draw objects from NeHe, (up to lesson 7 now) he never explained drawing objects to the back buffer and then presenting them to the front buffer like that... Maybe i'm just not far enough along.....

    I've been using OpenGL like turbo C++ graphics
    Last edited by Shamino; 05-26-2005 at 10:43 AM.

  9. #24
    Registered User
    Join Date
    Aug 2003
    Posts
    1,205
    OpenGL does that for you. There is no need to worry about backbuffer and stuff, NeHe's tutorials does exactly that.

    with call to any of the glVertex functions you draw to the backbuffer, this is then braught to the front when you call SwapBuffer (I think it is).
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  10. #25
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    I think it is automatically drawn on the front though, i'm thinking my problem includes taking things from the front buffer if I don't need them on the screen

  11. #26
    ---
    Join Date
    May 2004
    Posts
    1,379
    Quote Originally Posted by Shamino
    I think it is automatically drawn on the front though, i'm thinking my problem includes taking things from the front buffer if I don't need them on the screen
    You don't want to do that!

    Draw EVERYTHING to the back buffer
    swap buffers (back buffer becomes the front buffer (is drawn to the screen)
    repeat.

  12. #27
    Registered User
    Join Date
    Aug 2003
    Posts
    1,205
    No! OpenGL automatically draws to the back-buffer!! Try this so you can actually see that this is true: Comment out the call to the function SwapBuffers, then you will see that nothing gets drawn, sooooo that means it has been drawn to the backbuffer and is then braught to the front when you call SwapBuffers!
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  13. #28
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    I don't even know how to just draw to the backbuffer...

    So confused, can someone take this to instant messager with me, or private messages?

    IM me at Shamino45...

    or PM me with a little help

  14. #29
    Registered User
    Join Date
    Aug 2003
    Posts
    1,205
    But for [beep] sake!!!! YOU DRAW TO THE BACKBUFFER ALREADY!!!! OPENGL DOES THIS FOR YOU!!!!! You dont need to worry about this.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  15. #30
    ---
    Join Date
    May 2004
    Posts
    1,379
    Haha, no one is going to want to talk to you via IM because you just can't seem to grasp the basics! Re read this whole thread and read it over and over until you understand. Then if you have another question, ask.

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  3. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 06:57 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 09:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21