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

PascalGrosset

Members
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

100 Neutral

About PascalGrosset

  • Rank
    Newbie
  1. So why did I choose this again?
  2. Compilers are cool. Pity I only had limited exposure to them :(
  3. Finally equipment ready for hiking.
  4. What happens when you teach a practical session of a database class in a lab but r too pathetic to make the db server work? Ans: You change the practical session to a "write in your copybook session". It's still practical, for you ;) Tales from a land far far away ... from me :). Solid Gold!!!
  5. Program writing methodology for research: 1. Guess/Write a piece of code (it will be lousy and buggy: don't fight it) 2. Spend hours/days thinking why the hell it's not working! 3. Hypothesize until a plausible enough reason. 4. Think of decent enough bug fix (why not find a perfect one? R u kidding me???) 5. Implement that fix (and hope for the best) 6. Is it working? 7. Yes: Really, are u sure??? 8. No: Do in that order: 9. Fix the BUG Fix appling process from step 2 on the Fix...
  6. Thanks for the replies [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] I am currently working in the eye space. In this space, the camera is at (0,0,0) and we are looking towards the negative z. The only thing that seems to be giving me something which looks correct is: // in the vertex shader eyeVec = vec3(gl_ModelViewMatrix * gl_Vertex); // in the fragment shader depth = -1.0/((eyeVec.z-gl_DepthRange.near)/(gl_DepthRange.far-gl_DepthRange.near)); or depth = -1.0/eyeVec.z; I am not satisfied with the range of z that I am getting though [sharedmedia=core:attachments:7424] though it looks reasonable correct. This is my perspective projection setup: gluPerspective(45, (width/height), 1, 10.0); and I do several other translations and rotations too. My question is: how do I get the value of my near plane and far plane in the fragment shader while working in eyespace. Is gl_DepthRange.near correct ? OpenGL version used: OpenGL Version: 4.2.0 NVIDIA 290.10 OpenGL Shading Language Version: 4.20 NVIDIA via Cg compiler
  7. Plans for this summer are suddenly looking very good :)
  8. Hello I'm looking for a way to get the correct depth value in GLSL. I am rendering a cube and I am stepping inside that cube (it's a volume rendering application). In the picture below [sharedmedia=core:attachments:7420] The blue dots should have a deeper z value than the red one. However, when I am displaying the value of z as a color, I am getting the same color at the blue (on the outside) as the red dot which is in front (meaning I am getting the same depth). I am trying with gl_FragCoord.z (and tried several others too). Does anyone have a suggestion what I could use. Thanks
  9. Hello I'm looking for a way to get the correct depth value in GLSL. I am rendering a cube and I am stepping inside that cube (it's a volume rendering application). In the picture below [sharedmedia=core:attachments:7420] The blue dots should have a deeper z value than the red one. However, when I am displaying the value of z as a color, I am getting the same color at the blue (on the outside) as the red dot which is in front (meaning I am getting the same depth). I am trying with gl_FragCoord.z (and tried several others too). Does anyone have a suggestion what I could use. Thanks
  10. OpenGL

    [quote name='Katie' timestamp='1312307189' post='4843675'] "GL_ONE_MINUS_DST_ALPHA" Is it perhaps because you have not requested an alpha buffer? And on Mac you get one by default but on Linux you don't? [/quote] It seems so. The glGetIntegerv(GL_ALPHA_BITS, alphabits); was returning 0!!!
  11. Hello I'm implementing a front to back slice volume rendering and I am having issues with blending. Basically I should be using glBlendFunc(GL_ONE_MINUS_DST_ALPHA,GL_ONE); but it does not work while on Linux using glBlendFunc(GL_ONE_MINUS_SRC_ALPHA,GL_ONE); works!!! I'm also testing on macbook and glBlendFunc(GL_ONE_MINUS_DST_ALPHA,GL_ONE); works there (as it should). Also with only glBlendFunc(GL_ONE_MINUS_SRC_ALPHA,GL_ONE); I am having issue when the background is white!!! Would anybody know why this could be??? Versions of OpenGL Macbook: Opengl 2.1 Linux: Opengl 4.1 Thanks Pascal
  12. OpenGL

    Got the answer!. There was a typo in my code glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, tex_id[readTex]); glUniform1iARB(buf_Out, 0); glActiveTexture(GL_TEXTURE2); should have been glActiveTexture(GL_TEXTURE0);
  13. Hello I'm doing some ping ponging stuff and I am experiencing some weird behaviour with my code. I have 2 shaders which alter the texture and a third one which just displays stuff. I have a certain number of passes in my program which i can increase and decrease (to make sure that the ping-ponging work). According to my logic, if the number of passes is 0, the color displayed should be black, for 1 pass it should be black, for 2 passes red, for 3 passes yellow, 4 passes orange, ... However, for 2 passes I'm already getting yellow. Any help would be very greatly appreciated. Been stuck with that for some time!!! Thanks The important part of the code is below: [quote]//some global variables unsigned char textureArray[4*512*512]; int numberIterations = 0; GLuint tex_id[2]; GLenum attachmentpoints[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT}; int writeTex = 0; int readTex = 1; GLuint frameBuffer; int textureDim = 512; string shaderPath = "/Users/pascalgrosset/Utah/Research/myVolRender/pingponging/pingponging/"; bool panSc, zoomSc, rotateSc; float eye[3], lookat[3]; GLint buf_1, buf_2, buf_Out; GLhandleARB glsl_program1, vertex_shader_1, fragment_shader_1; GLhandleARB glsl_program2, vertex_shader_2, fragment_shader_2; GLhandleARB glsl_programOut, vertex_shader_Out, fragment_shader_Out; // main int main(int argc, char* argv[]) { glutInit(&argc, argv); if (argc > 1) numberIterations = atoi(argv[1]); glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowPosition( 50, 50); glutInitWindowSize( windowWidth, windowHeight); //createGlutMenu(); main_window = glutCreateWindow( "Computer Graphics" ); myInitDisplay(windowWidth, windowHeight); eye[0] = 0.0; eye[1] = 0.0; eye[2] = 2.0; lookat[0] = 0.0; lookat[1] = 0.0; lookat[2] = 0.0; panSc = zoomSc = rotateSc = false; createShaders(glsl_program1, vertex_shader_1, fragment_shader_1, (shaderPath + string("Shaders/shader.vert")).c_str(), (shaderPath + string("Shaders/fragShader1.frag")).c_str()); createShaders(glsl_program2, vertex_shader_2, fragment_shader_2, (shaderPath + string("Shaders/shader.vert")).c_str(), (shaderPath + string("Shaders/fragShader2.frag")).c_str()); createShaders(glsl_programOut, vertex_shader_Out, fragment_shader_Out, (shaderPath + string("Shaders/shader.vert")).c_str(), (shaderPath + string("Shaders/fragShaderOut.frag")).c_str()); initGL(); // Register some callbacks - basically what function is to be associated to what event glutDisplayFunc( myDisplay ); glutReshapeFunc( myReshape ); glutIdleFunc( myGlutIdle ); glutKeyboardFunc( myKeyboard ); glutMotionFunc( myMotion ); glutMouseFunc( myMouse ); glutMainLoop(); glDeleteFramebuffersEXT(1, &frameBuffer); return 0; } void myInitDisplay( int width, int height ) { glClearColor( 0.0f, 0.0f, 0.0f, 0.0f); // This Will Clear The Background and set its Color To Black - 4 params coz of RGBA glDepthFunc( GL_LESS ); // The Type Of Depth Test To Do glEnable( GL_DEPTH_TEST ); // Enables Depth Testing glShadeModel( GL_SMOOTH ); // Enables Smooth Color Shading - GL_SMOOTH or GL_FLAT glutSetMenu( mainMenuId ); // We have a menu glutAttachMenu( GLUT_RIGHT_BUTTON ); // Attach the menu to the right mouse button return; } void initGL(){ glEnable(GL_TEXTURE_2D); for (int i=0; i<(textureDim*textureDim); i++) textureArray[i*4 +0] = textureArray[i*4 +1] = textureArray[i*4 +2] = textureArray[i*4 +3] = 0; glGenTextures(2, tex_id); for (int i=0; i<2; i++){ glBindTexture(GL_TEXTURE_2D, tex_id[i]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); //NULL means reserve texture memory, but texels are undefined glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, textureDim, textureDim, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureArray); } glGenFramebuffersEXT(1, &frameBuffer); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBuffer); // attach two textures to FBO glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachmentpoints[writeTex], GL_TEXTURE_2D, tex_id[writeTex], 0); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachmentpoints[readTex], GL_TEXTURE_2D, tex_id[readTex], 0); GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status == GL_FRAMEBUFFER_COMPLETE_EXT){ // cout << "All Good!!!" << endl; } else{ cout << "Error: Binding framebuffer failed" << endl; exit(0); } glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); initUniformVarsShading1(); initUniformVarsShading2(); initUniformVarsShadingOut(); } void myDisplay( void ) { for (int i=0; i<(textureDim*textureDim); i++) textureArray[i*4 +0] = textureArray[i*4 +1] = textureArray[i*4 +2] = textureArray[i*4 +3] = 0; writeTex = 0; readTex = 1; glEnable(GL_TEXTURE_2D); for (int i=0; i<2; i++){ glBindTexture(GL_TEXTURE_2D, tex_id[i]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, textureDim, textureDim, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureArray); //NULL); } glEnable( GL_DEPTH_TEST ); if (numberIterations == 0){ /////////////////////////// glViewport (0, 0, (GLsizei) textureDim, (GLsizei) textureDim); // set the size of our viewport (window) glMatrixMode( GL_PROJECTION ); // load the projection matrix; the subsequent transformations are going to affect it glLoadIdentity(); // initialise the projection matrix before applying the projection matrix // Specify that we are going to use a perspective projection - changing our projection matrix - NEW!!!!! gluPerspective(45.0f, (GLfloat)textureDim/(GLfloat)textureDim, 0.1f, 100.0f); //FOV, aspect ratio, near clipping plane, far clipping plane glMatrixMode( GL_MODELVIEW ); // load the model view matrix - subsequent matrices are going to affect this one glLoadIdentity(); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glLoadIdentity(); gluLookAt(eye[0], eye[1], eye[2], lookat[0], lookat[1], lookat[2], 0, 1, 0); /////////////////////////// glUseProgramObjectARB(glsl_programOut); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, tex_id[readTex]); glUniform1iARB(buf_Out, 0); glBegin(GL_POLYGON); glMultiTexCoord2f(GL_TEXTURE0, 0.0, 0.0); glVertex3f(-0.5, -0.5, -0.5); glMultiTexCoord2f(GL_TEXTURE0, 1.0, 0.0); glVertex3f( 0.5, -0.5, -0.5); glMultiTexCoord2f(GL_TEXTURE0, 1.0, 1.0); glVertex3f( 0.5, 0.5, -0.5); glMultiTexCoord2f(GL_TEXTURE0, 0.0, 1.0); glVertex3f(-0.5, 0.5, -0.5); glEnd(); glUseProgramObjectARB(0); } else{ for (int i=0; i<numberIterations; i++){ //cout << endl << endl << "Pass " << i << " : " << endl; glPushAttrib(GL_ALL_ATTRIB_BITS); glPushMatrix(); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBuffer); glDrawBuffer(attachmentpoints[writeTex]); ///////////////// glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-0.5,0.5,-0.5,0.5,-0.5,0.5); glMatrixMode(GL_MODELVIEW); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glLoadIdentity(); glViewport(0, 0, textureDim, textureDim); ///////////////////// if (writeTex == 0){ glUseProgramObjectARB(glsl_program1); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, tex_id[readTex]); glUniform1iARB(buf_1, 0); } else{ glUseProgramObjectARB(glsl_program2); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, tex_id[readTex]); glUniform1iARB(buf_2, 0); } glNormal3f(0.0, 0.0, -1.0); glBegin(GL_POLYGON); glMultiTexCoord2f(GL_TEXTURE0, 0.0, 0.0); glVertex3f(-0.5, -0.5, -0.5); glMultiTexCoord2f(GL_TEXTURE0, 1.0, 0.0); glVertex3f( 0.5, -0.5, -0.5); glMultiTexCoord2f(GL_TEXTURE0, 1.0, 1.0); glVertex3f( 0.5, 0.5, -0.5); glMultiTexCoord2f(GL_TEXTURE0, 0.0, 1.0); glVertex3f(-0.5, 0.5, -0.5); glEnd(); glUseProgramObjectARB(0); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glPopMatrix(); glPopAttrib(); /////////////////////////// glViewport (0, 0, (GLsizei) textureDim, (GLsizei) textureDim); // set the size of our viewport (window) glMatrixMode( GL_PROJECTION ); // load the projection matrix; the subsequent transformations are going to affect it glLoadIdentity(); // initialise the projection matrix before applying the projection matrix // Specify that we are going to use a perspective projection - changing our projection matrix - NEW!!!!! gluPerspective(45.0f, (GLfloat)textureDim/(GLfloat)textureDim, 0.1f, 100.0f); //FOV, aspect ratio, near clipping plane, far clipping plane glMatrixMode( GL_MODELVIEW ); // load the model view matrix - subsequent matrices are going to affect this one glLoadIdentity(); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glLoadIdentity(); gluLookAt(eye[0], eye[1], eye[2], lookat[0], lookat[1], lookat[2], 0, 1, 0); /////////////////////////// glUseProgramObjectARB(glsl_programOut); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, tex_id[readTex]); glUniform1iARB(buf_Out, 0); glBegin(GL_POLYGON); glMultiTexCoord2f(GL_TEXTURE0, 0.0, 0.0); glVertex3f(-0.5, -0.5, -0.5); glMultiTexCoord2f(GL_TEXTURE0, 1.0, 0.0); glVertex3f( 0.5, -0.5, -0.5); glMultiTexCoord2f(GL_TEXTURE0, 1.0, 1.0); glVertex3f( 0.5, 0.5, -0.5); glMultiTexCoord2f(GL_TEXTURE0, 0.0, 1.0); glVertex3f(-0.5, 0.5, -0.5); glEnd(); glUseProgramObjectARB(0); // swap read and write indexes readTex = 1 - readTex; writeTex = 1 - writeTex; } } glFlush(); glutSwapBuffers(); return; } void initUniformVarsShading1() { glUseProgramObjectARB(glsl_program1); buf_1 = glGetUniformLocationARB(glsl_program1, "tex1"); // glUniform1iARB(buf_1, 0); glUseProgramObjectARB(0); } void initUniformVarsShading2() { glUseProgramObjectARB(glsl_program2); buf_2 = glGetUniformLocationARB(glsl_program2, "tex1"); // glUniform1iARB(buf_2, 0); glUseProgramObjectARB(0); } void initUniformVarsShadingOut() { glUseProgramObjectARB(glsl_programOut); buf_Out = glGetUniformLocationARB(glsl_programOut, "tex1"); // glUniform1iARB(buf_Out, 0); glUseProgramObjectARB(0); } //fragShader1 uniform sampler2D tex1; varying vec4 vVertex; void main(){ vec4 colorBuf = texture2D(tex1, gl_TexCoord[0].xy); gl_FragData[0] = vec4(0.75,0.0,0.0, 0.25) + colorBuf; } //fragShader2 uniform sampler2D tex1; varying vec4 vVertex; void main(){ vec4 colorBuf = texture2D(tex1, gl_TexCoord[0].xy); if (colorBuf.a < 0.5) gl_FragData[0] = vec4(0.0,0.75,0.0, 0.25) + colorBuf; else gl_FragData[0] = vec4(0.0,0.0,0.4, 0.25) + colorBuf; } //fragShaderOut uniform sampler2D tex1; varying vec4 vVertex; void main(){ vec4 color = texture2D(tex1, gl_TexCoord[0].xy); gl_FragColor = color; } //shader.vert varying vec4 vVertex; void main(){ gl_TexCoord[0] = gl_MultiTexCoord0.xyzw; vVertex = vec4(gl_ModelViewProjectionMatrix * gl_Vertex); gl_Position = ftransform(); }[/quote]