[QUOTE=daigennki;52826989]Trying to use GLSL instead of the fixed pipeline in my game engine using SDL and OpenGL, the shader compiles successfully and works as expected when I specify OpenGL 3.1 or earlier
[code]SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);[/code]
but when I specify 3.2 or later
[code]SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);[/code]
the window is just black even though the shader still seems to compile successfully and there are no errors. I know that the fixed pipeline was completely deprecated in 3.2, but I am fairly certain that I got rid of any deprecated code. What did I do wrong?[/QUOTE]
OpenGL 3.2 released the concept of core and compatibility profiles.
What version of GLSL are you using? Core profiles do not support GLSL 1.40 (OpenGL 3.1) or earlier.
[QUOTE=Karmah;52827402]Does your computer support 3.2? Like are you running a really old gpu or integrated graphics chip?
What opengl profile is being set? You could still be using deprecated code + a strict no backwards-compatibility profile[/QUOTE]
[QUOTE=elevate;52827586]OpenGL 3.2 released the concept of core and compatibility profiles.
What version of GLSL are you using? Core profiles do not support GLSL 1.40 (OpenGL 3.1) or earlier.[/QUOTE]
It is a computer I built earlier last year with completely new parts. Core i7-6700K and Radeon R9 390 with Windows 8.1 Pro, so there is no way it does not support it. Same thing happens on my laptop that has Core i5-7200U and HD Graphics 620 with Windows 10 Pro which I bought at the end of last year.
I am not sure what OpenGL profile is being set.
[QUOTE=paindoc;52827513]I saw your messages on steam as I was turning my computer off last night (Destiny is absorbing my life help) :V
Debug the program in renderdoc: this will let you see what commands are even being submitted, if any.[/QUOTE]
Haha, no worries. Debugged it with RenderDoc, looks like I was accidentally still using a lot of deprecated code (glMatrixMode, glLoadIdentity, etc...). Also looks like I was using glEnable and glDisable with deprecated enums, and I did not explicitly set the profile with
[code]SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE)[/code]. However it looks like the one that had the most impact was using glDrawArrays without a VAO. Guess I have to learn how to use those. Thank you, I will use RenderDoc from now on.
can someone recommend me some good books to get? doesn't need to be about programming, anything relating to computer science and emerging technologies would be great as well as more business and management related books (relating to the information tech industry). i'd also love some books on machine learning and intelligent systems.
i've decided i want to start reading because i was never into reading and want books that i'd be able to make it through and learn something.
[editline]28th October 2017[/editline]
also blogs and other web resources would be highly appreciated. i just want to do a bunch of research so i can figure out what direction i want to move my career.
[QUOTE=Pat.Lithium;52829631]can someone recommend me some good books to get? doesn't need to be about programming, anything relating to computer science and emerging technologies would be great as well as more business and management related books (relating to the information tech industry). i'd also love some books on machine learning and intelligent systems.
i've decided i want to start reading because i was never into reading and want books that i'd be able to make it through and learn something.
[editline]28th October 2017[/editline]
also blogs and other web resources would be highly appreciated. i just want to do a bunch of research so i can figure out what direction i want to move my career.[/QUOTE]
If you don't already know JS then [URL="http://eloquentjavascript.net/"]Eloquent JavaScript[/URL] is very good.
Note that it's for a slightly older version of JS than is current now.
ok this is kinda weird, but has anyone ever visual studio delete a file and then say it can't find the file when trying to build?
Working on updating my ECS and I want to update it to add more customization points to it. The main points I am thinking of customizing is containers and/or allocators. I use these containers currently:
A flat map for entity->component
A flat set to store all entities
A flat map to go grouping id -> flat set of entities (these are groupings, which are used to speed up entity look ups)
A vector to return entities when requested
For the entity->component mapping, I would like that to be fully customizable, because it makes a lot of sense for the end user to control how their components should be stored. Having just allocator support seems weak.
For the groupings and the set that stores all entities (which is really just a grouping with no constraints), I was thinking of how feasible it is to customize the container. While the user would be able to specify the type of container to use for entities (as this can be captured by the template arguments of the manager), doing the same for groupings is not as easy as groupings can be added and removed dynamically. This can of course be changed to cause the user to predefine all groupings and use those as a template argument, but always having a grouping is not a zero cost operation as it has to be maintained. The alternative is to use polymorphic containers, but that is a lot of work and won't let you use something like std::vector out of the box. To add allocator support I would need to use a polymorphic allocator which is reasonable enough.
The vector returning entities when requested is the least of my concerns and will either suffice to use a custom allocator or I might cut out this functionality entirely since it feels strict inferior to another pattern (for_each with a callable).
Now although I sort of have what I want figure out, I am not sure if this is the best idea. Is there too little custom container support? Or is it overkill? Finally, when supporting either custom containers or custom allocators, there needs to be a way to initialize these structures, and I am not sure what the best way to do that would be. An example is if the container for some component is not default constructible. How should that be dealt with?
I have similar customization points planned for the event portion of the library, but I would like to nail down this portion first and figure out what my design goals are. If there is any nice readings on this subject that would be great too. This idea was partially inspired by this talk: [url]https://www.youtube.com/watch?v=WsUnnYEKPnI[/url]
Edit: After some more reading, the Container and AllocatorAwareContainer requires that the container is default constructible. This makes it a little easier, but there is no way to access the container for the end user as written. This may be fine since they have full control of construction (and thus can inject whatever is needed, although it may be a bit dirty).
[QUOTE=WTF Nuke;52843157]For the entity->component mapping, I would like that to be fully customizable, because it makes a lot of sense for the end user to control how their components should be stored. Having just allocator support seems weak.[/QUOTE]
100% yes
[QUOTE=WTF Nuke;52843157]Now although I sort of have what I want figure out, I am not sure if this is the best idea. Is there too little custom container support? Or is it overkill?[/QUOTE]
I don't feel like it's all that necessary (except for entity->component mapping, that would be nice), if I needed to use a different container I would just modify the source directly.
What about setting an allocator for all groupings? It would be a polymorphic allocator so that the type wouldn't change. Thanks for the feedback btw.
[QUOTE=WTF Nuke;52843157]
The vector returning entities when requested is the least of my concerns and will either suffice to use a custom allocator or I might cut out this functionality entirely since it feels strict inferior to another pattern (for_each with a callable).
[/QUOTE]
Noooooonononono don't cut that - redundancy is a good thing sometimes and this is one of the cases where it really is. Had lots of use cases recently where I was doing exactly that thing and getting an array of something vs having some kind of for_each with a callable was the nicer thing to have in some cases. Actually most of the cases. Just have both. And a custom allocator for that sounds completely fine.
[QUOTE=JerryK;52843017]ok this is kinda weird, but has anyone ever visual studio delete a file and then say it can't find the file when trying to build?[/QUOTE]
Wouldn't this make sense? If you delete it, it's not there anymore, thus it can't find it? You might need to give more information. Is this a file that is generated during compilation/building?
I've had dll's go missing before, but thats because they exist in the file system but visual studio does not include them in the project.
[QUOTE=brianosaur;52844660]Wouldn't this make sense? If you delete it, it's not there anymore, thus it can't find it? You might need to give more information. Is this a file that is generated during compilation/building?
I've had dll's go missing before, but thats because they exist in the file system but visual studio does not include them in the project.[/QUOTE]
sounds like it was removed outside of the IDE - so its still listed in "ClCompile" in the vcxproj file, and stops the compile when it reaches that file
just open up the vcxproj file and remove the file in question, its XML and easy to do
Trying to figure out why this mesh is not drawing in OpenGL, RenderDoc tells me that all of the indices in the element buffer are 3722304989 (0xDDDDDDDD) for some reason. Why is that? I definitely gave it vertex information with
[code] glBindBuffer(GL_ARRAY_BUFFER, buffers[0]);
glBufferData(GL_ARRAY_BUFFER, vertPos.size() * sizeof(Vec3f), &vertPos[0], GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers[3]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, iVerts.size() * sizeof(unsigned int), &iVerts[0], GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, nullptr);
glEnableVertexAttribArray(0);[/code]
and I did make sure the buffers were generated, and that all of the vertices and indices I am giving glBufferData are valid at the time I call those functions. RenderDoc tells me that the actual vertex coordinates corresponding to each vertex index are exactly what I gave it too, just the element buffer does not have the correct indices.
I'm pretty sure that you need a glVertexAttribPointer for every distinct buffer.
[code]
glBindBuffer(GL_ARRAY_BUFFER, buffers[0]);
glBufferData(GL_ARRAY_BUFFER, vertPos.size() * sizeof(Vec3f), &vertPos[0], GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, nullptr); // vertices are first element
// whatever your second and third array elements are
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers[3]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, iVerts.size() * sizeof(unsigned int), &iVerts[0], GL_STATIC_DRAW);
glVertexAttribIPointer(3, 1, GL_UNSIGNED_INT, 0, nullptr); // made this attrib i as your indices are unsigned integers
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);
glEnableVertexAttribArray(3);
[/code]
[QUOTE=Karmah;52851957]I'm pretty sure that you need a glVertexAttribPointer for every distinct buffer.
[code]
glBindBuffer(GL_ARRAY_BUFFER, buffers[0]);
glBufferData(GL_ARRAY_BUFFER, vertPos.size() * sizeof(Vec3f), &vertPos[0], GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, nullptr); // vertices are first element
// whatever your second and third array elements are
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffers[3]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, iVerts.size() * sizeof(unsigned int), &iVerts[0], GL_STATIC_DRAW);
glVertexAttribIPointer(3, 1, GL_UNSIGNED_INT, 0, nullptr); // made this attrib i as your indices are unsigned integers
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);
glEnableVertexAttribArray(3);
[/code][/QUOTE]
Weird, that did not work, same result as before. Still full of 0xDDDDDDDD. :s:
[editline]4th November 2017[/editline]
Oh, just got it to work, I was unbinding the buffers before unbinding the vertex array object, if I do it after it works now. Sorry to bother. Also it seems it works without glVertexAttribPointer for the indices.
You can also delete the buffers as well (presuming you don't intend on reusing them in any other VAO).
They won't actually delete because they are in use by the VAO, but whenever you delete the VAO they will then also get deleted.
I suggest not deleting the buffers, you'll probably get really hard to trace bugs eventually. Just manage lifetimes properly.
imo a lot of older OpenGL stuff is a pain throughout your use of it: DSA and 4.5+ OpenGL has a higher learning curver but its much nicer after that.
good guide on example DSA stuff here [url]https://github.com/Fennec-kun/Guide-to-Modern-OpenGL-Functions[/url]
[QUOTE=paindoc;52853667]imo a lot of older OpenGL stuff is a pain throughout your use of it: DSA and 4.5+ OpenGL has a higher learning curver but its much nicer after that.
good guide on example DSA stuff here [url]https://github.com/Fennec-kun/Guide-to-Modern-OpenGL-Functions[/url][/QUOTE]
Sounds good, but unfortunately my laptop only supports 4.4. Thanks though.
I'm working on a multiplayer bot for Half-Life and other mods.
Everything is working fine on Windows for Opposing Force but on Linux I get a crash because of an undefined symbol (the mangled equivalent of bot_t::GetSkill I think). If I make OpposingForceBot inherit bot_t instead of HalfLifeBot then it doesn't crash.
Declarations at [url]https://github.com/tschumann/sandbot/blob/v0.4.1/dlls/bot.h[/url] and definitions at [url]https://github.com/tschumann/sandbot/blob/v0.4.1/dlls/bot_halflife.cpp[/url] and [url]https://github.com/tschumann/sandbot/blob/v0.4.1/dlls/bot_opposingforce.cpp[/url]
[url]https://github.com/tschumann/sandbot/blob/v0.4.1/dlls/Makefile[/url] is the Makefile if that helps (which I'm tempted to think is the problem given that it's okay on Windows).
Any ideas?
[QUOTE=-Xemit-;52865217]What are the best resources for learning all that node.js business? I'm pretty much clueless about it all and would like to learn so I can get a sweet sweet non-physical job[/QUOTE]
What's your current programming knowledge (scifically!)? Do you already know JavaScript?
I really wanna know how machine learning works. Are there any good sources anyone could recommend?
For reference, I'm currently working on some poker game in c# in my spare time to brush up my skills, I want to write some AI that learns about each player's behaviour; willingness to bluff, how much they fold under which circumstance, etc.
Hey guys, new to programming and what not. For my first functional test script I intend on creating a program in python to scrape all the websites I owe bills for and list what I owe in a prompt. I am currently reading up on how to web scrape using python and I am having difficulty with the logging in process on some websites. I don't believe this is successfully logging in. Any clues?
[code]
import requests
import bs4 as bs
import urllib.request
with requests.Session() as c:
url = 'https://login.comcast.net/login'
USERNAME = 'insertyourusernamehere'
PASSWORD = 'insertyourpasswordhere'
token = "insertyourtokenhere"
c.get(url)
login_data = dict(reqID=token, user=USERNAME, passwd=PASSWORD, next='/')
c.post(url, data=login_data, headers={"Referer": "url"})
page = c.get("https://customer.xfinity.com/#/billing")
soup = bs.BeautifulSoup(page.content, 'html.parser')
balance= soup.find('sub', attrs={'class': 'bill-overview__total--dollars'})
print(soup.contents)
[/code]
This one is obviously specific to comcast/xfinity.
[QUOTE=Zaex;52870627]Hey guys, new to programming and what not. For my first functional test script I intend on creating a program in python to scrape all the websites I owe bills for and list what I owe in a prompt. I am currently reading up on how to web scrape using python and I am having difficulty with the logging in process on some websites. I don't believe this is successfully logging in. Any clues?
[code]
import requests
import bs4 as bs
import urllib.request
with requests.Session() as c:
url = 'https://login.comcast.net/login'
USERNAME = 'insertyourusernamehere'
PASSWORD = 'insertyourpasswordhere'
token = "insertyourtokenhere"
c.get(url)
login_data = dict(reqID=token, user=USERNAME, passwd=PASSWORD, next='/')
c.post(url, data=login_data, headers={"Referer": "url"})
page = c.get("https://customer.xfinity.com/#/billing")
soup = bs.BeautifulSoup(page.content, 'html.parser')
balance= soup.find('sub', attrs={'class': 'bill-overview__total--dollars'})
print(soup.contents)
[/code]
This one is obviously specific to comcast/xfinity.[/QUOTE]
What makes you think it's not logging in? Can you see what the response of c.post is?
[QUOTE=Zaex;52870627]Hey guys, new to programming and what not. For my first functional test script I intend on creating a program in python to scrape all the websites I owe bills for and list what I owe in a prompt. I am currently reading up on how to web scrape using python and I am having difficulty with the logging in process on some websites. I don't believe this is successfully logging in. Any clues?
[code]
import requests
import bs4 as bs
import urllib.request
with requests.Session() as c:
url = 'https://login.comcast.net/login'
USERNAME = 'insertyourusernamehere'
PASSWORD = 'insertyourpasswordhere'
token = "insertyourtokenhere"
c.get(url)
login_data = dict(reqID=token, user=USERNAME, passwd=PASSWORD, next='/')
c.post(url, data=login_data, headers={"Referer": "url"})
page = c.get("https://customer.xfinity.com/#/billing")
soup = bs.BeautifulSoup(page.content, 'html.parser')
balance= soup.find('sub', attrs={'class': 'bill-overview__total--dollars'})
print(soup.contents)
[/code]
This one is obviously specific to comcast/xfinity.[/QUOTE]
Just taking a quick look at that login page I see a captcha which is probably your issue.
So I've set up my Raspberry PI with a Mariadb database, I SSH into the PI and all, but whenever I try to connect to Mariadb with Navicat I get this:
[t]https://i.imgur.com/6YqxjOf.png[/t]
I've set up port forwarding and everything
[QUOTE=gokiyono;52876726]So I've set up my Raspberry PI with a Mariadb database, I SSH into the PI and all, but whenever I try to connect to Mariadb with Navicat I get this:
[t]https://i.imgur.com/6YqxjOf.png[/t]
I've set up port forwarding and everything[/QUOTE]
Does the firewall allow the port? Should be 3306 by default.
[QUOTE=SataniX;52872846]Just taking a quick look at that login page I see a captcha which is probably your issue.[/QUOTE]
Makes sense. Kinda irritating. I was excited to make my first actually useful program rather than a bunch of test non useful ones... Thanks for the help.
I'm not good at optimization, anything wrong here? It's networking code so I want it to be relatively fast.
[code]
public static MemoryStream Serialize<T>(Event ev, T obj) //Where T has attribute ProtoContract
{
var ms = new MemoryStream();
var eventBytes = BitConverter.GetBytes((uint)ev);
ms.Write(eventBytes, 0, eventBytes.Length);
Serializer.Serialize<T>(ms, obj);
return ms;
}
public static Tuple<Event,T> Deserialize<T>(MemoryStream ms) //Where T has attribute ProtoContract
{
using (var sr = new BinaryReader(ms))
{
var buffer = new byte[sizeof(uint)];
var e = (Event) sr.Read(buffer, 0, sizeof(uint));
ms.Seek(sizeof(uint), SeekOrigin.Begin);
var ne = Serializer.Deserialize<T>(ms);
return new Tuple<Event, T>(e,ne);
}
}
[/code]
[QUOTE=reevezy67;52882029]I'm not good at optimization, anything wrong here? It's networking code so I want it to be relatively fast.
[code]
public static MemoryStream Serialize<T>(Event ev, T obj) //Where T has attribute ProtoContract
{
var ms = new MemoryStream();
var eventBytes = BitConverter.GetBytes((uint)ev);
ms.Write(eventBytes, 0, eventBytes.Length);
Serializer.Serialize<T>(ms, obj);
return ms;
}
public static Tuple<Event,T> Deserialize<T>(MemoryStream ms) //Where T has attribute ProtoContract
{
using (var sr = new BinaryReader(ms))
{
var buffer = new byte[sizeof(uint)];
var e = (Event) sr.Read(buffer, 0, sizeof(uint));
ms.Seek(sizeof(uint), SeekOrigin.Begin);
var ne = Serializer.Deserialize<T>(ms);
return new Tuple<Event, T>(e,ne);
}
}
[/code][/QUOTE]
Well for one thing, it all comes down to how your Serializer methods are implemented. These ones you posted are actually perfect for MemoryStream extensions, I always recommend handling streams yourself so you keep track of their lifetime. For your Deserialize method, using a BinaryReader to read the first 4 bytes is silly, especially since you can just use BitConverter.ToUInt32!
Now, depending on how your Serializer methods are implemented, it would be much better if you passed in the raw byte[] data itself, rather than a MemoryStream. You want it to be relatively fast? That's how you do it.
Here's some code I frequently use, maybe it'll help you out a little bit. Just make sure you put them in a good place, like a static class called "StreamExtensions" since they're for a Stream.
[code]/*
Read/write Stream extensions
*/
public static T Read<T>(this Stream stream)
{
var length = Marshal.SizeOf(typeof(T));
return stream.Read<T>(length);
}
public static T Read<T>(this Stream stream, int length)
{
var data = new byte[length];
var ptr = Marshal.AllocHGlobal(length);
stream.Read(data, 0, length);
Marshal.Copy(data, 0, ptr, length);
var t = (T)Marshal.PtrToStructure(ptr, typeof(T));
Marshal.FreeHGlobal(ptr);
return t;
}
public static void Write<T>(this Stream stream, T data)
{
var length = Marshal.SizeOf(typeof(T));
Write<T>(stream, data, length);
}
public static void Write<T>(this Stream stream, T data, int length)
{
// this might be extremely unsafe to do, but it should work fine
var buffer = new byte[length];
var pData = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0);
Marshal.StructureToPtr(data, pData, false);
stream.Write(buffer, 0, length);
}[/code]
And here's some copy methods you can use as well, they fit well in a static "Memory" class:
[code]/*
Memory copy methods
*/
public static byte[] Copy<T>(T srcData, int length)
{
return Copy(srcData, 0, length);
}
public static byte[] Copy<T>(T srcData, int srcOffset, int length)
{
var data = new byte[length];
var ptr = GCHandle.Alloc(srcData, GCHandleType.Pinned);
Marshal.Copy(ptr.AddrOfPinnedObject(), data, srcOffset, length);
ptr.Free();
return data;
}[/code]
I should mention that my serialize methods are protobuf-net so I have no control over them. I didn't really want to write my own serialization, I'm not that starved for resources.
I'll swap out the BinaryReader though, not sure how I missed that.
Cheers
Sorry, you need to Log In to post a reply to this thread.