Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

102 Neutral

About Lewis_1986

  • Rank
  1. Lewis_1986

    Dynamic Resolution Rendering

    I love that this was tested on a quad core package but i would be more interested in seeing the results on a dual or single core processor. Also i agree fps is not a valid measure please use avg ms with highest ms and lowest ms per frame
  2. if you are using the fixed function pipeline (I assume you are because otherwise you would have the view matrix because you would have coded the matrix stack) then you can use the following code //To retrieve the current Modelview matrix: GLfloat m[16]; glGetFloatv (GL_MODELVIEW_MATRIX, m); this comes from http://www.opengl.org/resources/faq/technical/transformations.htm so I would say it was the recommended way to deal with fixed-function (pre 3.1 openGL).
  3. Lewis_1986

    Cube-Cube collision detection

    Hi, I'm sure if the compiler did not optimize code for us we would have to inline the code like that but can anyone confirm or deny that the compiler does this? I'm sure C++ is smart enough to do basic var stacking and loop unrolling where needed... Hopefully anyway (this is my hopeful face) I am also quite sure you need extra brackets and to change some of the && to || ala return ((A.bbMin.x <= B.bbMax.x) || (A.bbMax.x >= B.bbMin.x)) && ((A.bbMin.y <= B.bbMax.y) || (A.bbMax.y >= B.bbMin.y)) && ((A.bbMin.z <= B.bbMax.z) || (A.bbMax.z >= B.bbMin.z)); voilla this now works as expected when I test it (oh the cheek of me) by the way i'm not poking fun I'm just in a very good mood
  4. To be fair I did read the code which is why I posted example code that I know works and is a rather nice example of gluLookAt to create a target camera. I quickly read his code i will admit but it absolutely does modify the values of axX and axZ which is what is passed to the camera... (sigh) Edit: Also I have noticed that you may need to fix the indentation because gamedev ever so cleverly b@||@#%d it with their code formatter
  5. what exactly are you attempting to achieve with the gluLookAt? here is a test 3rdPersonCamera that uses gluLookAt #!/usr/bin/env python import sys import math try: from OpenGL.GLUT import * from OpenGL.GL import * from OpenGL.GLU import * except: print '''ERROR: PyOpenGL not installed properly.''' sys.exit() class thirdPersonApp: def __init__(self): #player coordinates self.playerX = 27.0 self.playerY = 0.5 self.playerZ = 27.0 #camera coordinates self.camX = 44.0 self.camY = 25.0 self.camZ = 44.0 self.playerRot = 225.0 self.cameraRot = 20.0 self.camDist = 50.0 #self.camHeight = 25.0 self.moveVel = 1.0 self.rotVel = 6.0 self.setupGL() def setupGL(self): glutInit() glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH) glutInitWindowSize (400, 400); glutInitWindowPosition(100, 100) glutCreateWindow("Third Person Test Application") self.glInit() glutIdleFunc(self.onIdle) glutDisplayFunc(self.onDraw) glutReshapeFunc(self.onResize) glutKeyboardFunc(self.onKeyPress) glutMainLoop() def onIdle(self): self.onDraw() def onDraw(self): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)# Clear The Screen And The Depth Buffer glLoadIdentity()# Reset The View self.camX = self.playerX+self.camDist*math.sin(self.cameraRot*math.pi/180.0) #self.CamY = self.playerY-self.camDist self.CamZ = self.playerZ+self.camDist*math.cos(self.cameraRot*math.pi/180.0) gluLookAt(self.camX,self.camY,self.camZ,self.playerX,self.playerY,self.playerZ,0,1,0) glColor(0.5,0.5,0.5) glBegin(GL_LINES) i = 0 while i < 10: glVertex(-50,0,-50+i*10); glVertex(50,0,-50+i*10) glVertex(-50+i*10,0,-50); glVertex(-50+i*10,0,50) i = i+1 glEnd() #z-fight self.playerY = 0.5 glTranslatef(self.playerX,self.playerY,self.playerZ) glRotatef(self.playerRot,0,1,0) glBegin(GL_TRIANGLES) glColor(1,1,1); glVertex( 0,0, 7) glColor(1,0,0); glVertex(-5,0,-5) glColor(1,0,0); glVertex(+5,0,-5) glEnd() glColor(1,1,1) glBegin(GL_LINES) glVertex(0,1,0); glVertex(5,1, 0) # X glVertex(0,1,0); glVertex(0,5, 0) # Y glVertex(0,1,0); glVertex(0,1, 5) # Z glEnd() glutSwapBuffers() def glInit(self): glClearColor(0.0, 0.0, 0.0, 0.0) # Black Background glShadeModel(GL_SMOOTH) # Enables Smooth Color Shading glClearDepth(1.0) # Depth Buffer Setup glEnable(GL_DEPTH_TEST) # Enable Depth Buffer glDepthFunc(GL_LESS) # The Type Of Depth Test To Do glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) # Realy Nice perspective calculations def onResize(self,w,h): glViewport(0,0,w,h) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45.0, float(w)/float(h), 0.5, 1024.0) glMatrixMode(GL_MODELVIEW) def onKeyPress(self,*args): if args[0] == chr(27):#ESC Key self.eXit() elif args[0] == "w": self.playerX = self.playerX+self.moveVel*math.sin(self.playerRot*math.pi/180.0) self.playerZ = self.playerZ+self.moveVel*math.cos(self.playerRot*math.pi/180.0) elif args[0] == "s": self.playerX = self.playerX-self.moveVel*math.sin(self.playerRot*math.pi/180.0) self.playerZ = self.playerZ-self.moveVel*math.cos(self.playerRot*math.pi/180.0) elif args[0] == "a": self.playerRot = self.playerRot+self.rotVel elif args[0] == "d": self.playerRot = self.playerRot-self.rotVel elif args[0] == "q": self.camY = self.camY - 1.0 elif args[0] == "e": self.camY = self.camY + 1.0 if self.camY <= 10.0: self.camY = 10.0 if self.camY >= 180.0: self.camY = 180.0 glutPostRedisplay() def eXit(self): #destroy glForm sys.exit() if __name__ == "__main__": thirdPersonApp() it's a bit messy because it is so old and based off of a delphi application, but it should help you to better understand gluLookAt
  6. Lewis_1986

    OpenGL 1,2,3,4 general question

    OMG you like DX better than GL... Many people in the world of DX (including myself) complained endlessly over features simply removed from the spec without deprecating, consulting or providing support from 7 upwards. OpenGL does provide full easily readable specification, that deprecates and has a wide base of developers, who develop for multiple platforms. Also OpenGL is extremely OOP! Just consider that encapsulation, abstraction, modularity, polymorphism, messaging and inheritance (wikipedias definition of OOP is completely met by OpenGL! Just thought I should point that out nehe was the first i had a look at xD looked quite old to me too^^ what tutorial source would you suggest =) ? or are there any recommended books for opengl4 ? i'd like to have an overview and basic techniques used in opengl beginning with - viewports over - view matrices for a camera, - how to use a fbo, - different techniques of drawing (read about displaylists, vertex arrays and vertexbuffers, different opinions in every spot i've read) - usage and need of shaders in opengl4 [/quote]
  7. Lewis_1986

    Cube-Cube collision detection

    Hi, I'm not sure why it matters if the players box would be rotated? I use code similar to this code boolean rectCol(Rect A, Rect B) //rectangle collision because overlap is such a long word ;) { bool xCol = (A.bbMin.x <= B.bbMax.x) && (A.bbMax.x >= B.bbMin.x); bool yCol = (A.bbMin.y <= B.bbMax.y) && (A.bbMax.y >= B.bbMin.y); bool zCol = (A.bbMin.z <= B.bbMax.z) && (A.bbMax.z >= B.bbMin.z); return xCol && yCol && zCol; } Of course this is not live code, it was whipped up just to demonstrate the simplicity of such code. Also if the language supports it pass addresses around as they are obviously smaller than passing whole complex objects! hope this helps there! Ramp collision should be implemented with the same bounding box collision, but then you would need to find the collision point within the box to test if the "player" is colliding with the ramp
  8. Lewis_1986

    Confusion about Law of Demeter

    http://en.wikipedia..../Law_of_Demeter, I have never heard of it before (although I have heard about encapsulation and abstraction) and I did know that it is naughty (not wrong) to assume a class has a class that has a function, but basically I think laws like this stifle common sense, it may not be very OOP to occasionally ignore this rule, but I can imagine significant code bloat and mind-boggling if it were universally applied to every single project or class. Having said this the engine->torque example was absolutely exemplorary. As a side note, in environments such as ECMA, could a person not chain evaluations to nullify the negative effects of such assumptions so: eval("car57").eval("getEngine()").eval("getTorque()") As I understand it ECMA script provisions for all objects having internal evaluation and returning NULL (which is an object in ECMA I think) so does this destroy the need for demeters law Update: Just checked and I was wrong about ECMA, it cannot solve this problem but a solution would be some sort of managed code
  9. So basically the article suggests using a bool sometype::init() instead of the constructor object for allocating resources as init can fail gracefully and constructors will just create massive mem leaks. I actually agree 100% with the article on this issue and would like to suggest http://www.scs.stanford.edu/~dm/home/papers/c++-new.html as a good read on the subject of constructors
  10. I see! You would be best making it online then because it will be much easier, and nobody will have to install anything. As an added benfit people being online would be a given because D&D is a collaborative game (not single player). There are lots of freeware editors for html out there and basic javascript can load and save cookies of what each player has typed. you would also need a simple backend to be programmed in a server-side scripting language but it's all quite easy to do. You will need a web host with php or similar scripting language support and the rest of the information can be located through google and w3schools which are both free. Personally I know the webhost I use is affordable at only $10 per month (www.dreamhost.com) so get cracking and I will definately look forward to seeing what you come up with. Also after clarification from ApochPiQ about the intention of the response, I would like to apologise as I must have completely misinterpreted the post sent by you
  11. right personally I don't care what anyone's opinion is because I work on many different hardware platforms and get paid for what I do, if pixels are set then it is an image FULL STOP! You can abstract an issue as much as you like, and encapsulate it in various classes and give it fancy names but as long as you set pixels, your drawing an image. Drawing a font is an image action where the images width and height are relative to the resolution of the font, this is called raster text, it works with windowing toolkits, hardware accelerated libraries such as opengl and the result can be translated to devices like lcd's and braille output devices. Secondly, to the OP, I apologise for all this noise and that is the only thing I can describe it as but there is not a name for the system, although the process of combining images is called compositing. Are you looking for a framework that allows you to simplify this process or are you just asking how it would work because it can be simple or complex depending upon what you want to get out of it. drawing ascii characters for example is much easier than drawing wide characters 255 values vs 65535 values assuming in both cases loose one possible value to signify invalid data. You can PM me if you like or try to be more specific, no matter how trivial all details are needed for giving a fuller answer Edit: Just seen your screenie, are you looking to implement this for the web or in a traditional application, because if it is for the web use input text boxes like below (note please do not copy and paste because this is not optimal code) <div style=" background: url('./bg-img.jpg'); width: 100%; height: 100%; "> <div style="position: absolute; left: 50%; top: 50%; margin-top: -100px; margin-left: -150px; width:200px; height: 200px;"> some visible uneditable-text<br/> <input type="text" name="whatever_name" id="whatever_name" size="20" /> </div> <div style="position: absolute; left: 50%; top: 50%; margin-top: -100px; margin-left: 50px; width: 200px; height: 200px;"> some visible uneditable-text2<br/> <input type="text" name="whatever_name" id="whatever_name" size="20" /> </div> </div> If it is application code then it will be more complicated because you would need to program the classes such as input, also if you were drawing with opengl you could use glScissor command to only re-draw the textbox Edit2: by the way to only show the box of text is called clipping and using glScissor is one way of doing this, another way is to draw the text from right to left until the pixel position is less than the textboxes x component, but this is only for an application
  12. Lewis_1986

    Facts about John Carmack

    John Carmack is GOD and he regularly influences history to display his greatness. He created the agents in the film "The Matrix" because NEO was going to overload his matrix stack implementation, and at the end of the film you see the real John Carmack who pilots the John Carmack, we see's automaton body
  13. To me it comes across as "Trying to understand the question more fully", rather than mocking. Good questions get better answers, ApochPiQ seems to be trying to get a better question. [/quote] Seriously I hope I'm wrong but I cannot see why someone would take that mode of reply as a probe for more information? If it was a genuine probe I do apologise, but as an educator I see alot of people quitting very early on, simply because they do not understand a concept and when they ask a question the response stifles their interest. Also I do not see that it matters how the system of compositing would be implemented. Unless there is a system out there that uses elliptical co-ordinates, the basis is the same... html, xhtml, flash, c++ (winforms, sdl etc) all use rectangular co-ordinate systems for describing objects positions and bounds. I do hope that the original poster has a greater understanding of a way to draw text and images together and that if they do not, that they continue to seek answers and probe further.
  14. well the simplest way is to treat the text as an image, create a larger image representing the entire area that the text and images exist on and draw each object. Of course this all sounds very simple to an experienced programmer but I recognize some people may have trouble so i'll try to break it down a bit more for you 1) a glyph is the description of a character so it would have an x and y origin and an x and y extent (xorigin+width and yorigin+height) 2) the glyph would also contain a series of points with their position within the glyph (again x and y) and intensity, because if all points had the same intensity it could only represent a solid block or empty block, which would result in aliasing (blocky text) 3) once you have these points and have created a texture that is the size of the glyph, you can set each pixel to the value of the color you wish it to be with alpha multiplied by the intensity from the point (this will create anti-aliased text that is transparent and most computers now support rgba colours) 4) work out how large each entire piece of text is and draw each glyph in the text 5) draw the text and images onto the larger image N.B. every object will have a display rectangle, so text, images, characters (which make up text) and the drawing area can all be described and should use a rectangle to descirbe their position and extent @ApochPiQ, seriously the old addage "if you cannot say anything helpful, be silent!" springs to mind because mocking someone and then telling them what they want to do is trivial helps no-one
  15. the reason the file is only a few hundred kilobytes, rather than tens of megabytes or even gigabytes is because data is stored in binary mode and there is a maximum map size. Also because data is serialized in binary, rather than ascii mode, things like PLAYER1_START_LOC would probably just be stored in a structure as the value (the structure would probably have all of the start locations and may even have the name start_locations. Remember not many apps store their variable names (unless the data is a scripting language like lua or html) but rather use them as a tool of high-level programming to assist us the programmers to visualise a mental model of how the application works. Also there is a sourceforge project that works with w3g files in php which is about as high level as you could get for working with the format. http://sourceforge.net/projects/w3rep/ and one in delphi http://sourceforge.net/projects/dw3gparser/ They probably have comments in their code that will assist you, but please do not think studying someone elses format will lead you to an optimal solution because warcraft 3 was written many years ago and there will have been paridigm shifts in aspects of computing in general and gaming
  • 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!