Bitcoin Forum
May 26, 2024, 09:39:39 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 »  All
  Print  
Author Topic: The Coding Thread  (Read 2704 times)
Lethn (OP)
Legendary
*
Offline Offline

Activity: 1540
Merit: 1000



View Profile WWW
May 12, 2013, 05:31:33 AM
 #1

Considering there are clearly tons of programmers/learning programmers here I think we should make a thread where we can talk about different programming languages and help each other out, I'm currently messing around in OpenGL though I suspect if I want to make anything functional like a game I'm going to have to properly get into C++ too, feel free to post code here of stuff you're working on and need help with etc.


Quote


            glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            glClear(GL_COLOR_BUFFER_BIT);

            glLoadIdentity();
            glPushMatrix();
            glTranslatef(-0.5f, -0.5f, 0.0f);
            glPushMatrix();
            glRotatef (90.0f, -180.0f, 0.0f, 0.0f);
            glPopMatrix();

                                            glBegin(GL_TRIANGLES);




                                            glVertex3f(0.5f, 0.5f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);
                                            glVertex3f(1.5f, 0.5f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);
                                            glVertex3f(0.5f, 1.0f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);

                                            glVertex3f(0.5f, 1.0f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);
                                            glVertex3f(1.5f, 0.5f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);
                                            glVertex3f(1.5f, 1.0f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);

                                            glVertex3f(0.5f, 1.0f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);
                                            glVertex3f(1.5f, 1.0f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);
                                            glVertex3f(1.0f, 1.5f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);



            glEnd();

            glPopMatrix();


I made a pink pentagon, WEEEEEEEEE! Cheesy Can't figure out how to get GLRotatef working though.
Este Nuno
Legendary
*
Offline Offline

Activity: 826
Merit: 1000


amarha


View Profile
May 12, 2013, 01:28:27 PM
 #2

Nothing to add atm, but I support this idea for a thread.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1078


Ian Knowles - CIYAM Lead Developer


View Profile WWW
May 12, 2013, 01:34:30 PM
 #3

Purely from a C++ coding style perspective I see no reason to be "indenting" the function calls you have (indenting is normally done for code *blocks* that are surrounded by braces or for conditional expressions).

You might consider using an "empty code block" to make it more express the indenting you are after though:

Code:
...
glPopMatrix();
{
   glBegin(GL_TRIANGLES);
   ...
   glEnd();
}


With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1255


May Bitcoin be touched by his Noodly Appendage


View Profile
May 12, 2013, 01:52:28 PM
 #4

I support a coding (sub-)FORUM

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
BitshireHashaway
Full Member
***
Offline Offline

Activity: 182
Merit: 100



View Profile WWW
May 12, 2013, 07:20:32 PM
 #5

I am interested in learning C++ mainly because that seems to be the most widely used language out there. I am already familiar with HTML because I've learned it some in school and have used it in creating my websites, and next year, I will be learning some Java as part of a course and will probably continue to mastery the following year. However, C++ I will need to learn by myself, so do you guys have any recommendations for me learning it by myself. My parents may help me as they both know C++ and multiple other coding languages.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1078


Ian Knowles - CIYAM Lead Developer


View Profile WWW
May 13, 2013, 02:09:21 AM
 #6

I would recommend reading Scott Meyers and Herb Sutter and keeping your focus on Standard C++ always (i.e. not extensions for specific compilers such as MSVC).

BTW - https://bitcointalk.org/index.php?topic=203104.0.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
adamstgBit
Legendary
*
Offline Offline

Activity: 1904
Merit: 1037


Trusted Bitcoiner


View Profile WWW
May 13, 2013, 02:38:35 AM
 #7

i can do the job 2 of 3 ways;

Cheap, Fast, Good

if you want it:
Cheap & Fast,  fine, but it won't be very good.. (Dirty Code! lol )
Good & Cheap, ok, ill do my best!
Good & Fast,    sure, but thats not going to be cheap.  50,000BTC  Wink

 Tongue

Lethn (OP)
Legendary
*
Offline Offline

