We should create a new thread though, I hate having the same thread all the time.
[QUOTE=ROBO_DONUT;32043049]So no highlights? :([/QUOTE]
The last LMAO thread in Fast Threads was closed at around 300. So there is still hope!
[QUOTE=esalaka;32043055]IF someone makes a new OP we could get Overv or someone to lock this one.[/QUOTE]
I think Overv offered to do this a while back if someone got some highlights for him.
Well my opengl apparently just broke on my computer or something, now GL.UseProgram is just throwing InvalidOperation errors for no reason. It worked literally 4 hours ago, now it doesn't. I've stripped it down to the skeleton project, GL.UseProgram just doesn't work at all anymore.
[editline]31st August 2011[/editline]
But exe's previously compiled that use GL.UseProgram still work, as do opengl games such as minecraft.
[QUOTE=thomasfn;32043188]Well my opengl apparently just broke on my computer or something, now GL.UseProgram is just throwing InvalidOperation errors for no reason. It worked literally 4 hours ago, now it doesn't. I've stripped it down to the skeleton project, GL.UseProgram just doesn't work at all anymore.
[editline]31st August 2011[/editline]
But exe's previously compiled that use GL.UseProgram still work, as do opengl games such as minecraft.[/QUOTE]
Are you outputting shader info? Because invalid operation error could be a shader error.
Now this is a weird bug
[img]http://www.borisu.djoamersfoort.nl/huh.png[/img]
I was going to do random ascii noise, seems like the true booleans don't want to be false.
[QUOTE=uitham;32043219]seems like the [B]true[/B] booleans don't want to be [B]false[/B].[/QUOTE]
Uhm? :v:
[QUOTE=Dr Magnusson;32043277]Uhm? :v:[/QUOTE]
In other words, I forgot to clear the array after each line
Hi guys, I posted this in the Lua section WAYWO but I fell you guys will appreciate it more. I made a class loading back end in Lua (all vanilla functions), here goes.
It supports having one class act as a base to another and override the class name which is normally derived from the file name as well as the global constructor name.
[B]Classloader.lua[/B]
[lua]
classes = {}
local readdir = "lua/classes/"
local savedclasses = {}
function classes.SetDirectory( SDirectory ) -- sets the directory the class loader reads from, default is lua/classes
if string.sub(SDirectory, #SDirectory - 1) == "/" then
readdir = SDirectory
else
readdir = SDirectory .. "/"
end
end
function classes.GetDirectory()
return readdir
end
function classes.LoadClasses()
local found = file.Find(readdir .. "*.lua" ,true)
local classname
local includedir
local constructorname
for _ , File in pairs( found ) do
CLASS = {}
includedir = string.gsub(readdir..File , "lua/" , "")
include(includedir)
classname = CLASS.Name or string.gsub(File,".lua","")
savedclasses[classname] = includedir
if CLASS.Base then
setmetatable(CLASS, _G[CLASS.Base])
end
CLASS.__index = CLASS
CLASS.__tostring = function(self) return classname.."\t"..tostring(self) end
constructorname = CLASS.ConstructorName or "Create"..classname
_G[constructorname] = function(...)
local instance = {}
setmetatable( instance , _G[classname] )
instance:Constructor(...)
return instance
end
_G[classname] = CLASS
CLASS = nil
end
end
function classes.Reload()
for classname , includedir in pairs(savedclasses) do
CLASS = {}
savedclasses[classname] = includedir
include(includedir)
if CLASS.Base then
setmetatable(CLASS, _G[CLASS.Base])
end
CLASS.__index = CLASS
CLASS.__tostring = function(self) return classname.."\t"..tostring(self) end
constructorname = CLASS.ConstructorName or "Create"..classname
_G[constructorname] = function(...)
local instance = {}
setmetatable( instance , _G[classname] )
instance:Constructor(...)
return instance
end
_G[classname] = CLASS
CLASS = nil
end
end
local ignorefiles = {}
local curclass
local function LoadClass( src )
if ignorefiles[src] then
CLASS = {}
curclass = CLASS
includedir = string.gsub(src , "lua\\" , "")
local classname = CLASS.Name or string.match(string.gsub(src,".lua","") , "([%w_]+)$" )
savedclasses[classname] = includedir
include(includedir)
if CLASS.Base then
setmetatable(CLASS, _G[CLASS.Base])
end
CLASS.__index = CLASS
CLASS.__tostring = function(self) return classname.."\t"..tostring(self) end
constructorname = CLASS.ConstructorName or "Create"..classname
_G[constructorname] = function(...)
local instance = {}
setmetatable( instance , _G[classname] )
instance:Constructor(...)
return instance
end
_G[classname] = CLASS
CLASS = nil
end
end
function classes.New()
local src = debug.getinfo(2, "S").short_src
if !ignorefiles[src] then
ignorefiles[src] = true
LoadClass(src)
error("",-1) // silent error hack
else
return curclass
end
end
NewClass = classes.New
[/lua]
and a file that uses the classes.New() function
[B]timers2.lua[/B]
[lua]
local CurTime = CurTime
local CLASS = classes.New()
CLASS.ConstructorName = "CreateTimer2" -- option to override the constructor functions name, normally it would be based on the file's name
-- called like "local timer = CreateTime( TimeLeft) "
function CLASS:Constructor(timeleft)
self._timeleft = CurTime() + timeleft
end
function CLASS:SetTimeLeft(timeleft)
self._timeleft = CurTime() + timeleft
end
function CLASS:GetTimeLeft()
if !self.stopped then
return self._timeleft - CurTime()
else
return self._stoptime
end
end
CLASS.GetTime = CLASS.GetTimeLeft -- just an alias
function CLASS:Stop()
self._stoptime = self:GetTimeLeft()
self.stopped = true
end
function CLASS:Start()
self._timeleft = CurTime() + self._stoptime
self.stopped = false
end
function CLASS:Reset()
self._timeleft = self._starttime + CurTime()
end
function CLASS:Format()
return string.FormattedTime( self:GetTime(), "%02i:%02i") or "0:00"
end
[/lua]
Example use
[lua]
local t = CreateTimer2(10) -- creates a timer with 10 seconds on it
print(t:Format()) -- 00:10
[/lua]
So, what do you think?
[QUOTE=Darwin226;32043206]Are you outputting shader info? Because invalid operation error could be a shader error.[/QUOTE]
This is my code:
[code]int id = GL.CreateProgram();
GL.UseProgram(id);[/code]
The error is being thrown (well, populated inside GL.GetError()) at the second line. Before anything about the shaders themselves is even loaded. I've confirmed it's UseProgram and not CreateProgram causing the error, and I've confirmed CreateProgram is outputting a valid ID (1).
[editline]31st August 2011[/editline]
I've also tried doing the code in different locations. For example in the loading stage, in the render loop etc. No dice.
there seems to be a problem when inheritng from one class when the base class doesn't exist yet, I am fixing it now.
[editline]31st August 2011[/editline]
broke my automerge :(
(Tired so this explanation probably sucks.)
Just one of those things that gets hiddens and you never really think about (at least I never did).
var list = somelist.Where(i => i.Tag == "Lambdas Rock");
'Where' does not return a collection. It returns a WhereEnumerableIterator/etc class which inherits IEnumerable. So when you use the 'list' it is actually going through 'somelist' and finding the elements that match.
Which actually now that I think about it. If you are using 'list' in multiple locations it could end up slowing down things because it is having to compare multiple times to get the elements again.
I had a little game idea for when I've finished open.gl. Basically you're stranded on some random planet and you need to build a base and survive as long as possible. You need to manage mining operations to gain money and buy new parts for your base, like air vents and extra security. From time to time asteroids rain down on your planet, equipment randomly fails or hostiles attack.
You need to construct a good base with proper fail-safes to handle all that. For example, an asteroid could wipe out your generator/reactor room and you'll lose electricity. A properly designed base would have emergency power or a system that makes sure oxygen doesn't flow away into the hole in your base.
[QUOTE=Overv;32043545]I had a little game idea for when I've finished open.gl. Basically you're stranded on some random planet and you need to build a base and survive as long as possible. You need to manage mining operations to gain money and buy new parts for your base, like air vents and extra security. From time to time asteroids rain down on your planet, equipment randomly fails or hostiles attack.
You need to construct a good base with proper fail-safes to handle all that. For example, an asteroid could wipe out your generator/reactor room and you'll lose electricity. A properly designed base would have emergency power or a system that makes sure oxygen doesn't flow away into the hole in your base.[/QUOTE]
God damn it overv get out of my mind, had a similar idea to that a while back with terraria like ascetics
[QUOTE=Overv;32043545]I had a little game idea for when I've finished open.gl. Basically you're stranded on some random planet and you need to build a base and survive as long as possible. You need to manage mining operations to gain money and buy new parts for your base, like air vents and extra security. From time to time asteroids rain down on your planet, equipment randomly fails or hostiles attack.
You need to construct a good base with proper fail-safes to handle all that. For example, an asteroid could wipe out your generator/reactor room and you'll lose electricity. A properly designed base would have emergency power or a system that makes sure oxygen doesn't flow away into the hole in your base.[/QUOTE]
Make it co-op too, please
[QUOTE=Overv;32043545]I had a little game idea for when I've finished open.gl. Basically you're stranded on some random planet and you need to build a base and survive as long as possible. You need to manage mining operations to gain money and buy new parts for your base, like air vents and extra security. From time to time asteroids rain down on your planet, equipment randomly fails or hostiles attack.
You need to construct a good base with proper fail-safes to handle all that. For example, an asteroid could wipe out your generator/reactor room and you'll lose electricity. A properly designed base would have emergency power or a system that makes sure oxygen doesn't flow away into the hole in your base.[/QUOTE]
That's exactly the sort of thing I'm working towards too, weirdly enough. I've always thought something like that could be amazing, where you have to build up from nothing and maintain a base.
Call it "spacecraft"!
[QUOTE=ROBO_DONUT;32043639]Call it "spacecraft"![/QUOTE]
planaria
[QUOTE=thomasfn;32043352]This is my code:
[code]int id = GL.CreateProgram();
GL.UseProgram(id);[/code]
The error is being thrown (well, populated inside GL.GetError()) at the second line. Before anything about the shaders themselves is even loaded. I've confirmed it's UseProgram and not CreateProgram causing the error, and I've confirmed CreateProgram is outputting a valid ID (1).
[editline]31st August 2011[/editline]
I've also tried doing the code in different locations. For example in the loading stage, in the render loop etc. No dice.[/QUOTE]
Derp, I just realised you don't bind shaders and set them up like you do textures or buffers, that UseProgram call is not needed.
Augh cellular automata is pretty hard if you are still at the stage of not being able to figure tiling out
I want to render rule 00010010, or, in decimal, rule 18.
Now that I think of it, [url=http://www.wolframalpha.com/input/?i=rule+22]rule 22[/url] looks more like a sierpinski triangle than [url=http://www.wolframalpha.com/input/?i=rule+18]rule 18[/url]
The worst thing a graphics programmer ever has to deal with.
The black screen error.
[QUOTE=thomasfn;32043789]The worst thing a graphics programmer ever has to deal with.
The black screen error.[/QUOTE]
Worst thing because absolutely anything could be the cause, or..?
[QUOTE=esalaka;32043809]Worst thing because absolutely anything could be the cause, or..?[/QUOTE]
Pretty much that. You have all your geometry loaded into VBOs, all your shaders setup, your viewpoint sorted out, everything's drawing, and the result of your hard work is an empty window. And it could be anywhere in your code, and you have no clue what. Gah.
[QUOTE=thomasfn;32043851]Pretty much that. You have all your geometry loaded into VBOs, all your shaders setup, your viewpoint sorted out, everything's drawing, and the result of your hard work is an empty window. And it could be anywhere in your code, and you have no clue what. Gah.[/QUOTE]
Are the lights turned on?
Try changing the background color
(I once read about someone who tried everything and couldn't find a solution. His problem was that his background was black, and the model too. He then noticed that he didn't turn the lights on in his code)
[QUOTE=Overv;32043545]I had a little game idea for when I've finished open.gl. Basically you're stranded on some random planet and you need to build a base and survive as long as possible. You need to manage mining operations to gain money and buy new parts for your base, like air vents and extra security. From time to time asteroids rain down on your planet, equipment randomly fails or hostiles attack.
You need to construct a good base with proper fail-safes to handle all that. For example, an asteroid could wipe out your generator/reactor room and you'll lose electricity. A properly designed base would have emergency power or a system that makes sure oxygen doesn't flow away into the hole in your base.[/QUOTE]
You've read my mind >(
[QUOTE=thomasfn;32043789]The worst thing a graphics programmer ever has to deal with.
The black screen error.[/QUOTE]
The saddest part is that the black screen is what I get to look at the most when messing with new stuff.
[QUOTE=Darwin226;32043943]The saddest part is that the black screen is what I get to look at the most when messing with new stuff.[/QUOTE]
Actually everything was working fine until I decided to try moving to non-deprecated opengl, at which point I ran into a torrent of problems.
[QUOTE=Richy19;32043583]God damn it overv get out of my mind, had a similar idea to that a while back with terraria like ascetics[/QUOTE]
I had a similar idea also, except it was more like an RTS/city builder game. Sort of a spiritual successor to [url=http://en.wikipedia.org/wiki/Outpost_%28computer_game%29]Outpost[/url].
[QUOTE=thomasfn;32043789]The worst thing a graphics programmer ever has to deal with.
The black screen error.[/QUOTE]
I had that after I had finished my dynamic lighting system. I thought everything was perfect but just had a black window.
It seemed to work better after adding some lights to the scene
Sorry, you need to Log In to post a reply to this thread.