• 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.

jza

Members
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

104 Neutral

About jza

  • Rank
    Newbie
  1. Hi!   As SDL 2.0 just came out, I was trying to create some code which would enable a modern OpenGL context along SDL. However I can get only the background color (glClearColor) to work. Interestingly, I can draw legacy OpenGL to on the same context and it appears fine.   So below is the code. It combines the OpenGL 2.1 port of the tutorials at opengl-tutorial org and, an OpenGL SDL example at opengl.org (linked at libsdl.org): http://www.opengl.org/wiki/Tutorial1:_Creating_a_Cross_Platform_OpenGL_3.2_Context_in_SDL_(C_/_SDL)   It's a bit hacky and I omitted some parts but can include them if necessary. Yes, the shader code files are in the correct directory. Can you see anything obviously wrong with the stuff below? int main(int argc, char** argv) { SDL_Window *MainWindow; SDL_GLContext MainContext; if (SDL_Init(SDL_INIT_VIDEO) < 0) { ShowErrorAndDie("Unable to initialize SDL"); } SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); // 24bit double buffer SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); MainWindow = SDL_CreateWindow(PROGRAM_NAME, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0, SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_HIDDEN); if (!MainWindow) { ShowErrorAndDie("Unable to create window."); } // Attach the OpenGL context to our window MainContext = SDL_GL_CreateContext(MainWindow); CheckSDLErrorAndDie("Unable to initialize OpenGL.\nPlease make sure that your OpenGL driver supports at least version 2.1."); SDL_ShowWindow(MainWindow); // Enable vsync SDL_GL_SetSwapInterval(1); if (GLEW_OK != glewInit()) { ShowErrorAndDie("The GLEW subsystem failed to initialize."); SDL_Quit(); exit(1); } // Dark blue background glClearColor(0.0f, 0.0f, 0.4f, 0.0f); // Create and compile our GLSL program from the shaders GLuint programID = LoadShaders( "SimpleVertexShader.vertexshader", "SimpleFragmentShader.fragmentshader" ); // Get a handle for our buffers GLuint vertexPosition_modelspaceID = glGetAttribLocation(programID, "vertexPosition_modelspace"); static const GLfloat g_vertex_buffer_data[] = { -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, }; GLuint vertexbuffer; glGenBuffers(1, &vertexbuffer); glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer); glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW); while (1){ // Clear the screen glClear( GL_COLOR_BUFFER_BIT ); // Use our shader glUseProgram(programID); // 1rst attribute buffer : vertices glEnableVertexAttribArray(vertexPosition_modelspaceID); glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer); glVertexAttribPointer( vertexPosition_modelspaceID, // The attribute we want to configure 3, // size GL_FLOAT, // type GL_FALSE, // normalized? 0, // stride (void*)0 // array buffer offset ); // Draw the triangle ! glDrawArrays(GL_TRIANGLES, 0, 3); // 3 indices starting at 0 -> 1 triangle glDisableVertexAttribArray(vertexPosition_modelspaceID); // Swap buffers SDL_GL_SwapWindow(MainWindow); while (SDL_PollEvent(&InputEvent)) { if (InputEvent.type == SDL_KEYDOWN) { if (InputEvent.key.keysym.sym == SDLK_ESCAPE) { goto ExitLoop; } } } } ExitLoop: glDeleteBuffers(1, &vertexbuffer); SDL_GL_DeleteContext(MainContext); SDL_DestroyWindow(MainWindow); SDL_Quit(); }