Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About Anesthesia

  • Rank
  1. Kickass man. Bachus: What it turned out to be was that I was using old non-texture vertex data thinking it wouldn't make a difference. Like you said the new vertex list had 3x the vertices. Once I put in the new data, it worked like a charm. Thanks again!
  2. Anesthesia

    Better file format than .3ds

    I was going to suggest vrml (.wrl) because it has everything you need (and then some) and 3dsmax can selectively export normals, vertex coordinates, vertex indices, texture coordinates and indices, and it has an interpolater node too. Flex and yacc grammar definitions are available on the web. I could say I'm biased though because I'm 3 weeks into writing a vrml->ANSI C + OpenGL compiler.
  3. Anesthesia

    GLUT Problems

    Sounds like you haven't fully set up your build environment. Either you have to set your project up to import glut32.lib and opengl32.lib or you have to load opengl.dll and glut32.dll dynamically and import the symbols in your code. While I'm not familiar with Dev C++, from what compilers I have used it's consistently under project settings in or about the area of linker switches. Your help file on Dev C++ should tell you how to import external libraries...
  4. Anesthesia

    Terrain Smoothing

    What about masking the z-buffer before drawing the quad and unmasking it after? I'm going to stop guessing and just sit back and watch what happens with this thread; maybe I'll learn something out of it ;-)
  5. Anesthesia

    Terrain Smoothing

    I don't know if this is the problem but from my meager knowledge of opengl it looks like the vertices for your quad are drawn in the wrong order. Shouldn't it be: startX, -startY -startX, -startY -startX, startY startX, startY to give you a clockwise winding?
  6. Anesthesia

    move world or camera?

    jyk: Great explanation... The coordinate space is drawn relative to the viewer so any transformation on the viewer is mathematically no different from a transformation on everything in the coordinate space. The viewer is truly the center of the universe :-)
  7. Anesthesia

    Program not Texturing on some systems

    Oh another thing: You probably already know this, but watch out for vendor specific extensions...
  8. Anesthesia

    Program not Texturing on some systems

    Is your target the same platform you developed on? Did you supply the same .dlls you used with your game (non-system, of course)? Can you load the textures on the target in a paint app? I've had some bad mallocs that go through on Windows 95/98 but crash on all of the other OSes because the other OSes have better memory protection. If I write an app in 95/98 and it doesn't work on anything but 95/98 I immediately assume it was because I didn't allocate some memory properly and most of the time I'll prove myself right. The same thing can happen with faulty opengl code. Some of it will be given a pass (or be ignored) by Windows 95/98 but it will violate memory protection or cause undefined behavior on NT/2000/XP, etc. Also sometimes the file attributes change. If you copy it to a CD and to the target, your CD writer software might set everything to read only in the interim. I scratched my head on a couple of games that wouldn't work after I did that. It's a common occurrence after writing an app. Just recently, I wrote a demo that wouldn't work by itself. It would only work if my IDE was executing it. I found out it was because of a bad cast in some NeHe code (it casted and compared a uint to an int). gcc 2.9x passed it, but watcom failed it and that's how I found it :-( It can't hurt to checksum your distribution vs your original as well. There are a plethora of things it could be -- I wish I could be more helpful.
  9. Evil Bachus: I think you nailed the problem, but I'll have to give my data the regex treatment before I can test it ;-) VRML seems to have an index to texture coordinates structure much like its vertex indices and unless I'm mistaken looking through the red book OpenGL doesn't have any equivalent. Vrml creates both a texture coordinate array and a texture index array, the latter of which looks like this: GLuint, GLuint, GLuint, -1, ... It uses -1 to terminate its index fields, and the fact that they are in triplets seems to tie in with what you mentioned. I guess I didn't understand the data representation for VRML because OpenGL seems to work with the texture coordinates directly, unless I missed some function that can points to the the texture coordinates themselves and another which uses the indices that refers to them. I mean, basically the equivalent of glVertexPointer and glDrawElements, but for textures. Is there any such beast, or do I just have to start duplicating?
  10. I've got a problem here that is probably not code so much as it is my lack of understanding and inability to find any information whatsoever (I've only been working with OpenGL a couple of weeks) ;-) Ok, Basically I am using 3dsmax 3 to export a model to vrml 97 and I wrote a parser to read that data in. The parser is working. I used a TGA loader to load the skin and I pointed OpenGL to the texture coordinate array I parsed from the vrml file using glTexCoordPointer(2, GL_FLOAT, 0, textureCoordinates); I've also tried 3 as the first parameter, again with bad results. The texture DOES appear in the proper colors and I don't think it's an orientation issue either because I've rotated the texture on every axis and have yet to find a fit. The TGA file loader works properly, as it maps the skin correctly to a quad. The problem is it does not map to the model. The texture coordinates in the .wrl file appear to be in uv format: ie GLfloat Glfloat, ... with a range from 0.0 to 1.0, but it never seems to appear properly on the model, no matter what I do. I can enable S and T, change the environment mapping; basically trying to autogenerate the coordinates. It's almost as if the texture coordinates are bad, but I've listed them as GLfloat in a one-dimensional array (should the array be [2][]?), supplied them appropriately, etc. I don't want to be quick to blame someone else, but it seems almost as if 3dsmax is generating bad texture coordinates. Here's some code. void display(void) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); if(theta >= 360.0) { theta = 0.0; } //theta += 0.1; glPushMatrix(); glDrawElements(GL_TRIANGLES, 9725, GL_UNSIGNED_INT, indices_table); /*glBegin(GL_QUADS); glTexCoord2f(0.0, 0.0); glVertex3f(0.0, 0.0, 0.0); glTexCoord2f(1.0, 0.0); glVertex3f(1.0, 0.0, 0.0); glTexCoord2f(1.0, 1.0); glVertex3f(1.0, 1.0, 0.0); glTexCoord2f(0.0, 1.0); glVertex3f(0.0, 1.0, 0.0); glEnd(); */ glPopMatrix(); glFlush(); glutSwapBuffers(); } int initTextures(void) { glEnable(GL_TEXTURE_2D); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); LoadTGATexture(&textures[0],"mario.tga"); glGenTextures(1, &textures[0].texID); // Generate OpenGL texture IDs glBindTexture(GL_TEXTURE_2D, textures[0].texID); // Bind Our Texture glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, textures[0].width, textures[0].height, 0, GL_RGB , GL_UNSIGNED_BYTE, textures[0].imageData); /*glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); */ return 0; } void initWindow(void) { initTextures(); glClearColor(0.0f, 0.0f, 0.0f, 0.5f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glShadeModel(GL_SMOOTH); glFrontFace(GL_CCW); glCullFace(GL_BACK); glLoadIdentity(); glMatrixMode(GL_PROJECTION); //glRotatef (-1.0, 0, 0, -1.571); //glPolygonMode(GL_BACK, GL_FILL); glOrtho(-2.0f, 2.0f, -2.0f, 2.0f, -2.0f, 2.0f); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(3, GL_FLOAT, 0, v3f_table); glTexCoordPointer(2, GL_FLOAT, 0, textureCoordinates); glMatrixMode(GL_MODELVIEW); glutDisplayFunc(display); glutIdleFunc(idle); glutKeyboardFunc(keyboard); currentWindow = glutGetWindow(); } v3f_table is the vertex table of the format: GLfloat v3f_table[3][] = {{x, y, z}, .. }; textureCoordinates is of the format: GLfloat textureCoordinates[] = {x,y,...}; I can't list all of the coordinates because as you can see from glDrawElements, there are a lot of them :-). I apologize if I provided too many details and thanks for being here to help. It is definitely appreciated.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!