Jump to content
  • Advertisement

Knight Chat X

  • Content Count

  • Joined

  • Last visited

Community Reputation

123 Neutral

About Knight Chat X

  • Rank

Personal Information

  • Interests
  1. Quote:Original post by vandana123 Hi, Anyone knows how to create multitexture in C++. i am facing a problem to create compressed texture using OpenGL function with only SIS Mirage3 Graphics card, more details regarding the problem is given below: 1) I am using the following opengl funtion to create compressed texture : glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_ARB, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_BYTE, TextureImage[0]->data); 2) This function is working fine with graphics cards other than SIS Mirage 3; With SIS Mirage 3 on Vista machine, this function returns GL_INVALID_ENUM value. 3) There is no problem on Vista machine with Intel Graphics card. I am not getting why is this getting failed? please help me someone, and let me know the architecture to create compressed texture. -------------------------------------------------------------------------------- It may be easier to just try to load an already compressed texture into memory that's stored on file on computer already compressed instead of trying to compress it during load, it might be faster and lower your texture load time doing it that way as texture size seems to be slower with larger textures while loading... Here's something on using compressed textures on OpenGL dunno if will help: http://www.starcoder.com/wordpress/2007/09/10/using-compressed-textures-in-opengl If you want to convert image to another format and/or change image settings could use Bitmap, and/or GDI+, etc... If you want to create multiple size versions automatically in memory use glbuildmipmaps during load instead.
  2. Quote:Original post by Kalidor On Windows, you have to access everything beyond OpenGL 1.1 as an extension (multitexturing was added to core in 1.3). Read this article if you don't know about extensions, then use either GLee or GLEW to load them. EDIT: I'm not sure of what you can use to load extensions in VB.NET, there's gotta be something out there though. Thanks, I'll try looking into these and do some more research, I'm trying to do this without using a 3rd party DLL library solution, I can only find C++ and C# source code samples when converted to VB.NET just isn't working, the function pointers are variables and seem like Delegates, I found this and tried it and not working: http://www.codeproject.com/vb/net/Delegate.asp The delegate (function pointer) is supposed to have the function address passed off to the variable using AddressOf, in which you can then call the function/method using the variables name and passing any parameters, optionally using Invoke. C++ TYPE DEFINITION: typedef void (APIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum target); Is said to be equivilant to VB.NET's, which defines a type safe, method or function: Public Delegate Sub PFNGLACTIVETEXTUREARBPROC(ByVal target As Int32) C++ VARIABLE: PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = NULL; Is said to be equal to VB.NET's variable declaration like so: Public Shared glActiveTextureARB As PFNGLACTIVETEXTUREARBPROC = Nothing C++ Assigning Reference to Function/Passing Function Pointer/Function Address to Invokable Variable: glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC) wglGetProcAddress("glActiveTextureARB"); VB.NET Assign Addresses/References to the Function Pointers: glActiveTextureARB = wglGetProcAddress("glActiveTextureARB") -OR- glActiveTextureARB = AddressOf <FUNCTION POINTER> See if Multi-Texturing is supported... If IsNothing(glActiveTextureARB) = True Then MsgBox("Your version of OpenGL does not support multitexturing...", , "Error") VB.NET's Function Usage would be: glActiveTextureARB(GL_TEXTURE0_ARB) -OR- glActiveTextureARB.Invoke(GL_TEXTURE0_ARB) 2 Other ways to declare the function are: <Runtime.InteropServices.DllImport("opengl.dll", EntryPoint:="glActiveTextureARB", SetLastError:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, ExactSpelling:=True, CallingConvention:=System.Runtime.InteropServices.CallingConvention.StdCall)> Public Shared Function glActiveTextureARB(ByVal target As Int32) As Long End Function -OR- Declare Auto Function glActiveTextureARB Lib "opengl.dll" (ByVal texture As Int32) As Long
  3. Anyone know how to do multiple textures in OpenGL using VB.Net and get this to work? All I can find right now on using multiple textures is in C++. I'm trying to apply multiple textures to geometry and while setting active texture it gives me error: EntryPointNotFoundException was unhandled. Unable to find an entry point named 'glActiveTextureARB' in DLL 'opengl32.dll'. I'm using NEHE Lesson 22 as an example: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=22 I looked into the OpenGL32.dll and OpenGL.dll in C:\Windows\System32 and it doesn't show glActiveTexture at anywhere in the DLL as a callable function. [Edited by - Knight Chat X on September 25, 2007 4:02:17 AM]
  4. How do I display 2D text in Visual Basic.Net using OpenGL? I was thinking perhapes a problem in one of these API declaration but not sure.: Declare Auto Function glPixelStorei Lib "opengl32.dll" (ByVal pname As Integer, ByVal param As Integer) As Int32 Declare Auto Function wglUseFontBitmaps Lib "opengl32.dll" Alias "wglUseFontBitmapsA" (ByVal hdc As Int32, ByVal dword As Int32, ByVal dword As Int32, ByVal dword As Int32) As Boolean Declare Auto Function glCallLists Lib "opengl32.dll" (ByVal n As Int32, ByVal type As Int32, ByVal lists As Byte()) As Boolean Declare Auto Function glBitmap Lib "opengl32.dll" (ByVal width As Int32, ByVal height As Int32, ByVal xorig As Single, ByVal yorig As Single, ByVal xmove As Single, ByVal ymove As Single, ByVal bitmap As Byte()) As Boolean I'm currently use these sub routines to make the font and render the text, the MakeRasterFont is place in the OpenGL Initialized code section, and the Render Text during render after the glRasterPos2i(10, 10) function: Private Shared Sub MakeRasterFont() glPixelStorei(GL_UNPACK_ALIGNM... 1) fontOffset = glGenLists(128) Dim letter(0) As Byte letter(0) = &HE7 'Used as test charactor. glNewList(fontOffset, GL_COMPILE) glBitmap(8, 13, 0.0F, 2.0F, 10.0F, 0.0F, letter) glEndList() End Sub Private Shared Sub RenderText() Dim arrText(0) As Byte arrText(0) = &HE7 'Used as test charactor. glPushAttrib(enumAttribute.GL_... glListBase(fontOffset) glCallLists(arrText.GetLength(... GL_BYTE, arrText) glPopAttrib() End Sub For initialization I use: MakeRasterFont Then during render: glRasterPos2i(10, 10) RenderText() It's not working, and I don't know why, I'm open to other alternatives, I've tried using GDI draw method to display 2D text in the main forms paint event but it only does it on the forms background only and won't show on the OpenGL render window? [Edited by - Knight Chat X on April 24, 2007 1:10:32 AM]
  5. Quote:Original post by Aph3x Yep, KRadToDeg is for conversion from radians to degrees. If you're using a matrix for your camera, the 3x3 rotation part defines it's orientation as 3 basis vectors for x y & z. You can take the z axis straight out of the matrix and use it as the projectile direction. So KRadToDeg is the Matrix Z-Axis value/angle converted from Radian to Degrees?
  6. Quote:Original post by Aph3x What I'd do is use a vector direction for your projectiles (which can be taken directly from your camera matrix - usually the Z axis basis vector). You can extract a heading and pitch from this vector when you need to draw the projectile using something like: *** Source Snippet Removed *** You mean the camera's view vector? hdg = -float(KRadToDeg * atan2(dir.x, -dir.z)); pitch = float(KRadToDeg * atan2(dir.y, sqrt((dir.x*dir.x) + (dir.z*dir.z)))); What is the KRadToDeg value of? I understand the conversion from Radian to Degree's.
  7. Quote:Original post by xissburg billboarding? Yeah that helped, spherical billboarding, at the moment I'm using this for orienting a bullet projectile and sometimes though but not often for some reason it'll fire the projectile completely sideways and not sure why, so I've gotta tweak something out somewhere, but this was a good start, thanks. [Edited by - Knight Chat X on April 14, 2007 12:15:45 AM]
  8. Knight Chat X

    Overlaying texture with color??

    For the Pixel data of the texture if the Alpha is 255 it should be fully Opaque/Solid, if it's 0 it should be fully Transparent/Invisible. The alpha value is basically the Solidity/Opaque Strength. Try glMaterial function with normals and lighting to color the material? I use this sub routine to set mesh face surface color during lighting, just ignore the irrelevant declaration parts such as objOBJMaterialManager and objCurrentMaterial, this is just an example how I set color while rendering for lighting of a textured mesh surface, to handle Alpha Transparency of a texture or mesh Vertex Color weither for complete or partial transparency or a texture or mesh surface, even for blending colors unless by Vertex Color Only you'd use some form of blending method: Public Shared Sub SetMaterial(ByVal objOBJMaterialManager As OBJMaterialManager, ByVal strMaterialSurfaceName As String) Dim objCurrentMaterial As OBJMaterial = objOBJMaterialManager.GetOBJMaterialByMaterialName(strMaterialSurfaceName) Dim sngAlpha As Single = objCurrentMaterial.GetAlpha 'SET AMBIENT COLOR. Dim vecAmbient As Vector3 = objCurrentMaterial.GetAmbient Dim arrAmbient(3) As Single arrAmbient(0) = vecAmbient.X 'R (Red) arrAmbient(1) = vecAmbient.Y 'G( Green) arrAmbient(2) = vecAmbient.Z 'B (Blue) arrAmbient(3) = sngAlpha 'A (Alpha) glMaterialfv(enumDrawBufferMode.GL_FRONT, enumLighting.GL_AMBIENT, arrAmbient) 'SET DIFFUSE COLOR. Dim vecDiffuse As Vector3 = objCurrentMaterial.GetDiffuse Dim arrDiffuse(3) As Single arrDiffuse(0) = vecDiffuse.X arrDiffuse(1) = vecDiffuse.Y arrDiffuse(2) = vecDiffuse.Z arrDiffuse(3) = sngAlpha 'A (Alpha) glMaterialfv(enumDrawBufferMode.GL_FRONT, enumLighting.GL_DIFFUSE, arrDiffuse) 'SET SPECULAR COLOR. Dim vecSpecular As Vector3 = objCurrentMaterial.GetSpecular Dim arrSpecular(3) As Single arrSpecular(0) = vecDiffuse.X arrSpecular(1) = vecDiffuse.Y arrSpecular(2) = vecDiffuse.Z arrSpecular(3) = sngAlpha 'A (Alpha) glMaterialfv(enumDrawBufferMode.GL_FRONT, enumLighting.GL_SPECULAR, arrSpecular) 'SET SHININESS. Dim sngShininess As Single = objCurrentMaterial.GetShininess glMaterialf(enumDrawBufferMode.GL_FRONT, enumMaterialParameter.GL_SHININESS, sngShininess) End Sub
  9. Knight Chat X

    Collision , then Stop

    Well, anytime you want something to stop, you add logical code to perform a check of when to stop that handles what to do next when something takes place, a trigger point of some sort in code that skips the uneeded/unused portions. Programatically in Flash you can have simple logic to skip sections of code and/or frames or events when something occurs. Flash programming can be a bit tricky to work with due to limitations of language interpretation and flexibility of scripting to work with objects and things which the Flash Development Environment offers. Function or Sub Routine Entry Point: If intCount = 3 Then Goto CheckSkippedBecauseCountEqualledAValueWeDeemedAStoppingPoint 'Perform Check. (Check Ignored when intCount = 3) CheckForSomething CheckSkippedBecauseCountEqualledAValueWeDeemedAStoppingPoint:
  10. Knight Chat X

    Inverse of Modelview Matrix

    You can use: float modelview[16]; glGetFloatv(GL_MODELVIEW_MATRIX, modelview); To get the model view matrix. Then just invert it, an inverse of anything at all just means Inverted, meaning the values are reversed. It'd be easy to keep a copy of the object's matrix, then keep an updated copy of it when it's changed whenever you need to perform some form of operation on it, in this case you are wanting the matrix of two seperate objects. The view object matrix, and the object matrix you wish 2 render are 2 seperate things, the object itself has it's own matrix. So if something were previously a value of 1, it'd be a value of -1 when inverted because the number was originally a positive number and had a value of 1, then it was inverted to a negative number instead which represents -1. Could probably use CG Toolkit to get inverse matrix's like is done here to get Inverse Transpose Matrix: http://www.gamedev.net/community/forums/topic.asp?topic_id=312426 Nothing wrong with using Vector4 for 4x4 matrix or Vector3 for 3x3, the j,k,l to me is just a Vector3 XYZ logically. These might also come in handy: http://www.lighthouse3d.com/opengl/billboarding/index.php?billCheat And Mouse Picking: http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/MousePicking
  11. This might be a little confusing and I might be way off here on what you're trying to accomplish but I'll add some of my own findings and practices here. If This Object Were a Charactor: If the bounding box were to serve as a charactors main bounding box, then the main bounding box shouldn't rotate, you'd just keep the dynamic bounding box point values updated to match the lowest and maximum XYZ range values combined with the charactors current position. Setting an objects start position to always be a 0,0,0 when first loaded you can easily calculate or generate/get the first bounding box values for your charactor. Then as the charactor moves throughout the environment keep those dynamic values updated and re-calculate the bounding box size only when the charactor rotates along the Y-Axis, normally the bounding box will always face the same direction and never rotate even though the charactor rotates, this enables for simpler collision calculations. For instance, if you fired a projectile at a charactor for performance you'd only want to test only mesh bounding box's which are closest to the projectiles position vector, test for collision against the surface of the box or simply check to see if the projectiles position point or sphere radius is within or colliding with the box, if so, perform a Sphere to Polygon collision detection on each polygon of the mesh inside the bounding box, this will be the mesh that's associated with the bounding box you checked. Some Steps I Use For Charactor and Objects Moving or Not: Make sure the bounding box faces the same direction all the time and doesn't rotate with the mesh but keeps the dynamic bounding box information updated on objects that move in an environment and match this to the objects current position. (You'd only need to use 2 vector3's to represent a bounding box, 1 Vector3 to contain the Nearest and Lowest XYZ point of the bounding box, and the Furthest and Highest XYZ point of the bounding box.) Perform Point to Bounding Box collision check for inside and outside bounding box to determine weither or not to perform more detailed check on the mesh associated with that particular bounding box. Perform Sphere to Polygon collision check on each polygon on a mesh when inside the bounding box to determine area of mesh or the mesh surface that has been collided with. For higher accuracy and sensitivity you can use Sphere to Bounding Box collision check on the bounding box's polygons instead of Point to Bounding Box just as you would the mesh, it's basically the Sphere to Polygon collision check only you are assuming the Bounding Box as mesh geometry made up of triangles only and not quads and the same exact test you'd perform on only the mesh is first performed on the bounding box to determine weither or not to check the mesh that's associated with the bounding box for further intersection. You can also use the Sphere to Polygon against bounding box's to determine when to check meshs and perform more detailed collision checks, this can also easily tell you which mesh(s) to check, hope that makes sense. To perform Point to Sphere or Point to Bounding Box collision check just use the Sphere to Polygon check but remove the radius part as you're only checking a point not a sizable radius range for collision. For a Charactor/Object That's Animated: You'd calculate the bounding box for each frame of the animation. Something Extra: If you want the point of intersection to use for things like physics and to reset an object like a charactor or camera to just before an object collided with a mesh or bounding box, such as a wall, it's the position when the collision check took place when it found the intersection, to reset this you'd simply decrement the position when the collision took place with the amount that you moved to get to that point, in other words if your speed was 0.1F you'd subtract the current position XYZ where the collision occured by 0.1F. Of coarse the simplest thing you could do is just save the last position of an object and just re-add that as the current position to an object, that way there's no need to re-calculate anything. For More Detailed Physics Type Check: Perform solid rigid body physics, you'd check each point of for instance a projectile's mesh with the charactor mesh for intersection. The individual points would be checked. You could do Sphere to Sphere, Sphere to Polygon, and Point to Sphere, where in this case you'd create a version of the mesh to check against that had a mass/volume madeup of points that had a given sphere radius for each point throughout the meshes surfaces. Imagine a grid of microscopic bubbles that madeup a meshes surface, or even simpler, bubble wrap packaging you'd use to send a package at the post office, those bubbles are point spheres (points which have and are surrounded by a sphere radius to fill in the gaps). if you add more points spheres/bubbles to represent a physical surface you can get greater detail but a bit slower to calculate, bigger or flatter disk shaped spheres could help.
  12. Knight Chat X

    Getting a gun to move with a player

    I have same problem, and alot of the code samples you find online that show things like a quarternion first person shooter camera don't include samples for how to handle a standard first person shooter gun or projectile with the orientation/rotation for the first person shooter. I worked it out once a long time ago but now are stuck as I can't find the code when I had it working before so it's a stumbling block for me as well now.
  13. Knight Chat X

    Physics Engine - Collision mesh

    You trying to do a more detailed collision detection on a mesh? You can try just using sphere/box/polygon/point on each triangle or quad that makes up a mesh. Sphere to polygon/triangle is nice for camera collision of world and other mesh objects as well as projectiles. Also: Point to Sphere. Point to Polygon/Triangle. Ray/Line Intersection. If you do yourself a point/sphere based volume could be used, you basically convert the known physical polygon into a series of individual point/collision sphere with a defined number and size.
  14. Using Quaternion Camera, how do I make a projectile have same rotation as the camera? I'm using spherical billboarding now to perform this. [Edited by - Knight Chat X on April 14, 2007 12:43:01 AM]
  15. Hello, I'm trying to set a bullet projectile mesh to have the same rotation angle as my first person shooter camera, how do can I get the Heading and Pitch Angles from the camera's Position and View vectors? I'm using OpenGL.
  • 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!