UeberBobo

Members
  • Content count

    99
  • Joined

  • Last visited

Community Reputation

122 Neutral

About UeberBobo

  • Rank
    Member
  1. OpenGL difficulties loading a texure

    OK, so apparently the function expected a String, problem solved by simply changing it to: image = image.tostring() all that numPy reshaping of arrays for nothing :)
  2. hi all, i got a problem loading and displaying a texture in OpenGL, using python (pyOpenGL) the texture shows up, but it looks like garbage data. ive made a test texture, a 2x2 red/black checkerboard BMP | red black | | black red | my code looks like this image = Image.open(filename) image = frombuffer(image.tostring(), ubyte) print image glBindTexture (GL_TEXTURE_2D, id); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 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_MAG_FILTER, GL_NEAREST); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, image); the print statement produces: [255 0 0 0 0 0 0 0 0 255 0 0] the result on screen is a quad with 4 different colored areas (non of them either red or black, both red/black pixels arent even the same color) should i give the data in a different format, like as a 2x2x3 matrix? ive played around with and searched the forum, but i just can't get it right any help on how you usually do this is greatly appreciated, some python specific advice ever more... thanks :) [Edited by - UeberBobo on December 15, 2006 1:19:37 AM]
  3. thanks :) id be very grateful if anyone here a bit more familiar with python could help me out a bit more, the way to do this keeps eluding me, ive been searching for some example code etc but so far i havnt figured out how do do this
  4. 3D puzzle solver

    minor tip here but what the hell :) since the game field is 4*4*4 = 64 you could represent it and the pieces with a long and check for invalid placement of pieces using AND, this would speed up you program lots, and probably simplify the code too. winning condition could be checked through playfield == 0xFFFF...F etc good luck
  5. A Trig question for my 3d programmers

    there's lots of trigonometry that has no applications in computer graphics, however trig is generally very useful in many scientific fields, so do try to learn as much as you can. a course linear algebra would probably the best mathematical foundation for learning computer graphics
  6. Hi all, im using OpenGL and python, trying to construct a basic tile-based RPG enginge (i will want to have some lighting and stuff later, so dont question my motifs here ;) ) basically i want to load an image from a file saved in some common file format and display it on the screen. ive had trouble finding a function in OpenGL that does this. i want one pixel in the image to be displayed as one pixel on the screen, like you would expect code that displays the GUI in games to work. because of this, im not sure i should map the image as a texture to a three-dimensional triangle, i dont want any distortions of the image, at least not at this point. (ie, i dont want the ability to rotate the playfield or zoom etc) python has a class Image with a method Image.open(filename) that seems pretty useful, but i dont know what format OGL wants the image in either thanks for any help on clearing out any of the above topics :)
  7. Implementing Priority Queue in C++

    i only know java, but wouldnt the easiest way to get a CHANGE_KEY_VALUE() method as you describe, be to extend the PrioriyQueue class in the STL
  8. Java question

    hi all., ive made a java program that uses swing. however the cmd window (this is windows xp btw) keeps hangin around (the old dos-ish window if i didnt manage to make that clear). anybody know how i can get rid of it? thanks :)
  9. Binary Trees

    bst's are a good datastructure whenever you want to insert/find stuff in it since it does it quicker than say a linked list (O=n log n opposed to n^2)... that might be a stupid answer tho :P
  10. quick java question

    zahlman: thanks that cool. could you explain how it works though? to me it feels like (byte & 255) would just stay the same as it is... say we take the number -236 (or whatever): 10010100 & 11111111 ------------- 10010100 so why does makes java decide its positive? is it the typecast to integer or what is it?
  11. another quick java question...

    as i said, the example was simplified. i know about things like question colon, but i find its often handy to use expressions in this way... im liking java less and less ;)
  12. another quick java question...

    how would i go about converting an expression so that i can use it in operations with say, an integer? a random simpflied example that has little to with what im really doing could be int a = 26 * (b<0); something that would work i cpp, but that i cant figure out how to do in java...
  13. quick java question

    but then, aint there little point in doing this? i might as well use the whole integer then, instead of masking it off to simulate an unsigned 8-bit, if theres no gain in memory use, right?
  14. on gaussian blur

    Conner McCloud: is doing this with a 60*1 and a 1*60 matrix equivalent with doing it by a 60*60 matrix? also what is FFTs? heard them mentioned sometime, but i dont know what it stands for or what it is... others: the reason i didnt post any code was i figured there was something algoritically different between my prog and for example photoshop (like what conner mccloud mentioned). im not that interested in optimizing it in low level..
  15. quick java question

    hmm, so would an int would take less space in memory if i masked it off like that? could you explain what happens here a bit further?