• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Rimher

Members
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

132 Neutral

About Rimher

  • Rank
    Newbie
  1. I was getting started with a project with Libgdx and my idea was to make a procedural game, but I've never approached this topic. I'm very curious and eager to learn, do you guys have any idea where I could start?
  2. [quote name='RulerOfNothing' timestamp='1349258291' post='4986331'] The problem appears to be a mismatch between the format of the bitmap and the format passed to glTexImage2D, although I note that my copy of the OpenGL Programmer's Reference says that GL_BGR_EXT is not a valid value for the second format parameter of glTexImage2D (I think you want GL_BGR instead of GL_BGR_EXT. [/quote]Thanks for the fast reply! I tried changing those, but the result sadly is the same
  3. On my quest to keep learning OpenGL, I've gone as far as [url="http://nehe.gamedev.net/tutorial/texture_filters,_lighting_&_keyboard_control/15002/"]Nehe's Lesson 7[/url] with loading a Crate texture. But now I'm stuck. Since I'm on a Mac, I've had to write my own function to load a BMP file, and following [url="http://www.gamedeception.net/archive/index.php?t-5425.html"]this[/url] advice, I had my function ready and working, at least in tutorial 6. For #7, I've added my own class, that's just a wrapper that contains the information needed for data, width and height, and it's called BMPData.cpp. Anyway, the problem is that the texture, in the end, appears like [url="http://imgur.com/z8NEs"]this[/url]. Here's my code, I've tried doing anything with it, but have come up with not solution in the past two days, any help is really appriciated [img]http://public.gamedev.net//public/style_emoticons/default/happy.png[/img] [source lang="cpp"]#include <SFML/Graphics.hpp> #include <SFML/Audio.hpp> #include <SFML/Network.hpp> #include <SFML/Window.hpp> #include <SFML/OpenGL.hpp> #include <glm-0.9.3.4/glm/glm.hpp> #include <fstream.h> #include "ResourcePath.hpp" // Include standard headers #include <stdio.h> #include <stdlib.h> #include <string.h> #include "BMPData.h" using namespace glm; GLfloat rtri, rquad; GLfloat xrot, yrot, zrot, xspeed, yspeed, z = -5.0f; std::string dataPath = "/Users/umbertosonnino/Documents/XCode/tobedeleted/tobedeleted/data/"; bool lp, fp, light; GLfloat LightAmbient[] = { 0.5f, 0.5f, 0.5f, 1.0f }; GLfloat LightDiffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f }; GLfloat LightPosition[] = { 0, 0, 2.0f, 1.0f, 1.0f }; GLuint filter = 0, texture[3]; BMPData *image; BMPData *loadBMP(std::string filename){ FILE* file = NULL; if(!filename.c_str()){ fprintf(stderr, "File name has not been handed to the program\n"); return NULL; } file = fopen(filename.c_str(), "rb"); if(file == NULL){ fprintf(stderr, "Error opening the file %s\n", filename.c_str()); return NULL; } unsigned long width = 0; unsigned long height = 0; unsigned long size = 0; fseek(file, 18, SEEK_SET); fread(&width, 4, 1, file); fread(&height, 4, 1, file); fseek(file, 0, SEEK_END); size = ftell(file) - 54; unsigned char* data = (unsigned char*) malloc(size); fseek(file, 54, SEEK_SET); fread(data, size, 1, file); image = new BMPData(data, width, height); fclose(file); return image; } unsigned int loadGLTextures(){ int status = false; BMPData *bmp; if( (bmp = loadBMP(dataPath+"Crate.bmp")) ){ status = true; glGenTextures(3, &texture[0]); glBindTexture(GL_TEXTURE_2D, texture[0]); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, (GLsizei)bmp->getWidth(), (GLsizei)bmp->getHeight(), 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, bmp->getData()); glBindTexture(GL_TEXTURE_2D, texture[1]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, 3, (GLsizei)bmp->getWidth(), (GLsizei)bmp->getHeight(), 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, bmp->getData()); // Create MipMapped Texture glBindTexture(GL_TEXTURE_2D, texture[2]); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, (GLsizei)bmp->getWidth(), (GLsizei)bmp->getHeight(), GL_BGR_EXT, GL_UNSIGNED_BYTE, bmp->getData()); } if(bmp){ if(bmp->getData()){ bmp->~BMPData(); } free(bmp); } return status; } int draw(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glLoadIdentity(); // Reset The View glTranslatef(0.0f,0.0f,z); glRotatef(xrot,1.0f,0.0f,0.0f); glRotatef(yrot,0.0f,1.0f,0.0f); glBindTexture(GL_TEXTURE_2D, texture[filter]); glBegin(GL_QUADS); // Front Face glNormal3f( 0.0f, 0.0f, 1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Back Face glNormal3f( 0.0f, 0.0f,-1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); // Top Face glNormal3f( 0.0f, 1.0f, 0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); // Bottom Face glNormal3f( 0.0f,-1.0f, 0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Right face glNormal3f( 1.0f, 0.0f, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Left Face glNormal3f(-1.0f, 0.0f, 0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glEnd(); xrot+=xspeed; yrot+=yspeed; return true; } int initGL(){ //resizeGL function in Nehe glViewport(0, 0, 800, 600); glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix // Calculate The Aspect Ratio Of The Window gluPerspective(45.0f,(GLfloat)800/(GLfloat)600,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix //end of resize function if(!loadGLTextures()){ fprintf(stderr, "Error loading the bmp during initialization\n"); return false; } glEnable(GL_TEXTURE_2D); glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.3f, 0.5f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); glLightfv(GL_LIGHT1, GL_POSITION, LightPosition); glEnable(GL_LIGHT1); return true; } int main (int argc, const char * argv[]) { sf::Window window(sf::VideoMode(800, 600), "Nehe Lighting and Keyboard Tutotorial: Embracing OpenGL"); initGL(); do { // Process events sf::Event event; while (window.pollEvent(event)) { if(event.type == sf::Event::Resized){ glViewport(0, 0, event.size.width, event.size.height); } // Close window : exit if (event.type == sf::Event::Closed) window.close(); // Escape pressed : exit if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) window.close(); if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::L && !lp){ lp = true; light = !light; if(!light){ glDisable(GL_LIGHTING); } if(light){ glEnable(GL_LIGHTING); } } if(event.type == sf::Event::KeyReleased && event.key.code == sf::Keyboard::L){ lp = false; } if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::F && !fp){ fp = true; filter += 1; if(filter >2) filter = 0; } if(event.type == sf::Event::KeyReleased && event.key.code == sf::Keyboard::F){ fp = false; } //When pressing up i'm moving the cube farther into distance if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::U) z += 0.2f; //When pressing down on the keyboard i'm moving the cuve closer to the screen if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard:[img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]) z-= 0.2f; if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Up) xspeed -= 0.1f; if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Down) xspeed += 0.1f; if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Left) yspeed -= 0.1f; if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Right) yspeed += 0.1f; } draw(); // Update the window window.display(); }while(window.isOpen()); return EXIT_SUCCESS; } [/source]
  4. [quote name='RulerOfNothing' timestamp='1348928437' post='4985059'] The tutorial in question has these lines of code:[CODE] glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix // Calculate The Aspect Ratio Of The Window gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix [/CODE] in its window resizing code after the call to glViewport which are missing from your code. Maybe this is causing the problem? [/quote]Such a rookie mistake! Thanks a lot, I had a different perspective in my inizialization!
  5. Hello there! I've just recently started learning OpenGL, and I'm trying to use SFML as a working environment. But I'm having my first problems. I'm following Nehe's tutorial on how to get started in OpenGL, and I was trying to draw some simple shapes. The problem is, they do not appear on the screen! I clearly remember doing this on Windows at the time, but since I switched to Mac, everything seems much harder. Anyway, here's the code...if anyone can help me, it'd be really appreciated. [source lang="cpp"]#include <SFML/Graphics.hpp> #include <SFML/Audio.hpp> #include <SFML/Network.hpp> #include <SFML/Window.hpp> #include <SFML/OpenGL.hpp> #include "ResourcePath.hpp" // Include standard headers #include <stdio.h> #include <stdlib.h> using namespace glm; GLfloat rtri, rquad; GLfloat xrot, yrot, zrot; int draw(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(-1.5f, 0.0f, -6.0f); glRotatef(rtri, 0.0f, 1.0f, 0.0f); glBegin(GL_TRIANGLES); glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Front) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f(-1.0f,-1.0f, 1.0f); // Left Of Triangle (Front) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f( 1.0f,-1.0f, 1.0f); // Right Of Triangle (Front) glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Right) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f( 1.0f,-1.0f, 1.0f); // Left Of Triangle (Right) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f( 1.0f,-1.0f, -1.0f); // Right Of Triangle (Right) glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Back) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f( 1.0f,-1.0f, -1.0f); // Left Of Triangle (Back) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f(-1.0f,-1.0f, -1.0f); // Right Of Triangle (Back) glColor3f(1.0f,0.0f,0.0f); // Red glVertex3f( 0.0f, 1.0f, 0.0f); // Top Of Triangle (Left) glColor3f(0.0f,0.0f,1.0f); // Blue glVertex3f(-1.0f,-1.0f,-1.0f); // Left Of Triangle (Left) glColor3f(0.0f,1.0f,0.0f); // Green glVertex3f(-1.0f,-1.0f, 1.0f); // Right Of Triangle (Left) glEnd(); glLoadIdentity(); glTranslatef(1.5f,0.0f,-7.0f); // Move Right And Into The Screen glRotatef(rquad,1.0f,1.0f,1.0f); // Rotate The Cube On X, Y & Z glBegin(GL_QUADS); glColor3f(0.0f,1.0f,0.0f); // Set The Color To Green glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Top) glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Top) glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Quad (Top) glVertex3f( 1.0f, 1.0f, 1.0f); // Bottom Right Of The Quad (Top) glColor3f(1.0f,0.5f,0.0f); // Set The Color To Orange glVertex3f( 1.0f,-1.0f, 1.0f); // Top Right Of The Quad (Bottom) glVertex3f(-1.0f,-1.0f, 1.0f); // Top Left Of The Quad (Bottom) glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Bottom) glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Bottom) glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Front) glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Front) glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Front) glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Front) glColor3f(1.0f,1.0f,0.0f); // Set The Color To Yellow glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Back) glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Back) glVertex3f(-1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Back) glVertex3f( 1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Back) glColor3f(0.0f,0.0f,1.0f); // Set The Color To Blue glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Quad (Left) glVertex3f(-1.0f, 1.0f,-1.0f); // Top Left Of The Quad (Left) glVertex3f(-1.0f,-1.0f,-1.0f); // Bottom Left Of The Quad (Left) glVertex3f(-1.0f,-1.0f, 1.0f); // Bottom Right Of The Quad (Left) glColor3f(1.0f,0.0f,1.0f); // Set The Color To Violet glVertex3f( 1.0f, 1.0f,-1.0f); // Top Right Of The Quad (Right) glVertex3f( 1.0f, 1.0f, 1.0f); // Top Left Of The Quad (Right) glVertex3f( 1.0f,-1.0f, 1.0f); // Bottom Left Of The Quad (Right) glVertex3f( 1.0f,-1.0f,-1.0f); // Bottom Right Of The Quad (Right) glEnd(); // Done Drawing The Quad rtri+=0.2f; // Increase The Rotation Variable For The Triangle rquad-=0.15f; // Decrease The Rotation Variable For The Quad return true; } int initGL(){ glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.3f, 0.0f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); return true; } int main (int argc, const char * argv[]) { sf::Window window(sf::VideoMode(800, 600), "OpenGL window"); initGL(); do { // Process events sf::Event event; while (window.pollEvent(event)) { if(event.type == sf::Event::Resized){ glViewport(0, 0, event.size.width, event.size.height); } // Close window : exit if (event.type == sf::Event::Closed) window.close(); // Escape pressed : exit if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) window.close(); } draw(); // Update the window window.display(); }while(window.isOpen()); return EXIT_SUCCESS; } [/source]
  6. [quote name='thok' timestamp='1347377489' post='4978922'] I just started playing with OpenGL, with Java + lwjgl. So, even though I'm developing on OSX as well, there's nothing platform specific here. So that's the extent of my OpenGL experience. Using a search engine I found this: [url="http://developer.apple.com/library/mac/#documentation/graphicsimaging/conceptual/opengl-macprogguide/opengl_intro/opengl_intro.html#//apple_ref/doc/uid/TP40001987-CH207-TP9"]http://developer.app...01987-CH207-TP9[/url] I skimmed through this a bit and it looks promising. Just look at the table of contents and see what looks useful to you. There seem to be plenty of code samples. I'm assuming you're using Xcode, so getting your environment set up will be the only major challenge. developer.apple.com should have the info you need to get this set up. Keep in mind, OpenGL itself is not platform specific. So, once you have a library which implements the OpenGL API, the API calls are pretty much the same, no matter what is language or platform. For example, this objective-c code is almost identical to what I would do in Java (using lwjgl) to draw a triangle: [CODE] static void drawAnObject () { glColor3f(1.0f, 0.85f, 0.35f); glBegin(GL_TRIANGLES); { glVertex3f( 0.0, 0.6, 0.0); glVertex3f( -0.2, -0.3, 0.0); glVertex3f( 0.2, -0.3 ,0.0); } glEnd(); } [/CODE] Again, once have a proper lib set up for your language/platform, you then just need to learn the OpenGL API. The wikipedia article about OpenGL has a lot of good info, including history, concepts, and features: [url="http://en.wikipedia.org/wiki/OpenGL"]http://en.wikipedia.org/wiki/OpenGL[/url] Hope that helps. [/quote]Thanks a lot, sometimes too much information is not information at all. I'll start with wikipedia, and I'll try and see what the apple developers have in store! ;)
  7. Hello there, I'm new over here, but I'm not exactly new to programming; I've studied Java, C, a bit of C++, and, since I got a Mac recently, I was trying to build my own knowledge of Obj-C. Recently I was trying to learn a little bit of OpenGL, but almost everything that I've found online is windows-related. Can you guys help me find something suitable for OSX as well?? Thanks in advance