Activity: 1540
Merit: 1000



View Profile WWW
May 14, 2013, 06:44:16 PM
 #8

Have to admit, I think I'm starting to really enjoy messing around in OpenGL Cheesy I just need to figure out how to make it interactive.

Quote
             glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            glClear(GL_COLOR_BUFFER_BIT);

            glLoadIdentity();
            glPushMatrix();
            glTranslatef(-1.0f, -1.0f, 0.0f);
            glPushMatrix();
            glRotatef (90.0f, -180.0f, 0.0f, 0.0f);
            glPopMatrix();

                                            glBegin(GL_TRIANGLES);




                                            glVertex3f(0.5f, 0.5f, 0.0f);   glColor3f(2.0f, 0.5f, -1.0f);
                                            glVertex3f(1.5f, 0.5f, 0.0f);   glColor3f(1.0f, 0.5f, -1.0f);
                                            glVertex3f(0.5f, 1.0f, 0.0f);   glColor3f(6.0f, 0.5f, -1.0f);

                                            glVertex3f(0.5f, 1.0f, 0.0f);   glColor3f(1.0f, 0.5f, -1.0f);
                                            glVertex3f(1.5f, 0.5f, 0.0f);   glColor3f(2.0f, 0.5f, 1.0f);
                                            glVertex3f(1.5f, 1.0f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);

                                            glVertex3f(0.5f, 1.0f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);
                                            glVertex3f(1.5f, 1.0f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);
                                            glVertex3f(1.0f, 1.5f, 0.0f);   glColor3f(1.0f, 0.5f, 1.0f);



            glEnd();

            glPopMatrix();


Coding spam woopeee! Cheesy
raze
Full Member
***
Offline Offline

Activity: 182
Merit: 100



View Profile
May 15, 2013, 03:52:17 AM
 #9

Just remember it's not the language that matters (okay, maybe it matters a little), it's the practices and techniques you learn from using that language. If you master the correct techniques, you'll pick up future languages faster, and produce better code and documentation.

BTC --16FPbgyUZdTm1voAfi26VZ3RH7apTFGaPm
LTC -- Lhd3gmj84BWqx7kQgqUA7gyoogsLeJbCXb
PPC -- PRpKGjgjNLFv8eR7VVv7jBaP8aexDFqk4C
Elwar
Legendary
*
Offline Offline

Activity: 3598
Merit: 2386


Viva Ut Vivas


View Profile WWW
May 15, 2013, 04:32:05 AM
 #10

Have to admit, I think I'm starting to really enjoy messing around in OpenGL Cheesy I just need to figure out how to make it interactive.

I did some coding in OpenGL, it is pretty fun. I had to open up some of my old math books from college that I figured I would never need again.

For interaction, you should first start with using a key listener. Making stuff happen based upon various keyboard keys is fairly easy.

First seastead company actually selling sea homes: Ocean Builders https://ocean.builders  Of course we accept bitcoin.
Lethn (OP)
Legendary
*
Offline Offline

Activity: 1540
Merit: 1000



View Profile WWW
May 15, 2013, 09:21:56 AM
 #11

I dunno about that, I don't think I want to use anything particularly pre-made I think the only thing I've done that's pre-made so far is use the Codeblocks OpenGL sample to get all the window setup that I need because the tutorials I've looked at are outdated with some of the stuff they have. I did notice some VK commands for all the keyboard stuff in the compiler so I'll have to have a look at the syntax involved with that so I can make stuff move.

Edit: AHA! Nehe seems to be very good with this stuff and it's just what I need, IF commands ftw! Cheesy
Lethn (OP)
Legendary
*
Offline Offline

Activity: 1540
Merit: 1000



View Profile WWW
May 15, 2013, 09:40:05 PM
Last edit: May 15, 2013, 09:55:58 PM by Lethn
 #12

Hmm, does anyone know of any good examples or tutorials for Codeblocks that show you how to code interaction with the shapes you make?

I may have just found what I needed Cheesy just needed to look for a bit longer.

