Dries Lamberechts

  • Content count

  • Joined

  • Last visited

Community Reputation

184 Neutral

About Dries Lamberechts

  • Rank
  1. OpenGL Rendering multiple 2D objects

    Ah great! I think I got it now (how to render those objects). I can see both textures now and it looks like I want it to. Thank you very much :)
  2. OpenGL Rendering multiple 2D objects

    Ah damn. Stupid mistake. Now I can indeed see the two object but they both seem to be using the same texture although I choose another one in the initialization.
  3. I'm trying to render multiple objects in my OpenGL based scene. I got one working with the following code: This first piece of code is in the Initialize part of the object so it's only run once. // Create Vertex Array Object glGenVertexArrays(1, &vao); glBindVertexArray(vao); glGenBuffers(1, &vbo); // Generate 1 buffer glBindBuffer(GL_ARRAY_BUFFER, vbo); // Set vbo as active glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); // load vertex data to vbo GLuint ebo; glGenBuffers(1, &ebo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elements), elements, GL_STATIC_DRAW); m_Program.CompileShaders("Assets/Shaders/Colorshading.vert", "Assets/Shaders/ColorShading.frag"); m_Program.LinkShaders(); glUseProgram(m_Program.GetID()); glBindFragDataLocation(m_Program.GetID(), 0, "outColor"); GLint posAttrib = glGetAttribLocation(m_Program.GetID(), "position"); glEnableVertexAttribArray(posAttrib); glVertexAttribPointer(posAttrib, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), 0); GLint colAttrib = glGetAttribLocation(m_Program.GetID(), "color"); glEnableVertexAttribArray(colAttrib); glVertexAttribPointer(colAttrib, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float))); GLint texAttrib = glGetAttribLocation(m_Program.GetID(), "texcoord"); glEnableVertexAttribArray(texAttrib); glVertexAttribPointer(texAttrib, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float))); GLuint tex; glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); int width, height; unsigned char* image = SOIL_load_image("Sample.png", &width, &height, 0, SOIL_LOAD_RGB); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image); SOIL_free_image_data(image); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); After that, this is in the Draw method of the object which is run every tick: // Render a test background glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); // Bind the VAO glBindVertexArray(vao); //glUseProgram(m_Program.GetID()); // Draw the triangle ! glBindBuffer(GL_ARRAY_BUFFER, vbo); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); // Starting from vertex 0; 3 vertices total -> 1 triangle // CLear VAO binding glBindVertexArray(0); Now, I've done this in a second object, which is also drawn second because of the way the engine works and if I start the game I can only see the second object. I have no idea what I'm doing wrong. Am I binding the vbo for the object wrong? Am I doing something wrong in the drawing?   Also, a question paired to this one, how would I be able to change the layering of the seperate objects? Can I just change the z-value? That is what I have now but of course I can't see it.
  4. So, where do I start?

    Start learning a programming language (C++, java,...). Once you know one of those quite well you can start creating 2D games with a game engine that uses your programming language. Say you're doing C++ you could make 2D games with SFML for example. After you've mastered creating 2D games (try out multiple frameworks by the way) you can try making 3D games with, for example, Unity. Unity is to my knowledge the most accesible game dev software.
  5. sucking potata

    I have been searching for some information as well. One thing you should definitely do is follow the instructions on the MSDN website on Winsock: LINK   Also, take a look at Beej's Networking Guide (or something similar). He gives a very nice explanation of every step in the Winsock setup. (Information on every function and what not).   I also made a blog post about networking if you wish to read it: BLOG   Regards, Frostraver
  6. Problem receiving packets

    I'll check how I should send the data properly.  I'm currently sending this (const char*)message. Where message starts as a void*.  When I cout this data it outputs the text so I don't think that's the problem? And I'm running a 64-bit windows 7. But this is just my Visual Studio setup that's 32-bit or not?   errno outputs "No Error". I use printf(strerror(errno)) to show to error on my screen.   handle is the same if both cases yes. I don't think this could be a problem?
  7. Problem receiving packets

    Hi guys. Thanks for the quick replies.   @RadioTeeth: Why should I do the destination_address differently?   @hplus0603: Yes, handle is a valid socket and it's bound to the right ports and everything. sendto() returns 4 recvfrom() returns -1 in the current state but I'll be changing things now so I'll keep you updated what they return if you want.   EDIT: So I changed some things like Radioteeth suggested but that doesn't seem to change anything. I have this code to test out if my program receives it's own messages: pNetworkObject->ReceivePacket(); pNetworkObject->SendPacket("hello"); pNetworkObject->SendPacket("second hello"); pNetworkObject->ReceivePacket();
  8. Art and Programmers

    First of all, with a month of work you won't be able to learn much. It takes a lot of time and effort to make decent art in 2D as well as in 3D.   That aside, I recommend doing 2D work first. One of the easiest things you can start with if you want to start creating games is sprites. Do your animations in 2D. Make everything in 2D. Learn how to use layers and how to animate something in 3D. Say you want to desperately make a game in 3D you could always make some small low poly objects in 3Ds Max but ZBrush would be overkill in that situation. If you use ZBrush you're going to need to know how to make Normal Maps, how to get your ZBrush mesh from high poly to low poly that can be used in a game and so on.   So, I'd recommend 2D if you're starting off right now. In a month you could definitely learn how to make some nice 2D sprites and how to do for example simple pixelated objects.   Some resources: - Sprites: link - Pixelart: link 
  9. How to implement a Component-Based Entity system?

    Maybe this isn't a good explanation for your problem but have you taken a look at Unity (the game engine)? They use component-based entities as well.   As for the programming part, there possibly are some engines that use this method that are open-source.   What would do is create a base class called, for example, BaseComponent and then create a lot of components that you want to use that use BaseComponent as their parent class. Then you'll need some kind of base class that resembles the basic of an Object to which you want to add components, just like in Unity. Let's call it GameObject.   Now you can create seperate objects that all use GameObject as their parent class. In this class you'll have an array of components. So, you can create a new component and afterwards add it to the array of components of a specific GameObject.   Say you added a component that holds the transformations of an object. You could, for example, scale the object by doing the following:  gameObject->GetComponent<TransformComponent>()->Scale(5.0f); That would scale the gameObject 5 times it's normal size.   That's basically how it works.
  10. like-minded ..

    What are you exactly looking to do?   Do you have any experience regarding anything that might have to do with game development? You should definitely say something about yourself when looking for other people to help you. People who read this need to learn what you want to do, what are your plans, what kind of people are you looking for.   Are you a programmer? So, maybe are you looking for artists? Or is it the other way around? There is no way I can say that.   Explain yourself a bit and maybe other people will start mailing you or reply to this thread. Tell them what you're aiming for. What kind of game do you want to make? What platform are you aiming for?   I'm working for Eminus Studios now. Tamby Kojak, the project manager/programmer of our company wrote this when he was looking for other people: Click Here That's something you need to do as well.   I wish you good luck!
  11. Problem receiving packets

    Hi everyone,   I'm trying to get my client to send a packet with some text and my server to receive the packet and display the text. Currently I'm trying this locally so what I'm doing now is the following.   1) I send some text using sendto() 2) I try to receive the data using recvfrom()   The problem is that the recvfrom data doesn't seem to receive a packet. The two methods that I'm using are coded like this:   Used in step 1: bool Networking::SendPacket(const void * message) { // Set up address to send the packet to unsigned int a = 127; unsigned int b = 0; unsigned int c = 0; unsigned int d = 1; unsigned short port = 2890; unsigned int destination_address = ( a << 24 ) | ( b << 16 ) | ( c << 8 ) | d; unsigned short destination_port = port; address.sin_family = AF_INET; address.sin_addr.s_addr = htonl( destination_address ); address.sin_port = htons(destination_port); // Try to send the packet int sent_bytes = sendto(handle, (const char*)message, sizeof(message), 0, (sockaddr*)&address, sizeof(sockaddr_in)); // Check if the packet was sent successfully if (sent_bytes != sizeof(message)) { printf("failed to send packet: return value = %d\n", sent_bytes); return false; } else { cout << "this packet was successfully sent: " << (const char*)message << "\n"; return true; } return true; } Used in step 2: void Networking::ReceivePacket() { unsigned char packet_data[256]; #if PLATFORM == PLATFORM_WINDOWS typedef int socklen_t; #endif sockaddr_in from; socklen_t fromLength = sizeof( from ); int received_bytes = recvfrom(handle, (char*)packet_data, sizeof(packet_data), 0, (sockaddr*)&from, &fromLength ); if (received_bytes <= 0) return; cout << "RECEIVED DATA: " << (char*)packet_data << "\n"; } Does anyone see what I'm doing wrong?   Thanks in advance
  12. DirectX Tutorials

    You should start by installing the DirectX SDK on your computer. When you've done that go to Start -> All Programs -> Microsoft DirectX SDK (June 2010) -> DirectX Documentation for C++ Open that file and then go to Samples And Tutorials. There you'll find everything you need to get started Grtz and have fun!