1. Post #481
    Gold Member
    Lexic's Avatar
    March 2009
    6,123 Posts
    I've been inadvertently learning some opengl in the whole opencl -> opengl interop thing

    Is it just me, or is the whole concept of immediate mode (in terms of performance) obviously flawed? Pushing your vertices every frame to the graphics card is asking for performance issues.

    Plus, it's difficult to find resources on opengl which aren't deprecated (ie immediate mode). The interface is ugly, and everything seems a little bit.. randomly named/functioning. I also dislike the fact that it works as a state machine, because that means having to unnecessarily bind and unbind textures and everything else everytime you think about using them, as well as all the matrices and etc that you might want to associate with them. It makes the code a complete, obtuse scattering of functions

    The whole thing is a mess of deprecated and non deprecated functions. Someone needs to scrap all of it and go for a new, cleaner and much simpler standard

    I would love to hear any counterarguments against any of my points. Perhaps i've missed a particularly helpful resource page, or maybe I haven't quite grasped something. But currently my opinion of OpenGL is that it is pretty awful
    Immediate mode is from the 90s.
    Try these:
    OpenGL SuperBible (Explains everything) OpenGl-Tutorial (good 'getting started' guide, no real info) Learning Modern 3D Graphics Programming (Looks good, I haven't read it)
    Reply With Quote Edit / Delete Mac United Kingdom Show Events Informative Informative x 1Agree Agree x 1 (list)

  2. Post #482
    Gold Member
    ZenX2's Avatar
    February 2009
    5,125 Posts
    Immediate mode is from the 90s.
    Try these:
    OpenGL SuperBible (Explains everything) OpenGl-Tutorial (good 'getting started' guide, no real info) Learning Modern 3D Graphics Programming (Looks good, I haven't read it)
    Or maybe just open.gl?
    Reply With Quote Edit / Delete Linux United States Show Events Funny Funny x 19 (list)

  3. Post #483
    Gold Member
    ShaunOfTheLive's Avatar
    November 2007
    9,904 Posts
    Or maybe just open.gl?
    Oh man, he's going to be able to open the most non-deprecated blank window ever!
    Reply With Quote Edit / Delete Windows 7 Canada Show Events Funny Funny x 33 (list)

  4. Post #484
    chimitos's Avatar
    September 2010
    2,378 Posts
    Now my engine supports looped background music!
    Reply With Quote Edit / Delete Windows Vista United States Show Events Informative Informative x 3Programming King Programming King x 2Winner Winner x 2 (list)

  5. Post #485
    I fucking love eggs!!!
    Averice's Avatar
    July 2007
    1,991 Posts
    *video*
    This is 8192 particles run on one worker, lagging because of compression and fraps
    Everytime I watch it, as soon as the particles spawn, my eyes go all fucking spastic. But nice work nonetheless.
    Reply With Quote Edit / Delete Windows 7 Australia Show Events Informative Informative x 1 (list)

  6. Post #486
    Gold Member
    robmaister12's Avatar
    January 2008
    4,969 Posts
    Immediate mode is from the 90s.
    Try these:
    OpenGL SuperBible (Explains everything) OpenGl-Tutorial (good 'getting started' guide, no real info) Learning Modern 3D Graphics Programming (Looks good, I haven't read it)
    More specifically 1992. Immediate mode is 20 years old. DirectX 1.0 was released in 1995 and DirectX 8 was released in 2000, for the person who said immediate mode = DirectX 8.

    The reason immediate mode was used initially was because back then, the overhead of a method call was nothing compared to the time the vertex processor took (plus the number of vertices rendered was tiny compared to today's models). OpenGL 1.1, released in the same year, added support for vertex arrays. That means that immediate mode was the exclusive way to render with OpenGL for less than a year.

    In addition to the OpenGL SuperBible (which I have a copy of, immensely useful both as a guide and a reference) and the two online guides you posted, both of which I usually recommend, this: http://www.swiftless.com/opengltuts/opengl4tuts.html

    With modern OpenGL, most of the "state" is gone. No matrix state, no lighting/material state, etc. The only state you'll ever deal with are things you'll typically enable once and leave on (depth testing, blending, etc), (un)binding buffers/textures, and enabling/disabling vertex attributes.

    Oh, and a tip to keep in mind when learning about modern OpenGL: As graphics technology evloved, more triangles could be drawn in less time. At some point that time got so small that the time a method call takes became significant. Because of this, the way to optimize rendering is to do as much as possible during initialization, store it, and call it during the main loop.

    So when you see something like VAOs, realize that they're made only to offset as much work as possible to initialization.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 3Programming King Programming King x 1Informative Informative x 1 (list)

  7. Post #487
    simie's Avatar
    March 2008
    134 Posts
    I made this scanner thing

    Reply With Quote Edit / Delete Mac United Kingdom Show Events Artistic Artistic x 22 (list)

  8. Post #488
    ben1066's Avatar
    August 2009
    1,101 Posts
    I doubt we will ever see XNA 5.0
    Hmm? Why do you say that. The next generation Xbox will likely have a hobbyist API and XNA 5.0 seems the natural progression. Also Visual Studio 11 won't integrate with XNA 4.0, so unless they just do 4.0 refresh 2... Even if there isn't XNA 5.0, nothing to stop MonoGame taking it further, they've pretty much got everything except the content pipeline compile integrated now.
    Reply With Quote Edit / Delete Windows 8 United Kingdom Show Events

  9. Post #489
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts


    Edited:

    Also, I've found an alarming lack of hex to ascii conversion functions on the internet, so I threw together my own really quick:

    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  10. Post #490
    Gold Member
    Lexic's Avatar
    March 2009
    6,123 Posts
    More specifically 1992. Immediate mode is 20 years old.
    [...]
    OpenGL 1.1, released in the same year, added support for vertex arrays. That means that immediate mode was the exclusive way to render with OpenGL for less than a year.
    Uh, 1.1 came out in 1997, five years later.[sup][1][2][/sup]

    Edited:

    It's worth noting that VAs were finalised in 1995 and were probably available long before that as vendor extensions.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Informative Informative x 4 (list)

  11. Post #491
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    I was browsing /r/opengl this morning and I noticed a topic about someone needing help with "installing OpenGL". I opened the thread and saw that he was actually using open.gl to learn, which made me feel all warm and fuzzy inside.

    Problem was that he was trying to link headers and placed random dlls in System32. Oh well, good thing he learned not to overshoot before messing up his computer.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Funny Funny x 17Friendly Friendly x 1 (list)

  12. Post #492
    my portfolio
    Dennab
    April 2012
    1,392 Posts
    he was actually using open.gl to learn
    Oh man, he's going to be able to open the most non-deprecated blank window ever!
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Funny Funny x 14Agree Agree x 2Zing Zing x 1 (list)

  13. Post #493
    Gold Member
    Asgard's Avatar
    July 2010
    3,681 Posts
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events Informative Informative x 1 (list)

  14. Post #494
    RUBY OVERLORD
    swift and shift's Avatar
    November 2011
    2,115 Posts
    right on!



    Edited:

    remember folks, everything you see on that screen was done with javascript!

    Edited:

    Here is the source to all the userland utilities if anyone'd like to take a look: https://github.com/charliesome/jsos/.../kernel/js/bin

    If you know JavaScript or CoffeeScript, you should write a program for JSOS!
    Reply With Quote Edit / Delete Mac Australia Show Events Programming King Programming King x 11Artistic Artistic x 1 (list)

  15. Post #495
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    right on!



    Edited:

    remember folks, everything you see on that screen was done with javascript!
    POTY every year
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Agree Agree x 5 (list)

  16. Post #496
    Team Hamster
    Mordi's Avatar
    January 2012
    312 Posts
    void glfwGetMousePos( int *xpos, int *ypos )

    That works for that exact purpose? It returns mouse position in relation to the upper-left bound of the window. Works flawlessly (just tested it).
    Let's say you were running in windowed-mode and you're allowing the user move the window. How do you get the point of the mouse as it appears in your operating system? Since that function returns the position in relation to the window position, you would need to subtract the position of the window to get the absolute position on the screen.
    Reply With Quote Edit / Delete Windows 7 Norway Show Events

  17. Post #497
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    I saw an ad in the train today about some transit company that wants 10k followers on Twitter and you can win a prize if you're the 10000th follower. Of course I set out to write a script that watches the Twitter account and it will auto follow it after it's at 9999 followers. Unfortunately I shortly noticed that it goes up from ~9600 with a rate of about 2 per hour. Sad face.
    Reply With Quote Edit / Delete Netherlands Show Events Friendly Friendly x 6 (list)

  18. Post #498
    garry's Avatar
    September 2001
    12,435 Posts
    Made a ribbon renderer in Canvas2D, but its got these awful defects. I'm drawing polygon triangles to support a WebGL renderer too. I guess I need to make it a special case and use the path stuff.



    Blurgh

    http://jsfiddle.net/xnfHL/1/
    Reply With Quote Edit / Delete Windows 7 Show Events Funny Funny x 1Artistic Artistic x 1 (list)

  19. Post #499
    Gold Member
    Darwin226's Avatar
    January 2009
    4,159 Posts
    I saw an ad in the train today about some transit company that wants 10k followers on Twitter and you can win a prize if you're the 10000th follower. Of course I set out to write a script that watches the Twitter account and it will auto follow it after it's at 9999 followers. Unfortunately I shortly noticed that it goes up from ~9600 with a rate of about 2 per hour. Sad face.
    That sounds like a horrible marketing plan. Instead of everyone following them now, people are just going to sit and wait so they can be #10000
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events Agree Agree x 14 (list)

  20. Post #500
    Hruhf's Avatar
    September 2007
    631 Posts

    Got me some equipment, next up is combat.

    Edited:


    There's also block placement, but that's only for debug really. Water needs some work.
    Reply With Quote Edit / Delete Windows 7 Australia Show Events Winner Winner x 2 (list)

  21. Post #501
    Gold Member
    ace13's Avatar
    August 2006
    957 Posts
    Got my arrays fixed and working properly, now to implement proper typing and classes...

    test.evil:
    Code:
    plan NoteEverything(array Inp)
      every Item in Inp?
        print("Note: ", Item, "\n").
      repeatedly.
    finished.
    
    Arr = [1,2,3,4,5,["Hello", "World"]].
    every I in Arr? puts(I). repeatedly.
    
    NoteEverything(Arr).
    $ ruby wmd.rb test.evil:
    Code:
    Initializing Weapons of Mass Destruction...
    Executing file test.evil...
    Parsing program...
    Program parses to:
    plan NoteEverything([array Inp]) every Item in Inp? print(["Note: ", Item, "\n"]). repeatedly. finished.
    Arr=[1, 2, 3, 4, 5, ["Hello", "World"]].
    every I in Arr? puts([I]). repeatedly.
    NoteEverything([Arr]).
    
    
    Running program.
    1
    2
    3
    4
    5
    ["Hello", "World"]
    Note: 1
    Note: 2
    Note: 3
    Note: 4
    Note: 5
    Note: ["Hello", "World"]
    Stopping system.
    We hope you enjoyed this bout of world domination.
    Reply With Quote Edit / Delete Linux Sweden Show Events

  22. Post #502
    graymic's Avatar
    September 2005
    187 Posts
    Water being rendered in a separate pass, so I can get the translucency right:

    Also fog! :D
    Are you using some quad tree / fractal to generate infinite terrain or have you defined constant dimensions so it's not "infinite"?

    I've been trying to work out how to load "chunks" into the world with Jmonkey, but thus far I've only achieved this:

    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Funny Funny x 1 (list)

  23. Post #503
    ben1066's Avatar
    August 2009
    1,101 Posts

    It lives... (Exponential shadow mapping)
    Reply With Quote Edit / Delete Windows 8 United Kingdom Show Events Artistic Artistic x 4Programming King Programming King x 1 (list)

  24. Post #504
    chimitos's Avatar
    September 2010
    2,378 Posts
    Are there any tutorials for setting up Open GL ES like the Android canvas?
    Reply With Quote Edit / Delete United States Show Events

  25. Post #505
    Icedshot's Avatar
    April 2010
    2,361 Posts


    Framebuffer object sharing is going well
    Reply With Quote Edit / Delete Windows Vista United Kingdom Show Events Funny Funny x 4Artistic Artistic x 1Disagree Disagree x 1 (list)

  26. Post #506
    calzoneman's Avatar
    February 2008
    460 Posts
    Let's say you were running in windowed-mode and you're allowing the user move the window. How do you get the point of the mouse as it appears in your operating system? Since that function returns the position in relation to the window position, you would need to subtract the position of the window to get the absolute position on the screen.
    Excuse me if I'm just ignorant, but why the hell would you need to know the absolute position of the mouse?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 1 (list)

  27. Post #507
    www.bff-hab.de
    Dennab
    February 2009
    7,832 Posts
    Hey guys, I've been trying to do some serial communication to my microcontroller when suddenly:



    It's like in a movie
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Funny Funny x 11 (list)

  28. Post #508
    Icedshot's Avatar
    April 2010
    2,361 Posts


    Turns out i'd forgot to clear the renderbuffer every frame, and opengl colours go from 0 to 1, not 0 to 255. Next thing i need to implement is tesselation, and then it should run pretty fast
    Reply With Quote Edit / Delete Windows Vista United Kingdom Show Events Programming King Programming King x 1 (list)

  29. Post #509
    Naarkie's Avatar
    September 2011
    320 Posts

    EDIT: Didn't realise it isn't really obvious what this does. It connects two Omegle strangers together. Names are assigned to make it easier to follow the conversation. You can simply spy on the conversation or interject and say things of your invention.
    Reply With Quote Edit / Delete Windows 7 South Africa Show Events Programming King Programming King x 2Late Late x 1Informative Informative x 1 (list)

  30. Post #510
    Gold Member
    0lenny0's Avatar
    March 2010
    425 Posts
    I find really old computer stuff fascinating.

    To see the differences between modern and the modern-not-that-long-ago.
    Makes me wonder where computers will be by the time I'm old.
    I found lots of old computers, PLC's, electronics,... at school. I am now spending most of my time working with them. I love playing around with old electronics and other stuff.
    Reply With Quote Edit / Delete Windows 7 Belgium Show Events Winner Winner x 1 (list)

  31. Post #511
    Gold Member

    October 2008
    3,838 Posts
    So I've been trying to make my block game less... blocky.
    Left = before, right = after

    I think it looks pretty good (but the lava still has visible seams)
    Reply With Quote Edit / Delete Windows 7 United States Show Events Artistic Artistic x 8Winner Winner x 1 (list)

  32. Post #512
    Gold Member
    dije's Avatar
    December 2008
    4,760 Posts
    So I've been trying to make my block game less... blocky.
    Left = before, right = after

    I think it looks pretty good (but the lava still has visible seams)
    How did you do that 2D?
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events

  33. Post #513
    Team Hamster
    Mordi's Avatar
    January 2012
    312 Posts
    Excuse me if I'm just ignorant, but why the hell would you need to know the absolute position of the mouse?
    Well, I'll let this video do most of the explaining. As you can see, my in-game cursor is way off of the actual position of the cursor.



    Also, check out that textbox with text that breaks. I spent several hours yesterday and today scratching my head over how to make it properly break the lines...

    It's probably horribly unoptimized:
    void Font::DrawFormatted(int x, int y, std::string str, int width, int lineHeight)
    {
    	int pos = 0, posPrev = 0;
    	while(GetWidth(str.substr(posPrev, str.length() - posPrev)) > width)
    	{
    		while(GetWidth(str.substr(posPrev, pos - posPrev)) < width) // find the first line
    		{
    			pos ++;
    		}
    		if (str.substr(posPrev, pos - posPrev).find_first_of(" ", 0) != string::npos) // if the line contains a space
    		{
    			while(str.substr(pos - 1, 1) != " ")
    			{
    				pos --;
    			}
    		}
    		else // insert a dash at the end of the line
    		{
    			pos--;
    			str.insert(pos - 1, "-");
    		}
    
    		Draw(x, y, str.substr(posPrev, pos - posPrev), 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
    		y += lineHeight;
    
    		posPrev = pos;
    	}
    
    	// Draw the last line
    	Draw(x, y, str.substr(pos, str.length() - pos), 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
    }
    Reply With Quote Edit / Delete Windows 7 Norway Show Events

  34. Post #514
    Gold Member

    October 2008
    3,838 Posts
    How did you do that 2D?
    Basically I have this seamless "main" texture I made...

    And then I draw kinda around it, as a "detail" texture:

    And then, for all blocks, I draw the detail textures first with random rotation and flipping/mirroring, and then I draw all the main textures over them (also with random rotation and flipping/mirroring). Because the texture is so grainy, you hardly notice the seams at the edges.
    Same goes for the lava.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Winner Winner x 2 (list)

  35. Post #515
    ben1066's Avatar
    August 2009
    1,101 Posts
    Hmm, so if BSP is so outdated, what would be a modern map format to load? Preferably with tools already available to edit it :P
    Reply With Quote Edit / Delete Windows 8 United Kingdom Show Events

  36. Post #516
    Gold Member
    dije's Avatar
    December 2008
    4,760 Posts
    Well, I'll let this video do most of the explaining. As you can see, my in-game cursor is way off of the actual position of the cursor.



    Also, check out that textbox with text that breaks. I spent several hours yesterday and today scratching my head over how to make it properly break the lines...

    It's probably horribly unoptimized:
    void Font::DrawFormatted(int x, int y, std::string str, int width, int lineHeight)
    {
    	int pos = 0, posPrev = 0;
    	while(GetWidth(str.substr(posPrev, str.length() - posPrev)) > width)
    	{
    		while(GetWidth(str.substr(posPrev, pos - posPrev)) < width) // find the first line
    		{
    			pos ++;
    		}
    		if (str.substr(posPrev, pos - posPrev).find_first_of(" ", 0) != string::npos) // if the line contains a space
    		{
    			while(str.substr(pos - 1, 1) != " ")
    			{
    				pos --;
    			}
    		}
    		else // insert a dash at the end of the line
    		{
    			pos--;
    			str.insert(pos - 1, "-");
    		}
    
    		Draw(x, y, str.substr(posPrev, pos - posPrev), 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
    		y += lineHeight;
    
    		posPrev = pos;
    	}
    
    	// Draw the last line
    	Draw(x, y, str.substr(pos, str.length() - pos), 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
    }
    Just subtract the screen mouse pos with the window coords?

    Edited:

    Basically I have this seamless "main" texture I made...

    And then I draw kinda around it, as a "detail" texture:

    And then, for all blocks, I draw the detail textures first with random rotation and flipping/mirroring, and then I draw all the main textures over them (also with random rotation and flipping/mirroring). Because the texture is so grainy, you hardly notice the seams at the edges.
    Same goes for the lava.
    No, I'm talking about the actual code implementation
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events

  37. Post #517
    Team Hamster
    Mordi's Avatar
    January 2012
    312 Posts
    Just subtract the screen mouse pos with the window coords?
    Now we're back to where we started. GLFW doesn't have a function to retrieve the window's position!

    That's why GLFW is perfect for me, except for the fact that it doesn't have this function. Fin.
    Reply With Quote Edit / Delete Windows 7 Norway Show Events

  38. Post #518
    ASK ME ABOUT MY PLAYBOOK INSTEAD OF COLLEGE
    icantread49's Avatar
    April 2011
    1,626 Posts
    RIM accepted Phyzicle for PlayBook!

    Just gotta wait for Apple to approve it for iOS and it shall be released!
    Reply With Quote Edit / Delete Windows XP United States Show Events Winner Winner x 12Zing Zing x 1 (list)

  39. Post #519
    Map in a box's Avatar
    July 2009
    7,417 Posts
    You should release it to google play like now
    Reply With Quote Edit / Delete Windows XP United States Show Events

  40. Post #520
    calzoneman's Avatar
    February 2008
    460 Posts
    Well, I'll let this video do most of the explaining. As you can see, my in-game cursor is way off of the actual position of the cursor.

    -vid-

    Also, check out that textbox with text that breaks. I spent several hours yesterday and today scratching my head over how to make it properly break the lines...

    It's probably horribly unoptimized:
    void Font::DrawFormatted(int x, int y, std::string str, int width, int lineHeight)
    {
    	int pos = 0, posPrev = 0;
    	while(GetWidth(str.substr(posPrev, str.length() - posPrev)) > width)
    	{
    		while(GetWidth(str.substr(posPrev, pos - posPrev)) < width) // find the first line
    		{
    			pos ++;
    		}
    		if (str.substr(posPrev, pos - posPrev).find_first_of(" ", 0) != string::npos) // if the line contains a space
    		{
    			while(str.substr(pos - 1, 1) != " ")
    			{
    				pos --;
    			}
    		}
    		else // insert a dash at the end of the line
    		{
    			pos--;
    			str.insert(pos - 1, "-");
    		}
    
    		Draw(x, y, str.substr(posPrev, pos - posPrev), 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
    		y += lineHeight;
    
    		posPrev = pos;
    	}
    
    	// Draw the last line
    	Draw(x, y, str.substr(pos, str.length() - pos), 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
    }
    I don't understand how that's a problem of not having the absolute position. Wouldn't you draw the cursor at the relative position?

    I can't think of a reason to need absolute position for cursor rendering that isn't an obscene hack.
    Reply With Quote Edit / Delete Windows 7 United States Show Events