• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

174 Neutral

About DesignerX

  • Rank
  1. OpenGL [Solved] glTexImage2D issues

    Thx for the replies but nothing worked ! this is unbelievable, how can this be so complicated ????? do u have any other suggestions ? thx. [Edit] didnt notice the line that says that i should disable mipmapping in HuntsMan link (a very resourceful page I might add, thx alot)
  2. I am trying desperately to texture a simple quad using known examples but I always get a white quad with no texture. I tried creating the texture by myself and still nothing ! My initialization is : // Initialize display mode to be double buffered, with RGBA color model and with a depth buffer glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); // Initialize window position and size glutInitWindowPosition(-1, -1); // OS dependent glutInitWindowSize(500, 400); // Initialize the GLUT library glutInit(&argc, args); // Initialize opengl glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glShadeModel(GL_SMOOTH); glEnable(GL_TEXTURE_2D); // Bind and generate the texture glGenTextures(1, &g_uiTextureId); glBindTexture(GL_TEXTURE_2D, g_uiTextureId); unsigned char *data; data = (unsigned char *)malloc(256 * 256 * 3); // Should create a red texture for (int i = 0; i < 256 * 256 * 3; i += 3) { data[i] = 255; data[i+1] = 0; data[i+2] = 0; } glTexImage2D(GL_TEXTURE_2D, 0, 3, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, data); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); if (glGetError() != GL_NO_ERROR) printf("ERROR!"); // Never reached here Rendering : // Clear drawing buffer and depth buffer glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); // Reset world matrix and set world position for a triangle glLoadIdentity(); glTranslatef(0.0f, 0.0f, -6.0f); glBindTexture(GL_TEXTURE_2D, g_uiTextureId); // Render a textured cube glBegin(GL_QUADS); // Front face glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 0.0f); glEnd(); glFlush(); // Display frame glutSwapBuffers(); thx. [Edited by - DesignerX on June 19, 2009 12:40:17 PM]
  3. Need a help with a game design

    Ok then. I'll put them in my design doc without any technical refernce. I just wanted to have all possible scenarios so I'll know what kind of things I'll need when I start the programming design.
  4. Hi all, I am working on a short quest game where the player collects items and solves puzzles. I started with the game design document and described the concept, story and the other related stuff. I also wrote a success-scenario which describes the entire flow for reaching game victory (i.e. what the player does to reach game victory). My question(s) is this : Where do I write all-game possible scenarios ? Do I write game use cases in the game design document (in a general way as possible) ? Do I write it in the design document where all the programming stuff is ? Is it even done with game use cases or use cases are used only for the system design (i.e. when going into programming aspects) ??? I have been thinking of it for some time and will appreciate any opinion given. Thx.
  5. Hi, What is the best library to be used for writing window based application in linux ? Also I have a need to view a graph with x y axes so how do I do it ? If anyone can show me to a tutorial web site that will be great. Thx alot.
  6. Textured is not displayed

    Thanks, the page solved the problem.
  7. I tried to apply a texture on a quad but the quad color is white and the texture is not applied. I used SDL for opening the image and I enabled texturing with glEnable(..). I did any preparations needed (by Nehe tutorials) for loading and applying the texture but the quads is rendered with a white solid color. Any ideas ? Thx.
  8. messagebox with glut

    not exactly. I only need to open a message box with a text in it and an ok button like in win32api. any ideas?
  9. How do I open a messagebox using glut ? thx.
  10. OpenGL opengl main loop

    Well I tried using a timer function but the glutPostReDisplay doesn't do anything (the view doesn't change). When I use my rendering function as the idle function it works great but I have a feeling this is not a good idea using it as idle. How do you use the timing function correctly ? thx.
  11. OpenGL opengl main loop

    I am using GLUT (in linux). What is the timing function you mentioned ? I'll check the buffer issue. thx.
  12. I registered a rendering function as the display callback funcion. Problem is that the render function is called only when I move the window or the window is obscured. How in opengl do I make the rendering function to be called when I need it ? How does the main loop function works ? thx.
  13. Thx for the help. If it works for u it might be a problem with my glut libs.
  14. I just started to learn opengl and tried to open a simple window using glut. problem is that the window is opened without the title bar. just a blank square with no border of a standard window. How can I make the borders appear (I have no need in a menu bar, only the title bar) The code : #include <stdlib.h> #include <GL/glut.h> void renderScene(void); int main(int argc, char **argv) { glutInit(&argc, argv); glutInitWindowPosition(-1, -1); glutInitWindowSize(500, 500); glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH); glutCreateWindow("A Simple Window"); glutDisplayFunc(renderScene); glutMainLoop(); return 0; } void renderScene(void) { glClear(GL_COLOR_BUFFER_BIT); glFlush(); thx.
  15. I'm writing an Air Hockey game and have no idea how to write the AI for the computer player. Where should I start ? thx.
  • Advertisement