• Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About MattHughes

  • Rank
  1. Solved it - I had to glUseProgram(p) before setting uniform variables.
  2. Quote:Original post by V-man If glGetUniformLocation returns 0, then 0 is the position of some hw register or some kind of reasonable abstraction. If glGetUniformLocation returns -1, then you have a problem! Guys, read the documentation! Yes, thank you, I understand that now. But the problem remains: no matter what I do, uniform variables remain zero. Is there something wrong with my code that would have this effect? int c = 100; loc1 = glGetUniformLocation(p,"c"); glUniform1i(loc1,c); printf("c is at %d\n", loc1); // prints "c is at 0" -- and that's okay int retval; glGetUniformiv(p, loc, &retval); printf("c has value %d\n", retval); // prints "c has value 0" -- NOT okay!
  3. Hey, thanks for the tip about glUniform*i. I tried it, changing all my data types to int, and still no matter what I set something to it stays at zero. int c = 100; loc1 = glGetUniformLocation(p,"c"); glUniform1i(loc1,c); printf("c is at %d\n", loc1); // prints "c is at 0" int retval; glGetUniformiv(p, loc, &retval); printf("c has value %d\n", retval); // prints "c has value 0" Maybe I'm doing something wrong in my vertex & fragment shaders? They're rather simple. vert: uniform int c; void main() { gl_Position = ftransform(); } frag: uniform int c; void main() { gl_FragColor = vec4(c/255.0); }
  4. Hello, I've been following the Lighthouse3d tutorials on GLSL, and I can't manage to set uniform variables. Whenever I get memory locations using glGetUniformLocation, it returns 0 or sometimes 7. Setting values with glUniform1f doesn't do anything at all. I found a similar post here but his solution of adding DGL_GLEXT_PROTOTYPES to the preprocessor definitions does nothing. Here's an excerpt from the Lighhouse3d tutorial that I have modified: float specIntensity = 0.98; loc1 = glGetUniformLocation(p,"specIntensity"); glUniform1f(loc1,specIntensity); printf("loc1 is %x\n", loc1); // prints "loc1 is 7" float val; glGetUniformfvARB(p, loc1, &val); printf("specIntensity is %f\n", loc1); // prints "specIntensity is 0.000000" I've tried switching to the ARB syntax but I have the same problem. I'm running windows xp with an ATI x1650. Any ideas? edit: I've tried using both glee and glew, both have the same effect. [Edited by - MattHughes on March 7, 2009 3:35:35 PM]
  5. magic in movies ?

    If you're referring to special effects for movies, the short answer is no. You'd be better off using 3d rendering and film editing software such as Maya and After Effects.
  6. How do I save a scene?

    I've started saving my scenes in human-readable XML files. Scene graphs translate to XML very nicely.
  7. When using lua/luabind in the same project as glpng, I suddenly found myself facing linker errors: error LNK2001: unresolved external symbol __iob After several hours, I finally found the way to make this work. It took way too long to find the solution, so here it is for future reference. Before including lua.h or glpng.h, put this code in: extern "C" { FILE _iob[3] = {__iob_func()[0], __iob_func()[1], __iob_func()[2]}; } and voila it works.
  8. I'd recommend using something like luabind, which makes it very straightforward to get your classes and methods into lua. Here's a great tutorial.
  9. loading breakout leves from a file

    I think this part is probably not working as you expect: while(!inFile.eof()) { inFile>>block[i]; i++; } The >> operator will read everything up to the next delimiter. If your format is 0011110110, it will try to read the whole thing as a single integer. If you're using >>, you'll neet to keep your delimiters between the numbers. Can you check your block[] array to see if it's populated correctly? If it is, what makes you think your output is incorrect? can you show us?
  10. loading breakout leves from a file

    Or you could even store your 1s and 0s in a binary file! That particular level could be stored in 8 bytes, including space for the dimensions! :-D
  11. quexle

    Hi, I played for ~5 mins and I couldn't get past the first page... I even had trouble getting past the ads.
  12. spherical graphics engine?

    You might need to work in spherical coordinates (r, theta, phi). Opengl works in Cartesian coordinates (x, y, z). To learn more about spherical coordinates read this. "Gravity" will always act radially (it will pull you from your position to the center of the planet) as biggoron says. You will also need to use the same (but opposite) vector to define the "up" direction of your camera.
  13. Thanks for the super-quick reply.
  14. Hi, Is there a way to tell OpenGL to not use any custom shader program after glUseProgram has been called? My scene graph activates shaders for certain objects, but not all objects require the use of a shader. Thanks!