Jump to content
  • Advertisement

Tiresias

Member
  • Content count

    86
  • Joined

  • Last visited

Community Reputation

117 Neutral

About Tiresias

  • Rank
    Member
  1. Thanks for your answer, confirm that solution 2 approach is likely the best!
  2. Hi Gurus! i a total noob in graphics theory so please be indulgent. I have a question concerning how i shall implement object (weapons and armors to be exact) texturing. i.e : lest assume we have 2 weapon meshes. There is 10 matters available for those 2 weapons. The UV map for a weapon is the same for any matters. Shall we: 1- have 2*10 "weapon object resources" (maya or whatever) stored somewhere, one per matter per weapon (so 2 weapons * 10 matters) 2. or shall we texture the weapon in real time in code using its UV map + texture file , in this case we will have 2 weapon meshes, 2*1 UV (one UV mapping per weapon wathever the matter is), and 10 texture files. If this is 2, what would be pseudo code (independently of the game engine, like pointing out the 3d resources involved for the texturing: weapon mesh, uv and texture) Thanks , sorry if this doesnt make too much sense.
  3. Tiresias

    greyscaling a texture

    Hello just to confirm that changing pixel color {r, g, b, a} with { r+g+b / 3, r+g+b / 3, r+g+b / 3, a} in a RBGA texture , as proposed, work smoothly. thanks ! topic can be closed-
  4. Tiresias

    greyscaling a texture

    Sorry to bother again but i am still not sure how to achieve the pixels replacement. for RGB i think we need to average the luminance like R+G+B / 3 (or other formula), then create the 8 bit luminance buffer. but ... for RGBA ?? my textures contains alpha channel and i want to keep it ...
  5. Tiresias

    greyscaling a texture

    Yes i agree. I decided to preprocess the pixels. my button are small so no need to worry about perf. i think we can close this topic. (and the related one ;..)
  6. Tiresias

    greyscaling a texture

    on opengl es iPhone this code: glTexImage2D( GL_TEXTURE_2D, //duh 0, //no mipmaps GL_LUMINANCE, //store as luminance width, height, 0, //no border GL_RGB, //we have RGB data GL_UNSIGNED_BYTE, image_data); just crash because opengl return erro (GL_CALL assert error), if u change GL_RGB with LUMINANCE parameter there is some kind of grey, and most is black. in other words: it just doesnt work :)
  7. Tiresias

    greyscaling a texture

    shame on me , worst is that i looked before posting ... such a looser i am ; ok for the LUMINANCE, thanks. Would it work with RGBA texture as well or just RGB?
  8. Hi is there some code sample of how to grayscale a texture ? (if possible wothout reading all pixels value) (i dont mind if this is an aproximation, i just something looking grayed / disabled) thanks!
  9. Tiresias

    help on glOrthof wanted

    The problem was the -2h, all code is ok except this, comment can be closed.
  10. hello. I am migrating a 2D game from desktop to iPhone. So far i didnt encounter too many issues, openglES being quiet similar to openGL. I have now a issue concerning the zooming. on the windows version, the zooming is achieved through glOrtho. This is the only opengl call that achieves the zooming, the Blit coordinates etc are same with or wo zoom. the glOrtho is this one. It is called before each frame rendering. glOrtho( (w-w*s)/2, s*w + (w-w*s)/2, s*h + (h-h*s)/2, (h-h*s)/2, -1, 1) ; Where w and h are screen resolution, (1048x768 for ex) and s is the scale factor (could be < 1 for zoomedin, > 1 for zoomed out) for ex with s=1 (no zoom) we have glOrtho(0, w, h,0, -1,1); This works good. On Iphone i had to add some other matrice operation to enter landscape mode. It becomes: glRotatef(90.0, 0.0, 0.0, 1.0); // Landscape glOrthof( (w-w*s)/2, s*w + (w-w*s)/2, (h-h*s)/2, s*h + (h-h*s)/2, -1, 1)); glScalef(1.0f, -1.0f, 1.0f); glTranslatef(0.0f, -s*h, 0.0f); Note here that we call Ortho in a different way (on windows it was glOrtho(x0,x1,y0,y1,-1,1), for iphone it is (x0,x1, y1, y0,-1,1) -> y0,y1 are swapped. Note that in the translate, -s*h is in fact (y1-y0) My problem is that if s=1 all is fine. when s is > 1 for ex, i am having trouble (i believe the scene is translated upward, for ex if a texture must be displayed at y=200, i believe it will show up on y < 200, ) do you know what could be wrong ? (i am adding the code with s=2 maybe it ll help: windows: glOrtho( -0.5f*w, 1.5f*w , 1.5f*h, -0.5f*h, -1, 1) ; iphone: glRotatef(90.0, 0.0, 0.0, 1.0); // Landscape glOrtho( -0.5f*w, 1.5f*w, -0.5f*h, 1.5f*h, -1, 1) ; glScalef(1.0f, -1.0f, 1.0f); glTranslatef(0.0f, -2*h, 0.0f); actually writting this i realized: the glTranslate shall only be about -h, not -s*h right?! ) [Edited by - Tiresias on November 12, 2010 3:44:37 AM]
  11. You say that the textures are 512x512 size, and you're drawing 300 of them per frame? yes What vertex sizes are you drawing them at? u need the value of sx sy sh etc? i need to dump them but is this important ? sx and sy are likely to be in the sceen, sh and sw 512 at a max? "You could be experiencing massive overdraw, and those Intel chips are badly fillrate-bound." what do u mean ? "Implementing some kind of front-to-back sorting"" there is already one "oclusioN" is not an option because the GUI lib needs a glClear() so i need to redraw everything. i could optimize but it will be litle i believe. "glEnableClientState/glVertexPointer and glEnableClientState/glTexCoordPointer once per quad" as stipulated in the code, per quad. shall i call it only one a frame? maybe can i a go on this
  12. yes but its only 2D ... this is why it s even worst! i am only blitting 2d surfaces. i am just worry that i am doing something wrong.
  13. thanks guys for ur efforts :) greatly appreciated i tried with 512x512 for ex. but i am blitting from 64 to 512. i can try to have a properlist. and my frame rates starts dropping with only like 5 or 6 of 512 quads + lets say 30 of small ones. I will try to desactivate things and check where its really bad. the atlas is good idea but pff too much work i think , i need to pack all my textures and they are all differents size etc, and to economize few calls anyways. i will first try the triangle in case of. then directx, then will see :)
  14. Thanks but i am not sure to understand all. The code am using is posted. i am posting it again. glBindTexture(GL_TEXTURE_2D, target->textureList[(i*target->xChunks)+j]); float vertex2[]={sx, sy, sx+sw, sy, sx+sw, sy+sh, sx, sy+sh}; float textureCoor2[]={u1,v1, u2, v1, u2,v2, u1,v2}; glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(2, GL_FLOAT, 0, &vertex2); glTexCoordPointer( 2, GL_FLOAT, 0, &textureCoor2); glDrawArrays(GL_QUADS, 0, 4); This is this bit which is the bottleneck because : 1- when i minimize my window application, frame rate detected grows to 60 frames / sec which is my maximum 2- with glDebugger when i deactive the "opengl draw calls" the frame rate grows to 40/50 which would be better. So i think the GPL cannot cope with all the draw. I know that 300 calls are not a lot. But maybe for an integrated its enough ? must say that textures are 512x512 at a max, i tried to make them little (256x256, 64x64) but no changes detected ( i guess this is because textures are smaller but more draw calls must be done (at the end my .png .jpg etc keep the same size, i am just making smaller chunks). I didn't know for the GL_QUADS. i can try to use DrawElements and Triangles instead ... batching the quads: how can i do this if each texture is a different one? i mean quad1 has texture1, quad2 has textureId2 etc (it is not a "model" , i.e a lot of vertices and 1 texture. here each quad is an entire model basically (a 2d textured rectange). So for each quad i must bind a diferent textureId. I didnt understand the texture batching. Any pseudo code to help me with?
  15. I ran glDebugger and i saw that my frame rate is around 25 on my integrated card, after playing a bit with glDebugger it looks like the main bottlenecks is the graphic card (ok we knew it!) , especially the draw primitive, So this is definitly the piece of code i described before. My question is : im calling this glDrawArrays about 300 times in a loop, is there a way of batching those draw in one single flush? (NOTE that all my textures are differents, if i do a batch i would need a way of batshing the textures as wells) (or calling draw but configuring the calls to not be executed right away but only when i call like a "flush" function ? ) in fact i have a doubt : this is what we call immediate mode? i mean i am actually in immediate mode as i draw each quad sequencially? If answer is yes, shall i use VBO (vertex buffer object) technique to batch all in one? [Edited by - Tiresias on September 7, 2010 3:59:18 PM]
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!