http://www.codeproject.com/Articles/27219/TetroGL-An-OpenGL-Game-Tutorial-in-C-for-Win32-Pla
Welsh
Staff
Legendary
*
Offline Offline

Activity: 3276
Merit: 4111


View Profile
May 15, 2013, 09:56:41 PM
 #13

It would be really great if this got added as a sub-forum. I know it can be related to services etc.
But, this just seems like a great way to break it up from the other things located in other sections, however I don't have anything to add at this moment as i'm mainly a python programmer, and learning java now.
Lethn (OP)
Legendary
*
Offline Offline

Activity: 1540
Merit: 1000



View Profile WWW
May 15, 2013, 09:58:48 PM
 #14

Lets spam code all over this thread so the mods know there's demand for a category lolollool Cheesy
Illimensky
Newbie
*
Offline Offline

Activity: 56
Merit: 0



View Profile
May 15, 2013, 10:53:29 PM
 #15

Nobody here's programming in LOLcode?  Seriously?  You should all try it.

Wikipedia: http://en.wikipedia.org/wiki/LOLCODE

The Hello World program:

HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE


As you can see, its insane efficiency at any task combined with its extreme brevity makes it a must for any real coding project.
Lethn (OP)
Legendary
*
Offline Offline

Activity: 1540
Merit: 1000



View Profile WWW
May 16, 2013, 03:24:46 PM
 #16

Bah, does anyone know some good tutorials that show you how to combine OpenGL and C++ while I'm searching for them myself? The OpenGL tutorials are great and I have an easy time drawing basic stuff on it now but I need to look up how to properly combine everything so I can interact with the shapes I make Cheesy
Lethn (OP)
Legendary
*
Offline Offline

Activity: 1540
Merit: 1000



View Profile WWW
May 16, 2013, 03:34:08 PM
 #17

Can't believe I forgot about this tutorial.

http://www.cprogramming.com/tutorial/opengl_first_opengl_program.html
Lethn (OP)
Legendary
*
Offline Offline

Activity: 1540
Merit: 1000



View Profile WWW
May 17, 2013, 01:48:06 AM
 #18

Quote
           
            glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
            glClear (GL_COLOR_BUFFER_BIT);

            glPushMatrix ();
            glTranslatef (-0.2f, 0.0f, 0.0f);
            glRotatef(theta, 0.0f, 1.0f, 0.0f);
            glBegin (GL_QUADS);
  
                              
                              glVertex3f (0.0f, -0.1f, 0.0f);
                              glVertex3f (-0.1f, 0.0f, 0.0f);
                              glVertex3f (0.0f, 0.1f, 0.0f);
                              glVertex3f (0.1f, 0.0f, 0.0f);
            glEnd ();
            glPopMatrix ();
            
            glPushMatrix ();
            glTranslatef (0.1f, 0.0f, 0.0f);
            glRotatef(theta, 0.0f, 1.0f, 0.0f);
            
            glBegin (GL_QUADS);

                              
                              glVertex3f (0.0f, -0.1f, 0.0f);
                              glVertex3f (-0.1f, 0.0f, 0.0f);
                              glVertex3f (0.0f, 0.1f, 0.0f);
                              glVertex3f (0.1f, 0.0f, 0.0f);
                              
            glEnd ();
            glPopMatrix ();

            SwapBuffers (hDC);

            theta += 1.0f;
            Sleep (1);
        }
    }


Must make it so I can click and drag these spinning squares Cheesy
Lethn (OP)
Legendary
*
Offline Offline

Activity: 1540
Merit: 1000



View Profile WWW
May 17, 2013, 05:00:39 PM
 #19

Does anyone know of any up to date syntax for GLFW keyboard and mouse input? Or would you recommend something else? I'm searching around but I think I could use some help on this one.
Welsh
Staff
Legendary
*
Offline Offline

Activity: 3276
Merit: 4111


View Profile
May 17, 2013, 05:50:09 PM
 #20

print("We want a sub-forum")
user_input = input("What do you say staff?")
Pages: [1] 2 3 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!