Sign in to follow this  
coderx04

OpenGL Can I use OpenGL in borland?

Recommended Posts

CAn I use opengl in borland C++ builder 6? because Im thinking I just do all the graphic and programming in borland, and I will do the networking with opengl. Is there any way I can use that? thanks

Share this post


Link to post
Share on other sites
openGL is graphics only. not only is it "difficult" to do networking in openGL, it is _impossible_. openGL != Directx. it is graphics only. for networking you'll have to find another API or just write your own basic stuff off of winsock. there are a number of good cross-platform networking libraries out there. look around in the network forum. libcurl comes to mind, only b/c i've used it at work, don't know how applicable it is for games.

-me

Share this post


Link to post
Share on other sites
While it is possible to write general purpose code that runs in the GPU (and interfaced via OpenGL), I see very little incentive to use the said API for the purpose of writing network code - OGL is meant to be a graphics interface, no more, no less.

I recognize the fact that very advanced/dedicated programmers can put the GPU to good use on some networking functions, as it is a parallel stream processor after all. I can't really recommend this for a beginner though [smile]

I second Winsock recommendation if your target platform is Windows.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Nik02
I recognize the fact that very advanced/dedicated programmers can put the GPU to good use on some networking functions, as it is a parallel stream processor after all. I can't really recommend this for a beginner though [smile]

I can't really recommend this at all. The emphasis lies on _stream_ processor, ie. it cannot generate data, it can only manipulate it. The GPU is a parallel vector processor, with very limited data interchange and random access capability, very limited flow control, and without direct writeback to system resources. That's all nice and fine for simple but massive parallel data manipulations that won't require complex dependencies between individual data elements. For example physical state simulation, neural nets, image recognition, cryptography, and so on.

But trying to write network processing code on a GPU would be, bluntly said, pretty retarded. The overhead would be insane. There's hardly anything less adapted to the parallel vector processing nature of a GPU, except for maybe a GPU based keyboard or mouse handler...

Pure networking code (ie. code interfacing with the network card) would be impossible anyway, because the GPU cannot access system IO resources, devices or mapped memory.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
physical state simulation, neural nets, image recognition, cryptography

All of those could be used in networking applications, especially in the context of network games. However, these are very advanced usage for the gpu anyway, hence not recommending them for a beginner. You're right, though, these are not just networking-related technologies in the strictest sense.

Quote:
Pure networking code (ie. code interfacing with the network card) would be impossible anyway, because the GPU cannot access system IO resources, devices or mapped memory.

True that. To read back the results of GPU calculations, the program would download the data back to system memory and proceed from there.

By the way, today's professional GPUs have very good programmability, flow control and such. It is possible to run quite complex programs even on per-fragment basis on, say, nVidia's Quadro FX series (and, to slightly lighter extent, on the current consumer models such as GF6 and GFFX series).

Share this post


Link to post
Share on other sites
Quote:

CAn I use opengl in borland C++ builder 6?

because Im thinking I just do all the graphic and programming in borland, and I will do the networking with opengl.

Is there any way I can use that?
thanks



