-
Posts
666 -
Joined
-
Last visited
-
Days Won
1
Tomb last won the day on July 25 2012
Tomb had the most liked content!
About Tomb
- Birthday 04/13/1988
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Tomb's Achievements

Universalist (7/7)
4
Reputation
-
Xandy reacted to a post in a topic: Alarm Clock
-
Tomb reacted to a post in a topic: OpenGL without external libraries
-
Tomb reacted to a post in a topic: OpenGL GlReadPixels
-
Thank you very much for the new function LarsJ. It works perfectly and can be a great optimization to draw lots of things with fewer calls! I appreciate all of your help with getting the OpenGL functions working correctly.
-
Tomb reacted to a post in a topic: OpenGL without external libraries
-
Tomb reacted to a post in a topic: OpenGL GlReadPixels
-
Hey LarsJ. Thanks for posting this example its a neat optimization to get rid of the unnecessary DllStructGetPtr call. I was trying to put together a small stripped down working example but decided I should just post the code snippets for now where the tile picking happens. First the map is loaded into an array and I create two display lists of the data so that I can quickly redraw the map every loop. $MapList = glGenLists(1) $ColorMapList = glGenLists(1) GLNewList($MapList, $GL_COMPILE) For $X = 1 to 12 For $Y = 1 to 12 DrawSprite2($X * 50 - 50, $Y * 50 - 50, 50, 50, 0, $Map[$X][$Y][0] - 1, 0) Next Next GLEndList() GLNewList($ColorMapList, $GL_COMPILE) glDisable($GL_TEXTURE_2D) For $X = 1 to 12 For $Y = 1 to 12 _glPushMatrix() _glTranslatef($X * 50 - 50, $Y * 50 - 50, 0) glBegin($GL_QUADS) glColor3f($X / 15, $Y / 15, 1.0) _glVertex3i(0, 0, 0) _glVertex3i(50, 0, 0); _glVertex3i(50, 50, 0); _glVertex3i(0, 50, 0); glEnd() glColor3f(1.0, 1.0, 1.0) _glPopMatrix() Next Next glEnable($GL_TEXTURE_2D) GLEndList() The first display list, $MapList is a collection of the map tiles that will be drawn where the other display list ColorMapList just contains colors which are calculated based on the coordinates. DrawSprite2 is just a reusable function I made for placing the textured quads. Func DrawSprite2($X, $Y, $W, $H, $R, $CurrentFrame = 0, $D = 0) Local $SpriteWidth = $W Local $SpriteHeight = $H Local $CalcW = $ImageHeight / $SpriteHeight _glPushMatrix() _glTranslatef($X, $Y, $D) $x_cell = $CurrentFrame * $cell_division $x_cell2 = ($CurrentFrame * $cell_division) + $cell_division If $R <> 0 Then _glTranslatef($W / 2, $H / 2, 0.0) _glRotatef($R, 0.0, 0.0, 1.0) _glTranslatef(-$W / 2, -$H / 2, 0.0) EndIf glBegin($GL_QUADS) _glTexCoord2d($x_cell, 0.0) _glVertex3i(0, 0, 0) _glTexCoord2d($x_cell2, 0.0) _glVertex3i($SpriteWidth, 0, 0); _glTexCoord2d( $x_cell2, 1.0 /$CalcW) _glVertex3i( $SpriteWidth, $SpriteHeight, 0); _glTexCoord2d( $x_cell, 1.0 /$CalcW) _glVertex3i(0, $SpriteHeight, 0); glEnd() _glPopMatrix() EndFunc For this current test I am only using tile picking when the left mouse is down. If the mouse is down, I draw the color map and check the pixel color, calculate which tile is under the mouse, clear the buffers, and draw the normal map. If BitAND($aKeyBoardState[01], 0xF0) > 0 Then GLDisable($GL_LIGHTING) glCallList($ColorMapList) Local $iWidth = 1 Local $iHeight = 1 Local $tBufferR = DllStructCreate( "float[" & $iWidth * $iHeight * 1 & "]" ) glReadPixels( $MouseX, $CurrentHeight - $MouseY, $iWidth, $iHeight, $GL_RED, $GL_FLOAT, $tBufferR) Local $tBufferG = DllStructCreate( "float[" & $iWidth * $iHeight * 1 & "]" ) glReadPixels( $MouseX, $CurrentHeight - $MouseY, $iWidth, $iHeight, $GL_GREEN, $GL_FLOAT, $tBufferG) ;Local $tBufferB = DllStructCreate( "float[" & $iWidth * $iHeight * 1 & "]" ) ;glReadPixels( $Mouse[0], 600 - $Mouse[1], $iWidth, $iHeight, $GL_BLUE, $GL_FLOAT, DllStructGetPtr( $tBufferB ) ) $col = Round(DllStructGetData($tBufferR, 1) * 15 - 1) $row = Round(DllStructGetData($tBufferG, 1) * 15 - 1) _glClear($GL_COLOR_BUFFER_BIT + $GL_DEPTH_BUFFER_BIT) GLEnable($GL_LIGHTING) EndIf glCallList($MapList) I separated the red and green values into their own glReadPixels calls for now to keep things simple. Unfortunately drawing the color map can be a little slow so for now I just check position on mouse clicks which works good but doesn't allow hover tile picking for tooltips or other sort of things. Although it does work great for determining which tile was clicked. Hopefully the code doesn't make this post too long but I wanted to ask you one more question. I saw your examples using glCallLists to draw text and was trying to use glCallLists for non-text calls to merge the calls into a single call. For example using _glTranslatef once to set the draw position and draw a bunch of lists at the translated position using glCallLists instead of calling each list separately. Display lists at different locations would need to be translated and drawn separately which is fine. I was just thinking it might be a possible optimization. I tried something like this: $ListArray = glGenLists(10) For $i = 0 to 10 glDisable($GL_TEXTURE_2D) GLNewList($ListArray + $i, $GL_COMPILE) _glPushMatrix() _glTranslatef($i * 50 - 50, 0, 1) glBegin($GL_QUADS) glColor3f(Random(0, 1, 1), Random(0, 1, 1), 1.0) _glVertex3i(0, 0, 0) _glVertex3i(50, 0, 0); _glVertex3i(50, 50, 0); _glVertex3i(0, 50, 0); glEnd() glColor3f(1.0, 1.0, 1.0) _glPopMatrix() GLEndList() glEnable($GL_TEXTURE_2D) Next ------------------------------------------ _glPushMatrix() _glTranslatef(0, 0, 100.0) Global $Arrays[10] $Arrays[0] = 0 $Arrays[1] = 1 $Arrays[2] = 2 $Arrays[3] = 3 $Arrays[4] = 4 $Arrays[5] = 5 $Arrays[6] = 6 $Arrays[7] = 7 $Arrays[8] = 8 $Arrays[9] = 9 glListBase($ListArray) glCallLists(10, $GL_UNSIGNED_BYTE, $Arrays) _glPopMatrix() But unfortunately none of the Display Lists appeared. Although a simple glCallList($ListArray + 1) worked. Sorry for the delayed response and massive post, and thank you for your help!
-
Tomb reacted to a post in a topic: OpenGL GlReadPixels
-
Tomb reacted to a post in a topic: OpenGL GlReadPixels
-
Thank you for your help LarsJ. With your example and function I managed to get the right return values. Now I can determine where the player clicks regardless of world rotation
-
I have been working with OpenGL recently seeing if I could rewrite the GDI graphics end of the game engine I have been working on. '?do=embed' frameborder='0' data-embedContent>> It has been going well and I have been making a lot of progress so far. Most recently I changed the perspective to isometric view (see the top left image). I then decided as a test to make the entire view rotateable. (top right and bottom left images) This all worked but as you can imagine, tile picking doesn't work anymore. I have been looking into the best way to do the tile picking and came to a conclusion that there are 3 methods. Ray casting, using the GL_SELECT rendering mode, or using color picking on an underlying and never visible layer when necessary. I decided on color picking by assigning each tile a color (bottom right image) and using the GlReadPixel function at the mouse coordinates. I would only need to check the colors on mouse clicks and drawing the color tiles in a display list made for little to no speed loss. Unfortunately I can't seem to get the GlReadPixels function to work properly. I found two variations of the function in searches. Func _glReadPixels($x, $y, $width, $height, $format, $type, ByRef $pixels) DllCall( 'opengl32.dll', 'none', 'glReadPixels', _ 'int', $x, _ 'int', $y, _ 'int', $width, _ 'int', $height, _ 'uint', $format, _ 'uint', $type, _ 'ptr', DllStructGetPtr( $pixels)) EndFunc Func glReadpixels($x, $y, $width, $height, $format, $type, $pixels) DllCall("opengl32.dll", "none", "glReadpixels", "int", $x, "int", $y, "int", $width, "int", $height, "uint", $format, "uint", $type, "dword", $pixels) EndFunc I have been trying all sort of guess and test calls to get the correct return values which should be floats of the red, green, and blue values or even integers between 0 and 255 representing the values but can't seem to get the function to return anything but 0. I'm not very knowlegeable about pointers and dllstructs and was wondering if anyone could help please. Some things I have tried: Opt("MouseCoordMode", 2) ;to ensure correct window based coordinates $Mouse = MouseGetPos() $tColors = DllStructCreate("BYTE[10]") ;also tested as a float Global $pColors = DllStructGetPtr($tColors) _glReadpixels($Mouse[0], $Mouse[1], 1, 1, $GL_RGBA, $GL_UNSIGNED_BYTE, $pColors) MsgBox(0, "", DllStructGetData($tColors, 1)) Msdn states that the correct function syntax would be as follows: I would appreciate any help with this. Thanks.
-
I have been doing a lot of work on the Game Engine lately. Although the updates aren't ready to upload yet, I have a video showing some of the new features. The update will include an inventory system, some basic particle effects, and some interesting 3D-ish effects I have been working on. http://www.youtube.com/watch?v=9RxeiAM-WUM Thank you BrewManNH for providing a link to GDIP.au3. I have added a link to the main post. Wakillon I agree about the global variables used in the pathfinding and these have been fixed. Although I'm not sure what you mean about the includes. While I agree that some of these are not needed others are absolutely necessary for the game engine to run properly. Please clarify about the includes comment. Thank you Careca
-
I have been working on another update. Bug fixes, added particle effects, and more. I will be uploading it sometime soon. Surprised I haven't had any reponses yet.
-
I have uploaded the latest files this morning. Various bug fixes. The source code is now included.
-
I have been working on a game engine for quite a while. While it is still very early in development, I thought I would finally like to share some of my progress with you. It features basic combat and movement as well as online tcp connections to play multiplayer with a friend and chat. Multiplayer can be simulated locally by running two instances of the executable. To play online with a friend, the host will need to forward port 7000. I originally started with GDI+ and eventually combined GDI and GD+ as well as various optimizations for a much needed speed boost. I would appreciate any feedback about game performance or bugs. It is still a very early alpha release which I work on regularly and will update again as more progress is made. I have included x32 and x64 bit versions of the main executable file. Gameplay: Arrow keys to move Enter key to use chat. Type a message or command and press Enter again to send. /Help to see a list of commands. F11 for full screen mode. Left and Right Click for attacks. The game files can be downloaded at http://unwarped.com/Game Engine 4.0.zip GDIP.au3 can be downloaded at Here is a recent video I uploaded in July. Although many changes have been made since. http://www.youtube.com/watch?v=sztPglYAdvE A new video I have just uploaded. http://www.youtube.com/watch?v=9RxeiAM-WUM
-
add dots randomly to middle of string
Tomb replied to FlamingMacro's topic in AutoIt General Help and Support
#Include <String.au3> $Input = InputBox("Add Random Dots to String!!", "Enter a string") If $Input <> "" Then $Length = StringLen($Input) $Random = Random(1, $Length, 1) $Result = _StringInsert($Input, ".", $Random) MsgBox(0, "", $Result) Else MsgBox(0, "", "Invalid String") EndIf -
I am using your GIF Animation Udf and its great! But I am running into one problem. If the window with a _GUICtrlCreateGIF GIF animation gets turned into a child window via _WinAPI_SetParent(), the GIF will not animate. Is there a possible solution for this problem?
-
Having problem using the "Mousetrap" function
Tomb replied to RGBreality's topic in AutoIt General Help and Support
at the top of your file add #Include <Misc.au3> -
how to make autoit work with d2?
Tomb replied to Rustynail17's topic in AutoIt General Help and Support
He intends to exploit a game glitch where people stack their auras to do very high damage to compensate for their lack of skill. I stopped played diablo ii a while ago. Personally I am more interested in this game: -
Yes on firefox but not on ie8. also on firefox my avatar has disappeared but on ie8 it is there.
-
me too this just started today. Jon must be modifying the forum somehow.