Im sorry but why anyone would want to use a Graphics API for Networking, just a bad idea. Use Direct-Play (whatever DirectX's networking game API is or Winsock (prob harder to use than DirectPlay as you need to write the handling code for the data you get in). Easily workable with OpenGL.

Ive used DirectInput, DirectSound with OpenGL, they work really well, no reason why DirectPlay is any different.

Personally though Id use Visual C++ 7.0 up (thats .NET), its very good by now.

Keith

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:

All of those could be used in networking applications, especially in the context of network games. However, these are very advanced usage for the gpu anyway, hence not recommending them for a beginner. You're right, though, these are not just networking-related technologies in the strictest sense.

Processing data received through a network link doesn't count as network processing. The data stream could come from anywhere. When talking about game related network processing, I thought more about things like lowlevel UDP packet scheduling, stream sync, error corrections, data prioritization. All things pretty impossible on a GPU (well, not impossible per se, but with an efficiency comparable of doing it by hand on a calculator...)

I mean, if not using UDP, there's not much about networking anyway. Everything is handled by the OS. Opening up a TCP stream is something like 5 lines of code. The main idea of a network library is to either handle it more low level (UDP, raw packets, whatever), or to provide an abstract (perhaps multi platform) interface to system dependent calls. HawkNL (formerly OpenNL, they got into trademark trouble) I linked to above does the former, and POSIX style sockets do the latter. Or just use Winsock if you neither care about speed nor multi platform compatibility.

Quote:

By the way, today's professional GPUs have very good programmability, flow control and such. It is possible to run quite complex programs even on per-fragment basis on, say, nVidia's Quadro FX series (and even on the current consumer models such as GF6800).

Compared to a modern CPU, programmability and flow control of todays GPUs are still ridiculous. But that's not their job. A GPUs job is to execute relatively simple programs at maximum speed and parallelism. Going further than that, you'd suddendly have a second CPU where your specialized GPU used to be. Not saying that this won't happen anyway in the future (multiple CPU cores with dynamic load balancing doing everything, ie. the return of the software renderer). But currently, that's not the case.

Woah, this thread went offtopic pretty fast.

Share this post


Link to post
Share on other sites
Owww.. Soory because this is my first time using OPENGL. I were using Borland before .. And with my Profesor Library..

But his library doesnt support networking..
And borland builder really bad with networking..

So my question now change, Can i use directx in BORland C++ builder 6?

thanks for all your reply. ..

Share this post


Link to post
Share on other sites
Yes, you can. In case you decide to use d3d as well, in addition to DirectPlay, consider this (quoted from the DX SDK):

Quote:

Compilers from Borland report floating-point exceptions in a manner that is incompatible with Direct3D. To solve this problem, include a _matherr exception handler like the following:


// Borland floating point initialization
#include <math.h>
#include <float.h>

void initfp(void)
{
// Disable floating point exceptions
_control87(MCW_EM,MCW_EM);
}

int _matherr(struct _exception *e)
{
e; // Dummy reference to catch the warning
return 1; // Error has been handled
}



EDIT: Sorry for polluting the OpenGL board with DX stuff [smile]

Having said that, winsock and other networking libraries should work fine also - I don't really see a problem with Borland not supporting networking!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Announcements

  • Forum Statistics

    • Total Topics
      628354
    • Total Posts
      2982243
  • Similar Content

    • By test opty
      Hi all,
       
      I'm starting OpenGL using a tut on the Web. But at this point I would like to know the primitives needed for creating a window using OpenGL. So on Windows and using MS VS 2017, what is the simplest code required to render a window with the title of "First Rectangle", please?
       
       
    • By DejayHextrix
      Hi, New here. 
      I need some help. My fiance and I like to play this mobile game online that goes by real time. Her and I are always working but when we have free time we like to play this game. We don't always got time throughout the day to Queue Buildings, troops, Upgrades....etc.... 
      I was told to look into DLL Injection and OpenGL/DirectX Hooking. Is this true? Is this what I need to learn? 
      How do I read the Android files, or modify the files, or get the in-game tags/variables for the game I want? 
      Any assistance on this would be most appreciated. I been everywhere and seems no one knows or is to lazy to help me out. It would be nice to have assistance for once. I don't know what I need to learn. 
      So links of topics I need to learn within the comment section would be SOOOOO.....Helpful. Anything to just get me started. 
      Thanks, 
      Dejay Hextrix 
    • By mellinoe
      Hi all,
      First time poster here, although I've been reading posts here for quite a while. This place has been invaluable for learning graphics programming -- thanks for a great resource!
      Right now, I'm working on a graphics abstraction layer for .NET which supports D3D11, Vulkan, and OpenGL at the moment. I have implemented most of my planned features already, and things are working well. Some remaining features that I am planning are Compute Shaders, and some flavor of read-write shader resources. At the moment, my shaders can just get simple read-only access to a uniform (or constant) buffer, a texture, or a sampler. Unfortunately, I'm having a tough time grasping the distinctions between all of the different kinds of read-write resources that are available. In D3D alone, there seem to be 5 or 6 different kinds of resources with similar but different characteristics. On top of that, I get the impression that some of them are more or less "obsoleted" by the newer kinds, and don't have much of a place in modern code. There seem to be a few pivots:
      The data source/destination (buffer or texture) Read-write or read-only Structured or unstructured (?) Ordered vs unordered (?) These are just my observations based on a lot of MSDN and OpenGL doc reading. For my library, I'm not interested in exposing every possibility to the user -- just trying to find a good "middle-ground" that can be represented cleanly across API's which is good enough for common scenarios.
      Can anyone give a sort of "overview" of the different options, and perhaps compare/contrast the concepts between Direct3D, OpenGL, and Vulkan? I'd also be very interested in hearing how other folks have abstracted these concepts in their libraries.
    • By aejt
      I recently started getting into graphics programming (2nd try, first try was many years ago) and I'm working on a 3d rendering engine which I hope to be able to make a 3D game with sooner or later. I have plenty of C++ experience, but not a lot when it comes to graphics, and while it's definitely going much better this time, I'm having trouble figuring out how assets are usually handled by engines.
      I'm not having trouble with handling the GPU resources, but more so with how the resources should be defined and used in the system (materials, models, etc).
      This is my plan now, I've implemented most of it except for the XML parts and factories and those are the ones I'm not sure of at all:
      I have these classes:
      For GPU resources:
      Geometry: holds and manages everything needed to render a geometry: VAO, VBO, EBO. Texture: holds and manages a texture which is loaded into the GPU. Shader: holds and manages a shader which is loaded into the GPU. For assets relying on GPU resources:
      Material: holds a shader resource, multiple texture resources, as well as uniform settings. Mesh: holds a geometry and a material. Model: holds multiple meshes, possibly in a tree structure to more easily support skinning later on? For handling GPU resources:
      ResourceCache<T>: T can be any resource loaded into the GPU. It owns these resources and only hands out handles to them on request (currently string identifiers are used when requesting handles, but all resources are stored in a vector and each handle only contains resource's index in that vector) Resource<T>: The handles given out from ResourceCache. The handles are reference counted and to get the underlying resource you simply deference like with pointers (*handle).  
      And my plan is to define everything into these XML documents to abstract away files:
      Resources.xml for ref-counted GPU resources (geometry, shaders, textures) Resources are assigned names/ids and resource files, and possibly some attributes (what vertex attributes does this geometry have? what vertex attributes does this shader expect? what uniforms does this shader use? and so on) Are reference counted using ResourceCache<T> Assets.xml for assets using the GPU resources (materials, meshes, models) Assets are not reference counted, but they hold handles to ref-counted resources. References the resources defined in Resources.xml by names/ids. The XMLs are loaded into some structure in memory which is then used for loading the resources/assets using factory classes:
      Factory classes for resources:
      For example, a texture factory could contain the texture definitions from the XML containing data about textures in the game, as well as a cache containing all loaded textures. This means it has mappings from each name/id to a file and when asked to load a texture with a name/id, it can look up its path and use a "BinaryLoader" to either load the file and create the resource directly, or asynchronously load the file's data into a queue which then can be read from later to create the resources synchronously in the GL context. These factories only return handles.
      Factory classes for assets:
      Much like for resources, these classes contain the definitions for the assets they can load. For example, with the definition the MaterialFactory will know which shader, textures and possibly uniform a certain material has, and with the help of TextureFactory and ShaderFactory, it can retrieve handles to the resources it needs (Shader + Textures), setup itself from XML data (uniform values), and return a created instance of requested material. These factories return actual instances, not handles (but the instances contain handles).
       
       
      Is this a good or commonly used approach? Is this going to bite me in the ass later on? Are there other more preferable approaches? Is this outside of the scope of a 3d renderer and should be on the engine side? I'd love to receive and kind of advice or suggestions!
      Thanks!
    • By nedondev
      I 'm learning how to create game by using opengl with c/c++ coding, so here is my fist game. In video description also have game contain in Dropbox. May be I will make it better in future.
      Thanks.
  • Popular Now